|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Style code trouble!
I have two pages that I recently validated through W3C and had the validator clean up the errors for me. Those two pages were uploaded again to the main site but the background color became black instead of the original color of purple. I tried inserting just regular bg color code but that didn't work.
<style type="text/css"> /*<![CDATA[*/ body.c8 {background-color:#37007b} p.c7 {margin-left:-325px;} div.c6 {margin-top:-50px; margin-left:-50px;} img.c5 {margin-top:-301px; margin-right:15px;} img.c4 {margin-left:-324px;} p.c3 {float: right; width: 50%; text-align: center;} p.c2 {float: left; width: 50%; text-align: center;} img.c1 {margin-right:330px} /*]]>*/ </style> This is the style type that contains the error. Note that the bg color is set to the custom value. This is the other style for the other page I happened to correct( I attempted copy and paste but had no luck either): <style type="text/css"> /*<![CDATA[*/ body {background-color:#37007b} p.c5 {margin-left:-325px;} div.c4 {margin-top:-50px; margin-left:-50px;} div.c3 {text-align: center} p.c2 {font-size: 144%} img.c1 {margin-right:330px} /*]]>*/ </style> If anyone has an idea of what could be wrong, I would greatly apprecitate the help! |
|
#2
|
||||
|
||||
|
Re: Style code trouble!
Could you clarify which block of code is working and which isn't?
Try comparing the selectors in each blog. For example, the first one has styles for Code:
body.c8 Code:
<body class="c8"> to the body tag regardless of its classes. If you compare the selectors as well as the classes used in the HTML itself, that might explain the results you're getting. |
|
#3
|
|||
|
|||
|
Re: Style code trouble!
Did you miss the semi-colon? eg
body.c8 {background-color:#37007b;} |
|
#4
|
||||
|
||||
|
Re: Style code trouble!
Normally, you don't need the semicolon for the last one. You only need it if you are separating multiple styles for the same thing.
|
|
#5
|
|||
|
|||
|
Re: Style code trouble!
i would say add semi colons to everything and remove the /*<![CDATA[*/ & /*]]>*/ (What is that stuff even for?)
|
|
#6
|
||||
|
||||
|
Re: Style code trouble!
Quote:
And Cecil is correct; the last semicolon in each block is optional. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|