Jump to content

Margin Tags Only Work In Body Element Not Css


geekdad
 Share

Recommended Posts

Unless I'm doing something wrong the following elements have to be put into the body element and not in the CSS.leftmargin, topmargin, bottommargin,rightmargin. I'm testing with Firefox 3.0.7 and IE 7.0They work in CSS for other elements but not the <body> Please check it out and amend the html description for body since none of those elements are currently mentioned there.

Link to comment
Share on other sites

Those aren't tags, they're attributes. The margin property should work just fine on the body element in CSS.

body {  margin-top: 15px;  margin-right: 10px;  margin-bottom: 5px;  margin-left: 10px;}

or shorthand:

body { margin: 15px 10px 5px 10px; }

Link to comment
Share on other sites

Those aren't tags, they're attributes. The margin property should work just fine on the body element in CSS.
body {  margin-top: 15px;  margin-right: 10px;  margin-bottom: 5px;  margin-left: 10px;}

or shorthand:

body { margin: 15px 10px 5px 10px; }

OK. I figured out what the problem was. I have several different body flavours in the css file. I was missing the leading period in front of the one I was using, (testBody { instead of .testBody{)and so it wasn't being applied. Fixed that and now it works.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...