CSS3
CSS3
CSS3
Week 5
CSS3 Overview
1
CSS3
• CSS is used to control the style and layout
of Web pages.
• CSS3 is the latest standard for CSS.
• Example:
div {
transform:rotate(30deg);
-moz-transform:rotate(30deg); /* Firefox */
}
CSS3
• CSS3 is completely backwards compatible, so you will
not have to change existing designs. Browsers will
always support CSS2.
tr:nth-child(even) {
background:yellow;
}
Additional CSS3 modules
• CSS3 modules:
– Borders and Backgrounds
– Text Effects
– 2D/3D Transformations
– Animations
– Multiple Column Layout
– User Interface
div
{
border:2px solid;
border-radius:25px;
-moz-border-radius:25px; /* Firefox 3.6 and earlier */
}
CSS3 Borders
• Box Shadow
div
{
box-shadow: 10px 10px 5px #888888;
}
• Border Image
div
{
border-image:url(border.png) 30 30 round;
}
CSS3 Backgrounds
• CSS3 contains several new background
properties, which allow greater control of
the background element.
• Background Origin property
div
{
background:url(img_flwr.gif);
background-repeat:no-repeat;
background-size:100% 100%;
background-origin:content-box;
}
CSS3 Backgrounds
• CSS3 allows you to use several
background images for an element.
• Example: Set two background images for
the body element.
body
{
background-image:url(img_flwr.gif),url(img_tree.gif);
}
CSS3 Text Effects
• CSS3 contains several new text features.
• Example: Text Shadow
h1
{
text-shadow: 5px 5px 5px #FF0000;
}
• You will have to describe your selected font with the new
CSS3 @font-face rule.
CSS3 Fonts
• In the @font-face rule you define a name
for the font, and the URL to the font file:
@font-face
{
font-family: myFirstFont;
src: url('Sansation_Light.ttf'),
url('Sansation_Light.eot') format("opentype"); /* IE */
}
}
CSS3 Multiple Columns
• Example: Column-rule property
div
{
column-rule:3px outset #ff00ff;
}
CSS3 User Interface
• In CSS3, some of the new user interface
features are resizing elements, box sizing,
and outlining.
• Links:
– Live demos: http://blueprintcss.org/tests/
– Blueprint Wiki: https://github.com/joshuaclayton/blueprint-css/wiki
References
• http://www.w3schools.com/css3/default.asp
• http://www.blueprintcss.org/