user1384668
user1384668

Reputation: 127

div class and style together in PHP

I try to make div class and style together, but somehow style is not working. I don't find answer.. Here is the code:

PHP

<div class="table">
<p><b>TEXT here</b><br />
...</p>
<div class="table_cell" style="width=180px !important; color=red !important;"><p>1<br />2<br />3<br />4<br />5<br />6</p></div>
<div class="table_cell" style="width=645px !important;"><p><b>&euro; 282</b><br /></p></div>
<p>Good luck in the future</p></div>

CSS

    div.table{
margin: 10px;
padding: 10px;
width: 825px;
border: 1px solid;
background: #E0F8EC;
border-radius:10px;
}

div.table_cell{
margin-top: 10px;
margin-bottom: 10px;
float: left;
}

Style defined in div is not working, except one from external css file.

Upvotes: 0

Views: 40580

Answers (3)

K..
K..

Reputation: 4233

the syntax is like width: 100px !important and not width=100px !important

Upvotes: 0

Dave
Dave

Reputation: 29141

In your style, use the same name:value; syntax that you use in your CSS (notice the colon (:) between the two:

<div class="table">
<p><b>TEXT here</b><br />
...</p>
<div class="table_cell" style="width:180px !important; color:red !important;"><p>1<br />2<br />3<br />4<br />5<br />6</p></div>
<div class="table_cell" style="width:645px !important;"><p><b>&euro; 282</b><br /></p></div>
<p>Good luck in the future</p></div>

Upvotes: 0

Denys S&#233;guret
Denys S&#233;guret

Reputation: 382474

Follow css syntax in your style attribute :

style="width:180px; color:red;"

Upvotes: 6

Related Questions