Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced CSS & CSS3.

Similar presentations


Presentation on theme: "Advanced CSS & CSS3."— Presentation transcript:

1 Advanced CSS & CSS3

2 CSS Backgrounds You already know:
background-color:#BBDDFF; Some of you know how to use a picture: background-image:url('paper.gif'); You may know how to control if it repeats: background-repeat:repeat-x; or repeat-y, no-repeat Or if it’s fixed and doesn’t scroll: background-attachment:fixed;

3 CSS Backgrounds How about background-position? body{
background-image : url(‘liberty.png'); background-repeat : no-repeat; background-position : right top; margin-right:300px; }

4 CSS Backgrounds (cont’d)
background-size property Value Description length Sets the width and height of the background image. The first value sets the width, the second value sets the height. If only one value is given, the second is set to "auto" percentage Sets the width and height of the background image in percent of the parent element. The first value sets the width, the second value sets the height. If only one value is given, the second is set to "auto" cover Scale the background image to be as large as possible so that the background area is completely covered by the background image. Some parts of the background image may not be in view within the background positioning area contain Scale the image to the largest size such that both its width and its height can fit inside the content area

5 CSS Positioning Lock an element so it’s not affected by scrolling:
#mydiv { position:absolute; left:100px; top:150px; }

6 CSS Overflow Show scroll bars if the content doesn’t fit within a DIV:
div.scroll { background-color:#00FFFF; width:100px; height:100px; overflow:scroll; }

7 CSS Transparency/Opacity
.whitebox   {   width:400px;   height:180px;   margin:30px 50px;   background-color:#ffffff;   border:1px solid black;   opacity:0.6;   }

8 CSS3

9 CSS3 Borders Rounded corners: Shadow
div { border:2px solid; border-radius:25px; } Shadow div { box-shadow: 10px 10px 5px #888888; }

10 CSS3 Gradients Linear gradients:
Different browsers require different settings So we specify them all just in case background: linear-gradient(direction, color-stop1, color-stop2, ...); Example: #grad { background: -webkit-linear-gradient(red, blue); /* For Safari */ background: -o-linear-gradient(red, blue); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(red, blue); /* For Firefox 3.6 to 15 */ background: linear-gradient(red, blue); /* Standard syntax */ }

11 CSS3 Text Effects Text shadowing:
h1 { text-shadow: 5px 5px 5px #FF0000; }

12 CSS3 Transforms Shifting, grow/shrink, rotate skew Example – rotation:
div { transform: rotate(30deg); -ms-transform: rotate(30deg); /* IE 9 */ -webkit-transform: rotate(30deg); /* Safari and Chrome */ }

13 Exercise Create a page that has A gradient background
4 boxes – each with a div 1 that is semi-opaque 1 that is rotated 1 that has rounded borders with at a piece of text that has shadows. 1 That has more text than can fit in the box and has scroll bars.


Download ppt "Advanced CSS & CSS3."

Similar presentations


Ads by Google