Sei sulla pagina 1di 2

Fisa css 4

Background-ul
Foarte util nu doar pentru elementele body, div, p, </head>
table dar poate fi utilizat pentru marea majoritate <body>
a selectorilor intalniti in meniuri </body>
</html>
1. This example demonstrates how to set the
background color for an element la fe se procedeaza pentru repetare orizontala:
<html> repeat-x
<head> sau
background-repeat: norepeat
<style type="text/css"> daca nu dorim sa se mai repete
body {background-color: yellow}
h1 {background-color: #00ff00} 4. Pozitionare pentru background:
h2 {background-color: transparent} <html>
p {background-color: rgb(250,0,255)} <head>
</style>
<style type="text/css">
</head> body
{
<body> background-image: url('smiley.gif');
background-repeat: no-repeat;
<h1>This is header 1</h1> background-attachment:fixed;
<h2>This is header 2</h2> background-position: 50px 100px;
<p>This is a paragraph</p> }
</style>
</body>
</head>
</html>
<body>
2. This example demonstrates how to set an
<p><b>Note:</b> For this to work in Mozilla, the
image as the background.
background-attachment property must be set to
<html><head>
"fixed".</p>
<style type="text/css"> </body>
body </html>
{
background-image: 5. Toate proprietatile intr-o singura declaratie
url('bgdesert.jpg') culoare, imagine, no-repeat si centrat
}
</style> <html>
</head> <head>
<body> <style type="text/css">
</body> body
</html> {
background: #00ff00 url('smiley.gif') no-repeat
3. This example demonstrates how to repeat a fixed center;
background image only vertically. }
<html> </style>
<head>
</head>
<style type="text/css">
body <body>
{ <p>This is some text</p>
background-image: <p>This is some text</p>
url('bgdesert.jpg'); </body>
background-repeat: repeat-y
} </html>
</style>
1
Fisa css 4
Margini <body>
Este zona libera dintre border si celelalte elemente <p>This is a paragraph with no margin
ale paginii. Altfel spus cat de mult spatiu liber specified</p>
putem lasa in jurul elementului. <p class="topmargin">This is a paragraph with a
1. Setarea tuturor marginilor intr-o singura specified top margin</p>
declaratie
</body>
<html> </html>
<head>
4. Setarea marginii de jos folosind masurarea
<style type="text/css">
in cm
p.margin {margin: 2cm 4cm 3cm 4cm}
<html>
</style>
<head>
</head>
<style type="text/css">
p.bottommargin {margin-bottom: 2cm}
<body>
</style>
<p>This is a paragraph with no specified
margins</p> </head>
<p class="margin">This is a paragraph with
specified margins</p> <body>
<p>This is a paragraph with no specified <p>This is a paragraph with no margin
margins</p> specified</p>
</body> <p class="bottommargin">This is a paragraph
with a specified bottom margin</p>
</html> <p>This is a paragraph with no margin
specified</p>
2. Setarea marginii de deasupra </body></html>

<html> 5. Setarea marginii din stanga


<head> <html>
<head>
<style type="text/css">
p.topmargin {margin-top: 5cm} <style type="text/css">
</style> p.leftmargin {margin-left: 2cm}
</style>
</head>
</head>
<body> <body>
<p>This is a paragraph with no margin <p>This is a paragraph with no margin
specified</p> specified</p>
<p class="topmargin">This is a paragraph with a <p class="leftmargin">This is a paragraph with a
specified top margin</p> specified left margin</p>
</body> </body></html>
</html>
6. Setarea marginii din dreapta
3. Setarea marginii de deasupra folosind <html><head>
procentul <style type="text/css">
<html> p.rightmargin {margin-right: 5cm}
<head> </style></head>
<style type="text/css"> <body>
p.topmargin <p style="text-align:right">This is a right aligned
{ paragraph with no margin specified</p>
margin-top: 25% <p class="rightmargin" style="text-
} align:right">This is a right aligned paragraph with
</style> a specified right margin</p>
</head> </body></html>

Potrebbero piacerti anche