Is this BUG just in my VS.net 2003???

ManicCW

Well-known member
Joined
Jul 21, 2005
Messages
428
Location
Mostar
Programming Experience
Beginner
Have you ever tried to set body margin in external css file? Well if you add something like this:

body{
margin=5px;
}

in css file and link it to aspx page all controls on page get this margin!? I also have some other css classes attached to textbox ect. but i don't think that is the problem.

btw: page is viewd normaly in browser.
 
First off... it's bad CSS.... margin: 5px; is the correct syntax.
See if that helps.

-tg
 
Well, I haven't been to this part of the forum in a while. But in case someone may read this:

This is how CSS is designed to work. CSS uses inheritance which means that anything that is contained between the body tags will inherit the styles you have set for the body. Just think how that simplies things.

To remove the margin from the objects contained in the body, you can either set each object's margin style individually (not recommended) or wrap all the objects in another tag (div for example) and set the margin style for that tag (recommended).

An example:
HTML:
<body style="margin:5px 5px 5px 5px;">
  <div style="margin:0px 0px 0px 0px;">
    <!-- all the page contents -->
  </div>
</body>
Notice how I've specified each margin setting. The margin property is meant as a shorthand for setting all margins at the same time. Specifing only one value is valid for some browsers but one day, when all the browsers are truely CSS compliant, you will need to specify each value as shown in my example.

margin: margin-top margin-right margin-bottom margin-left
 
Back
Top