March 15, 2012
Certain properties don't transfer over from external style sheet
Question by Adam
So I’m currently designing a website, and I’m using the same CSS for every page. Originally, I had it included in each individual document, however it got annoying having to change it on every page, so instead I set them all to work off an external style sheet. Now, it worked for the most part, however a couple properties stopped working, namely text-align and float. What’s weird is that if you include those properties in an internal style sheet, it starts working again. I’m guessing it has to do with some sort of priority thing, but I’m wondering why those specific properties don’t work, and if there’s any way of specifying those properties in an external style sheet. Thanks!
CSS:
div.box1
{
border-width:0px;
text-align:left
}
img.floatLeft
{
float: left;
margin: 5px;
}
img.floatRight
{
float: right;
margin: 5px;
}
HTML:
<div class="box1">
<font face="helvetica">
TEXT TEXT TEXT <br><br><br>
<b>NAME</b>
<br>
<img src="NAME" class="floatRight">
TEXT TEXT TEXT<br><br>
<b>NAME2</b>
<br>
<img src="NAME2" width="214" height="130" class="floatLeft">
TEXT TEX TEXT
</font>
</div>