CSS3 contine trei noi proprietati pentru background: background-size, background-origin
si background-clip
, in plus, se pot adauga mai multe imagini pt. background la un element HTML si se pot crea culori gradient cu: linear-gradient
.
background-size: width height;
permite definirea lungimii si inaltimii (width height) de afisare a imaginii pt. background.<style> #id1 { width:200px; height:100px; border:1px solid blue; background:url('css/css3.jpg'); background-size:100px 60px; background-repeat:no-repeat; margin:5px auto; } #id2 { width:300px; height:120px; border:1px solid #01da02; background:url('css/css3.jpg'); background-size:contain; background-repeat:no-repeat; margin:5px auto; } #id3 { width:300px; height:120px; border:1px solid silver; background:url('css/css3.jpg'); background-size:cover; margin:5px auto; } </style> <div id="id1">Free CSS Course - size in pixels</div> <div id="id2">coursesweb.net - size contain</div> <div id="id3">marplo.net - size cover</div>
background: linear-gradient();
cu aceasta sintaxa:
<style> #id1 { background: linear-gradient(to bottom right, #11ee22, #fefe88, #1122fb); height:120px; width:300px; } </style> <div id="id1">Free CSS Course<br /> coursesweb.net</div>
<style> #id1 { background: linear-gradient(to bottom right, #11ee22 0%, #fefe88 40%, #1122fb 75%); height:120px; width:300px; } </style> <div id="id1">Free CSS Course<br /> coursesweb.net</div>
background-origin
specifica zona de pozitionare a imaginii de fundal.<style> #id1 { width:350px; height:120px; padding:20px; border:3px solid blue; background:url('css/css3.jpg'); background-repeat:no-repeat; background-color:#bcfede; background-origin:content-box; } #id2 { width:350px; height:120px; padding:20px; border:3px solid blue; background:url('css/css3.jpg'); background-repeat:no-repeat; background-color:#bcfede; background-origin:border-box; margin-top:5px; } </style> <div id="id1">Position the background image within the content-box</div> <div id="id2">Position the background image relative to the border</div>
background-clip
se foloseste pentru a determina suprafata de afisare a culorii pentru fundal ( background-color ).<style> #id1 { width:350px; height:120px; padding:20px; border:2px solid blue; background-color:#cdfeda; background-clip:padding-box; } #id2 { width:350px; height:120px; padding:20px; border:2px solid blue; background-color:#cdfeda; background-clip:content-box; } </style> <div id="id1">background-clip with padding-box</div> <div id="id2">background-clip with content-box</div>
background-image
functii url() (separate prin virgula) cu adresele imaginilor.<style> #id1 { width:400px; height:150px; background-image: url('css/html_course.jpg'), url('css/css3.jpg'); background-repeat: no-repeat, repeat-x; background-position: center top, center bottom; } </style> <div id="id1">Multiple background images</div>
<table><tr> <th>Title 1</th> <th>Title 2</th> </tr></table>
.some_class { line-height: 150%; }
document.getElementById("id_button").onclick = function(){ window.open("http://coursesweb.net/"); }
$ar_dir = scandir("dir_name"); var_export($ar_dir);
He will sleep there. - El va dormi acolo.
Él dormirá allí. - El va dormi acolo.