View Full Version : While() CSS Styling
Shibby-Shabs
17-08-2011, 09:07 AM
I've noticed this for a while but is there a reason why CSS styles don't work in while(); loops.
Apolva
17-08-2011, 10:29 AM
CSS are rules for how things should look on a page.
It is not a scripting language such as Javascript, so does not feature while / for statements.
Shibby-Shabs
17-08-2011, 12:16 PM
Sorry, I should of been more clear, I'm doing outputting data from a mysql_query using mysql_fetch_assoc(); but when I use a while loop the font-size returns to it's default size and font-family.
Apolva
17-08-2011, 03:02 PM
There shouldn't be any styling issues caused by using any loop in PHP. I assume the issue is caused because the data you are outputting is presented in a table, which tend to ignore some parent CSS rules.
Try adding ",td,th" to the end of your CSS selector which determines text size, eg:
body {
font-size:12px;
}
becomes:
body,td,th {
font-size:12px;
}
Of course, any other properties in that original selector would then apply to each table cell, so you'll probably want to set the font-size property by itself.
Shibby-Shabs
17-08-2011, 11:55 PM
^ I tried that but I'll try again after school, it is in face inside a table.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.