Login | Register | FAQ
Anonymous

Trouble with body{} usage

+ Post a reply

7 posts Page 1 of 1


Trouble with body{} usage

by jessedotnet » Fri Jun 22, 2012 5:39 pm

Having trouble changing body style with css. The following section at the beginning of an external .css file causes the following section (i.e. h1{...}) not to work.

body{
background-color: black;
margin: 40px 0px 0px 0px;
}‪​‍

Any suggestions are appreciated.
User avatar

jessedotnet

  • Posts: 20
  • Joined: Thu Jun 07, 2012 7:04 pm

Re: Trouble with body{} usage

by XainPro » Sat Jun 23, 2012 11:01 am

please share the complete page code all your code is right and when you are using 0 you do not need to mention the measurable unit i.e px % 0 means 0 for all :)
User avatar

XainPro

  • Posts: 3567
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: Trouble with body{} usage

by soccerwebsitemaker » Sat Jun 23, 2012 1:54 pm

Don't forget: Bonus Tip: You can use background: black; instead of background-color: black;
User avatar

soccerwebsitemaker

  • Posts: 139
  • Joined: Sat Dec 31, 2011 6:25 pm
--
Coins. Profile. Games. Chat. Fun.

CoinAwards.

Check it out at http://www.coinawards.net63.net/

whole .css file

by jessedotnet » Sun Jun 24, 2012 1:03 am

Thanks for the responses. Here is the whole .css file as it stands. I appreciate the tips and intend to implement them. As you can see I had to move body{} to the bottom of the file so it wouldn't affect the other element modifications. However, when I open the file as it is in Komodo it shows an error at the end of the body{} section and states that it expects certain declarations. Thanks for the help.

h1 { font: small-caps 36pt 'Times New Roman', Times, serif; color: #996600; line-height: 60px; text-align: center; margin-top: 10px; } h3 { font: bold 16pt arial, verdana, sans-serif; letter-spacing: 3px; text-align: center; margin-top: 0px; line-height: 8px; } h4 { font: 18pt arial, verdana, sans-serif; color: #663300; text-align: center; margin-top: 10px; } h5 { font: 6pt arial, verdana, sans-serif ; color: #FFFFCC; text-align: center; clear:both; } h6{ font: 12pt arial, verdana, sans-serif ; color: #663300; text-align: center; clear:both; font-style: oblique; } p { font: 16pt arial, verdana, sans-serif; color: #663300; text-indent: 20px; margin-top: 0px; } a:link { color: #FFFFCC; text-decoration:none; } a:visited { color: #FFFFCC; } a:hover { color:#660000; } div.title{ background-color: #FFCC66; height: 80px; width: 700px; margin: 10px auto 40px auto; border: 6px #FFFFCC ridge; } #galleryPic1{ position: absolute; z-index: 2; } #galleryPic2{ position: absolute; z-index: 1; } #photo { float: left; height:194px; width:150px; border: 3px #FFFFCC ridge; margin-right: 10px; } #home1 { float:right; height: 320px; width: 435px; border: thick #FFFFCC ridge; margin: 20px 40px 20px 0px; } #pageframe { height: 530px; width: 740px; border: 10px #FFFFCC ridge; background: #996633; margin: auto auto auto auto; } #linkbox { height: 290px; width: 130px; background: #996633; padding: 20px 0px 20px 0px; margin: 20px 60px 20px 40px; float:left; } #features { float:right; height: 300px; width: 415px; padding: 10px 10px 10px 10px; border: thick #FFFFCC ridge; margin: 20px 40px 20px auto; background: #FFCC66; } #interior { font: 12pt arial, verdana, sans-serif ; color: #663300; float:left; height: 252px; width: 180px; margin-top: 0px; line-height: 18px; } #exterior { font: 12pt arial, verdana, sans-serif ; color: #663300; float:right; height: 252px; width: 200px; margin-top: 0px; } span.biglink { font: 16pt arial, verdana, sans-serif ; line-height: 75px; text-transform: uppercase; } span.littlelink{ text-decoration:underline; } span.current { color: #FFCC66; } span.smalloffer { font-size: .7em; } body { background-color: black; margin: 40px 0px 0px 0px; }‪​‍
User avatar

jessedotnet

  • Posts: 20
  • Joined: Thu Jun 07, 2012 7:04 pm

Re: Trouble with body{} usage

by jessedotnet » Sun Jun 24, 2012 2:33 am

I think there is some problem with the file that is causing the error. I created one .css file by copy and pasting. I created another by typing into notepad. they look identical but when I copy and paste they behave differently:

body {

background: black;

}‪​‍
h1{

font: small-caps 36pt 'Times New Roman', Times, serif;

color: #996600;

background: #FFCC66;

}



body{
background: black;
}
h1{
font: small-caps 36pt 'Times New Roman', Times, serif;
color: #996600;
background: #FFCC66;
}


using them on the same .htm file the second works and the first doesn't. i created the first in leafpad, a text editor that comes with Lubuntu.
User avatar

jessedotnet

  • Posts: 20
  • Joined: Thu Jun 07, 2012 7:04 pm

Re: Trouble with body{} usage

by XainPro » Sun Jun 24, 2012 8:40 am

maybe there is some kind of issue with your file encoding 1st file encoding was different and 2nd file which works have utf-8 encoding because i have seen some un recognizable characters in your 1st file( at the end of file).
ANy how i am happy that at last it really works.
User avatar

XainPro

  • Posts: 3567
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: Trouble with body{} usage

by jessedotnet » Mon Jun 25, 2012 2:55 pm

Thank you very much, CubeSquare, for your help. I implemented your changes and everything looks great. I'm still not quite sure what the original problem was. Originally, I made the file by copying and pasting out of examples in the tutorial. Perhaps copying from a web page into a text file introduces some kind of corruption with respect to the encoding.
User avatar

jessedotnet

  • Posts: 20
  • Joined: Thu Jun 07, 2012 7:04 pm


+ Post a reply

Page 1 of 1

?>