A few questions about CSS?

Hey im not knew to CSS but just confused about certain things. Here are my questions if any are answered it is appreciated as it will help me greatly.

1. When i validate my stylesheet all the CSS is valid apart from one thing at the top it says no error or warning found, needs correct document parse tree. What is this?

2. When defining margins like {margin:0px 5px 0px 5px} in what order does this come for example is it right,left,top,bottom.

3.When creating layers what is the point of using padding and margins like the above or not using padding and use absolute positioning for the layers with defined margins like {margin-left:120px}. Is this wrong to use absolute positioning and defining margins like this or does this make the layout render different in different browsers.


Cheers
Chris SharkeyThat's actually very good — the validator is implying that your CSS is valid. It's just saying that it's best to use valid markup along with your CSS in order for best results. It's clockwise. For more information, see the offical W3C documentation (<!-- m --><a class="postlink" href="http://www.w3.org/TR/REC-CSS1#margin">http://www.w3.org/TR/REC-CSS1#margin</a><!-- m -->). It's not really wrong to use absolute positioning when there is no other option available, I suppose; however, overusing it is usually a sign that you've done something wrong. Generally, you never need to if your CSS is written correctly.Great cheers mate you have cleared a few things up as for the last question im going to revise a check out the css from other peoples sites to try and get the just of whats happening.

One more question when you use position:absolute will float not work as i have tryed to use the float:right attribute with postion:absolute before and it hasnt floated right.

Cheers again mate thanks.No problem. Yes — since the element is absolutley positioned I don't believe using float will have an effect on it. Generally (or from what I've seen at least), the element cannot contain a position property along with top and left values if you want float to correctly work. Moreover, you wouldn't even need to use float due to the simple fact that you could position the element wherever you want by setting the top and left properties, however this is not recommended because it will not look quite right across different resolutions and because float, alone, should be all you'd need to enable block-level elements to be able to sit next to each other.Thanks fredmv i will start to just use the float property instead of the position sorry to be a pain again but another question popped into my head as you said about the resolutions is you use float for the box elements im assuming they stay the same throughout different resolutions but if you you the position property they wont.

Thanks again mate.You're very welcome. Well, that question really depends on who you ask that. I, personally, would say this: yes, it is the same on resolutions when using absolute positoning, but to an extent. Why? Because the elements are technically in the same place, but it doesn't appear as if they are due to a larger or smaller resolution. By using elements with only a float property defined, you can then get block-level elements to sit next to each other and define their dimensions in percentages, thus automatically adjusting to different resolutions.I think i understand i will try and have a a shot at trying it with the different properties on different resolutions to see what the different effects are.


Thanks againYou're very welcome. ;)Float: The Theory (<!-- m --><a class="postlink" href="http://www.positioniseverything.net/articles/float-theory.html">http://www.positioniseverything.net/art ... heory.html</a><!-- m -->)
 
Back
Top