Glom Posted May 2, 2006 Share Posted May 2, 2006 When I try to validate my stylesheet, I intermittantly get warnings that, where I haved used text-align, "This property only applies to block-level elements".The weird thing is that it does not happen every time. Only some times. Link to comment Share on other sites More sharing options...
Jonas Posted May 2, 2006 Share Posted May 2, 2006 It happens when you use it on elements that aren't displayed as a block.http://www.w3.org/TR/2004/CR-CSS21-2004022...ml#display-propIf it's not a block, there's no left, right and middle to it, because it will just wrap around the text, so no reason to use text-align. You must have used text-align on an element that is by default displayed as something else than block... Link to comment Share on other sites More sharing options...
Glom Posted May 2, 2006 Author Share Posted May 2, 2006 So what's not a block? I get it with divs, I get it with body. How would I tell it to justify a paragraph or the caption of a table? Link to comment Share on other sites More sharing options...
aspnetguy Posted May 2, 2006 Share Posted May 2, 2006 div, p, ul, etc are all block elements.You should not get it with those elements. Post your code and we will see what the trouble is. Link to comment Share on other sites More sharing options...
Glom Posted May 2, 2006 Author Share Posted May 2, 2006 /*CONTENT STYLES*/body { background-color:#88FFFF; color:#000010; }p { font:85% sans-serif; }h1 { font-family:sans-serif; }h2 { color:#333333; background-color:inherit; font:900 130% sans-serif; }h3 { color:#444477; background-color:inherit; font:800 85% sans-serif; }h4, caption { color:#100010; background-color:inherit; font:800 80% sans-serif; text-align:center; }a:link { color:#004080; background-color:inherit; font-family:sans-serif; }a:visited { color:#006060; background-color:inherit; font-family:sans-serif; }a:hover, a:active { color:#001010; background-color:inherit; font-family:sans-serif; text-decoration:none; }li { color:#000010; background-color:inherit; font:85% sans-serif; }dd { color:#000010; background-color:inherit; font:85% sans-serif; }dt { color:#000010; background-color:inherit; font:600 85% sans-serif; margin-top:15px }tr { background-color:inherit; color:#000010; font:85% sans-serif; }img { border-style:none; margin:0 0; }.pic {}/*------------------------------------------------------------------------------------------TEMPLATE STYLESDivision ids*/#cladding { width:90%; }#logo { background-color:#FFFFFF; background:url("img/logo.gif"); color:#000000; width:100px; height:100px; float:left; }#title { background-color:#FFFFFF; color:#000000; height:100px; margin-left:100px; }#nav { border-top:1px solid; float:left; width:100px; min-height:450px; }#content { margin-left:100px; border-left:1px solid; border-bottom:1px solid; border-top:1px solid; padding:10px; min-height:450px; text-align:justify; }#turnpage { text-align:center; }#footer { clear:both; font-family:sans-serif; font-size:65%; }/*----------------Text ids*/#chapter { margin:8px 0px 2px 10px; text-transform:uppercase; }#page { margin:0px 0px 0px 10px; }#copyright { float:left; }#update { float:right; }/*---------------Image ids*/#frontbtn, #xhtml { margin-top:30px; }#debbtn, #scibtn, #cycbtn, #safbtn, #accbtn, #appbtn {}#css {}#prev, #next {}#footlogo { height:50px; } Link to comment Share on other sites More sharing options...
aspnetguy Posted May 2, 2006 Share Posted May 2, 2006 <caption> is not a block level element. You will need to split up that piece of code and remove text-align from the caption class.Having text-align for h4 is fine but not when you are assigning the same attributes to h4, caption at the same time. Link to comment Share on other sites More sharing options...
Jonas Posted May 2, 2006 Share Posted May 2, 2006 (edited) h4, caption { color:#100010; background-color:inherit; font:800 80% sans-serif; text-align:center; }That's the problem, I guess?EDIT: Yeah... Edited May 2, 2006 by Jonas Link to comment Share on other sites More sharing options...
Glom Posted May 2, 2006 Author Share Posted May 2, 2006 No, it's complaining every time it appears, not just at that entry. I even removed text-align from that part and it is still complaining about the other elements. Link to comment Share on other sites More sharing options...
aspnetguy Posted May 2, 2006 Share Posted May 2, 2006 what other elements??? When I validated it it only flagged h4, caption Link to comment Share on other sites More sharing options...
Glom Posted May 2, 2006 Author Share Posted May 2, 2006 what other elements??? When I validated it it only flagged h4, caption<{POST_SNAPBACK}> When I validated the file, it flagged all the elements with text-align?tr, #turnpage everything. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now