开发者

using CSS properties

开发者 https://www.devze.com 2023-03-22 09:30 出处:网络
I started coding html website with CSS and <div>\'s. Before, I would (en)code with tables. I have to ask this question because I don\'t know how can I code properly with CSS and <div>s.

I started coding html website with CSS and <div>'s. Before, I would (en)code with tables. I have to ask this question because I don't know how can I code properly with CSS and <div>s.

I tried something but I found a lot of bugs and I asked all of them by this site. Now, for ex.: What is the different between the 'margin-top' and 'top' properties or 'margin' and 'top, left, right, bottom' properties.

I want to learn something like that. I know CSS so so but I want to learn properties of <div> tag. Please help me, Thanks a lot.

Edit: Not only margin or 'top, left, right, bottom' properties. I want to learn all of <div> tag properti开发者_开发知识库es and <div> tag positioning CSSs (properties). I need a lot of idea and document. Please write what do you know. :)


I would suggest learning about the box model:

http://www.w3.org/TR/CSS2/box.html

And reference the W3C site for the DIV tag:

http://www.w3.org/wiki/HTML/Elements/div

And maybe read about CSS Reset scripts:

http://meyerweb.com/eric/thoughts/2007/04/18/reset-reasoning/


If you set margin:5px will add margin for all sides of the element (top,right,bottom,left). If you want to specify the side of the margin, for example top, you can you use margin-top:5px. But also, you can use

margin:5px 10px 15px 20px this is a shorthand of the following properties

margin-top:5px;
margin-right:10px;
margin-bottom:15px;
margin-left:20px;

The same philosophy is used for padding.

An easy to follow guide for css is the following: http://www.cssbasics.com/

The css 2.1 recommendations can be found here: http://www.w3.org/TR/CSS21/

Using firebug or any built-in developer tools, it's great help to understand how css works and play easily with it.

Also, sitepoint has good css reference: http://reference.sitepoint.com/css


top moves an element in various different ways, depending on the value of the position property.

margin-top puts a space between the top of the element and the previous element (subject to the rules for collapsing margins)

0

精彩评论

暂无评论...
验证码 换一张
取 消