1.Centered horizontally
To center an object horizontally in block type. you must specify the with and set the css properties left and right is auto.
div#page {width: 960px; margin: 0 auto}
2.Centered Text Vertically
to center the text vertically in the div tag. you must specify the height of this tag and add the line-height properties with the height of div.
<div id="content">your content here</div>
-----
div#content {position: absolute; top: 50%; height: 500px; margin-top: -250px}3.Conditional Comment
If you want your desired css just applied for only certain browser. you can use conditional comments. For example, to apply its own css for IE.
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ie-stylesheet.css" />
< ![endif]-->
4. Fluid Images
<link rel="stylesheet" type="text/css" href="ie-stylesheet.css" />
< ![endif]-->
4. Fluid Images
Fluid Image is the image that its size is not exceed its container. If an image size is 300px and placed inside an 200px container. so the image scaled to 200px. To do this, you can simply set max-width properties is 100px.
img{max-width: 100%}
As for IE, replace max-width by width
img{width: 100%}
5.3D button
By setting the border color and background color. you can make a 3D button with div tag.
div#button {height:30px; width: 70px; background: #888;
border: 2px solid; border-color: #999 #777 #777 #999 }
6.CSS SHORTHAND
6.CSS SHORTHAND
body {font: font-style font-variant font-weight font-size line-height font-family;}
7.MULTIPLE CLASS
<div class="class-1 class-2 class-3"></div>
7.MULTIPLE CLASS
<div class="class-1 class-2 class-3"></div>
In cases where a property is declared in multiple layers, the value declared in the final grade will be effective.
8. a style
A link with a tag will have 4 states: link, visited, hover, active. You can style for each different states:
No comments:
Post a Comment