Is there any difference in:
#example .test{margin-top:10px}
And
#example span.test{margin-top:10px}
.test is totally unique, no any class with that name exists. I have been trying to use like
<div id="example">
<label for="name">Name</label>
<input name="name" type="text" />
<span class="test">asdfghjkl</span>
</div>
The first css won’t work, while the second works fine. Just wondering why first wont work?
Thanks
Edit:
I found out that in the input field (in above example), i had put float:left;, which was causing the problem. If anyone is interested, here you can see example. If you remove float:left;, it will work fine.
http://jsfiddle.net/CmXrX/1/
I found out that in the input field (in above example), i had put float:left;, which was causing the problem. If anyone is interested, here you can see example. If you remove
float:left;, it will work fine. http://jsfiddle.net/CmXrX/1/