Div aligns changes with adding class after id

I am really facing some strange problem. Here is sample code and sample code code

HTML

<div id="showCatagory_<?php echo $row['catagory_id']; ?>" class="left"  style="display:block">
<?php echo $value; ?>
</div>

CSS

.left { float:left }

When I use this one <div id="showCatagory_<?php echo $row['catagory_id']; ?>" class="left" style="display:block">, I get a snapshot that is wrong

enter image description here

And if I use <div class="left" id="showCatagory_<?php echo $row['catagory_id']; ?>" style="display:block">, then I get the correct alignment, which is in the following figure

here i put class="left"after id to do it right. Can anyone tell me why

enter image description here

Can someone tell me why

<div class="left" id="showCatagory_<?php echo $row['catagory_id']; ?>" class="left"  style="display:block">

differs from

<div id="showCatagory_<?php echo $row['catagory_id']; ?>" class="left" style="display:block">
+3
source share
3 answers

There are still many typos in the question, if you look carefully ... but I understand what you mean ... you ask why the position of the class attribute affects the result.

, html. $row[category_id']? , str_replace('"', '', $row[category_id]);

+1

; , , - PHP, , .

<tag foo="bar" bar="<?php echo foo(); ?>"></tag>

, foo() , PHP , HTML :

<tag foo="bar" bar="Error Statement:
Error details...
  > Error echoes HTML markup characters.
Error trace information (line: 263)"></tag>

, , . , foo="bar" PHP, , .

+1

I was stupid. I used float: left, but did not use clearly. And after that I got the correct display. Thank you all

+1
source

All Articles