(نسخه قابل پرینت موضوع)
عنوان موضوع : :: آموزش CSS، جلسه ششم:: (تنظیمات متن)
نمایش موضوع اصلی :

سپیده 313 چهارشنبه ۲ بهمن ۱۳۹۲ ۰۷:۱۷ بعد از ظهر


 آموزش CSS، جلسه ششم 


 Text color (رنگ متن)
مشخصه color برای تنظیم رنگ متن بکار می رود.


<html>
<head>
<style>
body {color:purple;}
h1 { color:#009900;}
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 purple. 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-align استفاده نمایید و آن را به صورت وسط چین(center) ، راست چین(right) ، چپ چین (left) که البته بطور پیش فرض این مقدار درنظر گرفته شده و یا justify تنظیم نمایید.
 
 
<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">May, 2009</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>


 



Text transform
مشخصۀ text-transform برای تعیین بزرگی و کوچکی حروف بکار می رود.

Uppercase  : تمامی حروف، بزرگ نمایش داده می شوند.
Lowercase: تمامی حروف، کوچک نمایش داده می شوند.
Capitalize: حرف اول هرکلمه بزرگ و مابقی کوچک نمایش داده می شوند.


<html>
<head>
<style>
p.uppercase {text-transform:uppercase;}
p.lowercase {text-transform:lowercase;}
p.capitalize {text-transform:capitalize;}
</style>
</head>
 
<body>
<p class="uppercase">This is some text.</p>
<p class="lowercase">This is some text.</p>
<p class="capitalize">This is some text.</p>
</body>
</html>

 

Powered by FAchat