آموزش گام به گام CSS 2.0 بخش سیزده

 


برای ثابت کردن یا حرکت عکس پشت زمینه هنگامی که صفحه ما دارای scroll مطالب است از دستور background-attachment بصورت زیر استفاده میشود:

Code:
<..!DOCTYPE html>
<..html>
<..head>
<..style>
body
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-attachment:fixed;
}
<../style>
<../head>
<..body>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<..p>The background-image is fixed. Try to scroll down the page.<../p>
<../body>
<../html>

 

Text Fotmating
 
Text Color:
 
برای تنظیم رنگ متن مورد نظر در CSS از خاصیت COLOR استفاد میشود که شامل مقادیر HEX,RGB,COLOR NAME میباشد.

Code:
<..!DOCTYPE html>
<..html>
<..head>
<..style>
body {color:red;}
h1 {color:#00ff00;}
p.ex {color:rgb(0,0,255);}
<../style>
<../head>
<..body>
<..h1>This is heading 1<../h1>
<..p>This is an ordinary paragraph. Notice that this text is red. The default text-color for a page is defined in the body selector.<../p>
<..p class="ex">This is a paragraph with class="ex". This text is blue.<../p>
<../body>
<../html>


Text Alignment :
از این ویژگی برای تعیین تراز افقی متن استفاده میشود.متن میتواند در وسط یا چپ و راست صفحه تراز شود.برای تراز کردن کل متن در همه سطور از justify استفاده میشود.

Code:
<..!DOCTYPE html>
<..html>
<..head>
<..style>
h1 {text-align:center;}
p.date {text-align:right;}
p.main {text-align:justify;}
<../style>
<../head>

<..body>
<..h1>CSS text-align Example<../h1>
<..p class="date">Feb, 2013<../p>
<..p class="main">In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. 'Whenever you feel like criticizing anyone,' he told me,
'just remember that all the people in this world haven't had the advantages that you've had.'<../p>
<..p><..b>Note:<../b> Resize the browser window to see how the value "justify" works.<../p>
<../body>

<../html>