css for stater

111
CSS for starter Intro CSS ဆိုတာကေတာ့ Web Essential ပိုင္းမွာ မသိမျဖစ္ လိုအပ္ပါတယ္။ Web ပိုင္းမွာ HTML တစ္ခုတည္းတတ္ေနရံုန႕ မရပါဘူး။ HTML က သင့site တစ္ခုလံုးကိလွသြားေအာင္ ဆာက္ရြက္ေပးႏိုင္မွာမဟုတ္ဘူး။ CSS ကိHTML တတ္ျပီးတ့သူတိုင္း အလြယ္တကူ လ့လာႏုိင္ပါတယ္။ ကၽြန္ေတာ္တုိ႕ေတြ Internet website တြမွာ မင္ေနရတ့ site တြ အားလံုးဟာ CSS ကိအသံုးျပထားပါတယ္။ HTML န႕ တည္ေဆာက္ျပီး လွပေအာင္ တန္ဆာဆင္ဖို႕ CSS ကိလ့လာထားဖို႕လိုအပ္ပါတယ္။ ကၽြန္ေတာ့္အေနန႕လည္း ဘယ္လိုေရးရလဆိုတ့ အေျခခံန႕ ဘာေတြ ရိွတယ္။ ဘာေတြ သံုးလို႕ရလဆိုေတာ့ ကိုပ ရွင္းျပေပးႏိုင္ပါတယ္။ CSS ဟာကယ္ျပန္႕ျပီးေတာ့ ကိုယ့အေတြးအေခၚ ကိုယ့design ပၚမွာ မူတည္ျပီး site ရ႕ design ကလည္း ပာင္းလသြားတာပါ။ အခု စာအုပ္က w3school ကိအေျခခံျပီး ရးသားထားပါတယ္။ စတင္ေလ့လာမယ့္သူေတြ အတြက္ အသံုးဝင္မယ့စာအုပ္ တစ္အုပ္ ဖစ္မယ္လို႕လည္း မွာ္လင့္ပါတယ္ဗာ။ CSS for starter , written by saturngod ( www.saturngod.net ) 1

Upload: saturngod

Post on 24-Mar-2015

775 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: CSS for Stater

CSS for starterIntroCSS ဆတာကေတာ Web Essential ပငးမာ မသမျဖစ လအပပါတယ။ Web ပငးမာ HTML တစခတညးတတေနရန႕ မရပါဘး။ HTML က သင site တစခလးက လသြားေအာင ေဆာကရြကေပးႏငမာမဟတဘး။ CSS က HTML တတျပးတသတငး အလြယတက ေလလာႏငပါတယ။ ကၽြနေတာတ႕ေတြ Internet website ေတြမာ ျမငေနရတ site ေတြ အားလးဟာ CSS က အသးျပထားပါတယ။ HTML န႕ တညေဆာကျပး လပေအာင တနဆာဆငဖ႕ CSS က ေလလာထားဖ႕လအပပါတယ။

ကၽြနေတာအေနန႕လညး ဘယလေရးရလဆတ အေျခခန႕ ဘာေတြ ရတယ။ ဘာေတြ သးလ႕ရလဆေတာ ကပ ရငးျပေပးႏငပါတယ။ CSS ဟာကယျပန႕ျပးေတာ ကယ အေတြးအေခၚ ကယ design ေပၚမာ မတညျပး site ရ႕ design ကလညး ေျပာငးလသြားတာပါ။ အခ စာအပက w3school က အေျခချပး ေရးသားထားပါတယ။ စတငေလလာမယသေတြ အတြက အသးဝငမယ စာအပ တစအပ ျဖစမယလ႕လညး ေမာလငပါတယဗာ။

CSS for starter , written by saturngod ( www.saturngod.net )

1

Page 2: CSS for Stater

Chapter 1: CSS Basic CSS Syntax (CSS = Cascading Style Sheet )CSS က ေရးသားပက HTML န႕ မတေတာ ပ ေရးသားပေတြ ကြာျခားသြားပါတယ။ css code ေလးက ၾကညရေအာင။

Selector ကေတာ ကယ ဘာဟာက CSS အသးျပမလဆတာက ေျပာတာပါ။ အခ h1 ဆတ tag က select လပထားလကတာပါ။ Declaration က တစခထက ပထညႏငပါတယ။ တစခ ဆးတငး ; ေလး ထညေပးရပါတယ။ Property န႕Value ရပါတယ။ ကၽြနေတာတ႕ HTML မာတနးက attribute န႕ value ထညသလေပါ။ property န႕ value က : ေလး ချပး ထညပါတယ။

color:blue; font-size:12px;

ဆတ သေဘာက စာလးအေျပာေရာင စာလးအရြယ 12 px လ႕ဆလကတာပါ။

ဥပမာ။ ေအာကက code ေလးက notepad မာ ေရးျပး စမးၾကညလကပါ။

<html>

<head>

<title>CSS</title>

<style type="text/css">

p { color: red;}

</style>

</head>

<p>Hi! I am red.</p>

CSS for starter , written by saturngod ( www.saturngod.net )

2

Page 3: CSS for Stater

</html>

အဒါေလးက save သမးျပး firefox န႕ ဖြငလကရင ေအာကကပလ ျမငရပါလမမယ။

CSS ေရးမယဆရင <style> န႕ စျပး </style> န႕ ဆးတ ၾကားထမာ ေရးရပါတယ။ အမားအားျဖငေတာ <head> န႕ </head> ၾကားထမာ ေရးရပါတယ။

Comment

HTML မာတနးကလညး comment လပပေျပာခပါတယ။ HTML comment ဆရင <!-- comment --> န႕ေရးခတာ မတမအးမယထငပါတယ။ CSS မာလညး comment ေရးလ႕ရပါတယ။ သကေတာ ဒလေရးပါတယ။

/* This is comment */

/* န႕ စျပး */ ဆး ပါတယ။ ၾကားထမာ comment ေရးရတာပါ။

Selectorအေပၚမာ ကၽြနေတာ ေျပာခဘးပါတယ။ Selector အေၾကာငးပါ။ Select မာ HTML element ေတြ ျဖစတ p , h3 စတာေတြ သးလ႕ရသလ id န႕class ကလညး သးလ႕ရပါတယ။ HTML attribute မာ id န႕class ဆတာ ရပါတယ။

ID Selector

ကၽြနေတာတ႕ html attribute id ဆတာက ထညျပး အဒါက css မာ တြသးႏငပါတယ။ ဥပမာက ေအာကက code က ေလလာၾကညလကပါ။

<html>

<head>

<title>CSS</title>

CSS for starter , written by saturngod ( www.saturngod.net )

3

Page 4: CSS for Stater

<style type="text/css">

#red_id { color: red;}

</style>

</head>

<p id="red_id">Hi! I am red id.</p>

<p >Hi! I am normal.</p>

</html>

အဒါေလးက browser န႕ဖြင လကရင ေအာကကလ ျမငရပါမယ။

id မာ red_id ဆျပးေရးထားပါတယ။ အဒါက ျပနေခၚဖ႕ CSS မာ #red_id န႕ျပနေခၚထားတာက ေတြ႕မာပါ။ အရငတနးကေတာ p ဆတ html tag က ေခၚခေပမယ အခ တစခထက သးသန႕ေခၚခငေတာ id ေပးျပး ေခၚလကတာပါ။

Class Selector

id လပ HTML attribute တစချဖစတ class ဆတာက သးႏငပါတယ။ id ကေတာ အမားအားျဖင တစခတညးက နာမညသေဘာမး identify သေဘာမးန႕ေပးတတၾကျပး class ကေတာ အမားက ကယစားျပတအေနန႕ေပးပါတယ။ class ကလညး id လမးပ အသးျပႏငပါတယ။ ေအာကက code ေလးက ၾကညလကပါ။

<html>

<head>

<title>CSS</title>

<style type="text/css">

.red_class { color: red;}

</style>

</head>

<p class="red_class">Hi! I am red class.</p>

<p> Hi! I am normal.</p>

CSS for starter , written by saturngod ( www.saturngod.net )

4

Page 5: CSS for Stater

<p class="red_class">Hi! I am red class.</p>

</html>

အဒါဆရင Hi! I am red class ဆတ စာလးေတြက နေနတာက ေတြ႕မာပါ။ ဒါေလးကေတာ ကယတင စမးၾကညႏငပါတယ။ ပေလးေတာ မျပေတာဘး။ အတတပမ႕ပါ။ class က dot(.) ေရ႕မာ ထားျပး ေရးပါတယ။ class က ေနာကတစမးေရးလ႕ရပါတယ။ ဥပမာ p tag မာ သးထားတ class ဆရင

p.red_class { color: red;}

ဆျပး ေရးလ႕ရပါတယ။ h3 မာ သးထားရင

h3.red_class { color: red;}

ဆျပးေရးလကရပါပ။ ေအာကက code ေလးက ၾကညလကပါ။

<html>

<head>

<title>CSS</title>

<style type="text/css">

h3.red_class { color: red;}

</style>

</head>

<h3 class="red_class">Hi I am H3</h3>

<p class="red_class">Hi! I am red id.</p>

<p> Hi! I am normal.</p>

<p class="red_class">Hi! I am red id.</p>

</html>

အဒါက ဒလေလး ထြကလာမာပါ။

CSS for starter , written by saturngod ( www.saturngod.net )

5

Page 6: CSS for Stater

p မာ red_class လ႕ထညထားေပမယ css မာ h3.red_class လ႕ေရးထားပါတယ။ red_class လ႕ ေၾကျငာထားတ h3 ကပ select လပမယလ႕ ဆလတာပါ။

How to add CSS ?အေပၚမာတနးက ကၽြနေတာ ေျပာခပါတယ။ CSS ဘယလ ထညသြငးရမယဆတာကေပါ။ <head> န႕ </head> ၾကားမာ style tag န႕ ထညတယလ႕။ အဒါအျပင အျခား ၂ နညးရပါေသးတယ။ စစေပါငး ၃ မးထညသြငးလ႕ရပါတယ။

1. Internal Style Sheet2. Inline Stye Sheet3. External Style Sheet

Internal Style Sheet

ကၽြနေတာတ႕ internal Style Sheet အေၾကာငးေျပာချပးပါျပ။ အေပၚမာ သးခတာေတြ အားလးက Internal style sheet သေဘာတရားေတြပါ။

Inline Style Sheet

ကၽြနေတာတ႕ေတြအေနန႕ တစခါတစေလမာ style sheet တစခတညးက html tag ထတြသးခငတအခါမာ သးလ႕ရေအာငပါ။သ႕က ဒလေရးပါတယ။

<p style="color:red"> Hi! I am red.</p>

CSS for starter , written by saturngod ( www.saturngod.net )

6

Page 7: CSS for Stater

အဒါဆရင Hi! I am red က အနေရာငေလး ျဖစသြားတာက ေတြ႕မာပါ။ ကၽြနေတာတ႕ေတြအေနန႕ အခ႕အခါေတြမာ class တ႕ id တ႕ မေၾကျငာပ ေရးခငတအခါေတြ မာ အသးျပႏငပါတယ။

External Style Sheet

Internal Style Sheet က page တစခတညးအတြက အဆငေျပေပမယ page ေတြက တစခထကမက သးမယ။ ဒ style ပ သးမယဆရင Internal Style Sheet က အဆငမေျပေတာပါဘး။ HTML အသစ တစခေဆာကတငး copy paste လကလပရမယ။ တစေနရာမာ ေျပာငးလကတငး HTML files အားလးမာ လကေျပာငးရမယ။ အလ အခါ အဆငမေျပေတာဘး။ ဒါေၾကာင HTML files ေတြ တစခထက မက သးမယဆရင External Style Sheet ကသးႏငပါတယ။ External Style Sheet က ေခၚမယဆရင ေအာကကလ ေခၚသးပါတယ။

<head>

<link rel="stylesheet" type="text/css" href="external.css">

</head>

external.css ကေတာ သးသန႕ file ပါ။ file path ေတြကေတာ HTML တနးက ေျပာချပးပါျပ။ image path ေတြ ေခၚတေနရာမာတနးက ရငးျပခပါတယ။ external.css ကလညး အလ ေခၚတာပါပ။

external.css ထမာေတာ ဒလေရးထားပါတယ။

.red_class { color: red;}

တစျခား ဘာမ မပါပ css ေတြ ခေရးထားရပါပ။ တျခား html tag ေတြ ထညစရာလညး မလပါဘး။

အခ အေျခခအခကေတြနားလညျပဆရငေတာ CSS styling အေၾကာငးေတြ စျပးေလလာလ႕ရပါျပ။ property က color တစခတညး မဟတပန႕ အျခား property အေၾကာငးေတြက ေနာက chapter မာ စပါမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

7

Page 8: CSS for Stater

Chapter 2: CSS StylingCSS မာ property က အမားၾကးရပါတယ။ အရင chapter တနးကေတာ color property န႕ပ ဥပမာ ျပသြားပါတယ။

CSS BackgroundBackground က မေျပာခင background န႕ လပထားတ CSS ေလးက ျပပါတယ။

အဒါက CSS background image န႕ CSS backround color က သးထားတာပါ။ သာမာန HTML န႕ အလမး ဖနတးလ႕ မရပါဘး။

Background Color

Background color က ေနာကခ အေရာငပါ။ ေအာကက code ေလးက စမးၾကညလကရေအာင။

<html>

<head>

<title>Back ground</title>

<style type="text/css">

body {background-color:#b0c4de;}

</style>

</head>

<body>

CSS for starter , written by saturngod ( www.saturngod.net )

8

Page 9: CSS for Stater

</body>

</html>

အဒါေလးက run လကရင ခရမးေရာင background က ျမငရမာပါ။

Color ေတြကေတာ ေအာကကပစေတြန႕ သးလ႕ရပါတယ။1. name :: color နာမညန႕ ေခၚယသးစြျခငး။ ဥပမာ ။။ red, blue2. RGB :: RGB value အေနန႕ ေခၚယသးစြျခငး။ ဥပမာ ။။ rgb(255,0,0)3. Hex :: hex value အေနန႕ အသးျပျခငး။ ဥပမာ ။။ #FF00004. RGBA :: RGB န႕ အတတပါပ။ သ႕ေပမယ ေနာကမာ Alpha channel value ပါလာပါတယ။ ဥပမာ ။။ rgba(255,0,0,0.5)

Color ကေတာ အေသးစတမေျပာေတာပါဘး။ ကၽြနေတာ HTML မာတနးက ေသခာေျပာချပးပါျပ။ ေအာကက example ေလးက စမးၾကညရေအာင။

<html>

<head>

<title>Back ground</title>

<style type="text/css">

h1 {background-color:#6495ed;}

p {background-color:#e0ffff;}

div {background-color:#b0c4de;}

</style>

</head>

<body>

<h1>Header</h1>

<div>

This is DIV Layer using background-color.

<br/>

<p>This is paragraph using background-color.</p>

</div>

</body>

</html>

အဒါေလးက ဒလေလး ျမငရမာပါ။

CSS for starter , written by saturngod ( www.saturngod.net )

9

Page 10: CSS for Stater

ဒေလာကဆရငေတာ background-color က သေဘာေပါကေလာကပါျပ။

Background Image

Background Image ကေတာ ပေတြ မာ background ထညတာေပါ။

ဒပေလးကေတာ paper.gif ပါ။

<html>

<head>

<style type="text/css">

body {background-image:url('paper.gif');}

</style>

</head>

<body>

<h1>Hello World!</h1>

</body>

</html>

အဒ code ေလးက browser မာ ဖြငလကရင ဒလျမငရပါလမမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

10

Page 11: CSS for Stater

background တစခလး paper.gif ေတြ ျပညသြားတာက ျမငရမာပါ။ ပတစပတညးက tile လပသြားတာပါ။ တနညးေျပာရင pattern လမး တစကြကျပး တစကြက အျပညျဖညသြားတာေပါ။ ဒါေၾကာင wallpaper ေတြက background ထညလကရင Title ျဖစသြားျပး ၾကညမေကာငးျဖစတတတယ။

Background Image - Repeat Horizontally or Vertically

ကၽြနေတာတ႕ေတြ background image က repeat horinonal ပလပခငတယ။ ဒါမမဟတ vertical ပလပခငတယဆရငလညး လပလ႕ရပါတယ။

အလ gradient လပထားတ ပက background image န႕သးလကရင ေအာကကလ ျဖစသြားပါလမမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

11

Page 12: CSS for Stater

သက horizontal fill သြးာတာ ျပနာ မဟတေပမယ vertical ျဖညသြားေတာ ၾကညရ ဆးသြားပါတယ။ vertical မျဖညဘး။ horizontal ပ လပမယဆရင ဒလေရးရပါတယ။

<html>

<head>

<style type="text/css">

body

{

background-image:url('gradient2.png');

background-repeat:repeat-x;

}

</style>

</head>

<body>

<h1>Hello World!</h1>

</body>

CSS for starter , written by saturngod ( www.saturngod.net )

12

Page 13: CSS for Stater

</html>

အဒါေလးက run လကရင ဒလ ရပါလမမယ။

အဒါဆရင ၾကညလ႕ေကာငးသြားပါျပ။ repeat-x ဆတအတြကေၾကာင horizontal ပrepeat လပပါမယ။ တကယလ႕ repeat-y လ႕သာ ေရးခမယဆရငေတာ vertical ပ repeat လပမာပါ။ repeat-y ကေတာ ဥပမာ န႕ မျပေတာပါဘး။ ကယတငသာ စမးၾကညလကပါ။

Background Image : Set Position

အရငဆး ဒ code ေလးက run ၾကညလကပါ။

<html>

CSS for starter , written by saturngod ( www.saturngod.net )

13

Page 14: CSS for Stater

<head>

<style type="text/css">

body

{

background-image:url('img_tree.png');

background-repeat:no-repeat;

}

</style>

</head>

<body>

<h1>Hello World!</h1>

<p>W3Schools background image example.</p>

<p>The background image is only showing once, but it is disturbing

the reader!</p>

</body>

</html>

သျပးသားေနမာပါ။ image_tree.png ကေတာ မမ စကထမာ ရတ ပထက အဆငေျပတာေလးန႕ သးလကပါ။အဒါက ေအာကပါအတငး ျမငရမာပါ။

CSS for starter , written by saturngod ( www.saturngod.net )

14

Page 15: CSS for Stater

ပက background မာရေနပါတယ။ ဘယဘက ေထာငမာ ကပေနတာပါ။

ကၽြနေတာတ႕ ညာဘကေထာငက ပကပမယ။ ေနာကျပး စာကလညး ပက မဖးခငဘး။ ပရ႕ width က 200px ရတယ။ ဒါဆရင ဒလေရးလကပါတယ။

<style type="text/css">

body

{

background-image:url('img_tree.png');

background-repeat:no-repeat;

background-position:top right;

margin-right:200px;

}

</style>

</head>

CSS for starter , written by saturngod ( www.saturngod.net )

15

Page 16: CSS for Stater

အမာ margin-right:200px ဆတာက ညာဘက margin 200px ထ ဆြထားလကတာပါ။ margin ပငး ေနာကပငးမာ ေျပာျပပါမယ။ background-position:top right; က ၾကညပါ။ top right ျဖစေနပါတယ။ top ကေတာ အေပၚဆးမာထားမယေပါ။ ကၽြနေတာတ႕ ညာဘက ကပခငေတာ right လ႕ေရးလကပါတယ။

Background - Shorthand propertyကၽြနေတာတ႕ တစချခငးဆ လကမေရးျခငဘး။ တစေၾကာငးတညးန႕ မျပးဘးလား။ ကၽြနေတာတ႕ေတြ တစေၾကာငးတညးန႕ background css က ေရးလ႕ရပါတယ။ ဥပမာ။။

body {background:#ffffff url('img_tree.png') no-repeat top right;}

လ႕ေရးထားတာ အေပၚက code န႕ အတတပါပ။ background ဆတ property မာ ေအာကက property ေတြေပါငးျပး ေရးလ႕ရပါတယ။

• background-color• background-image• background-repeat• background-attachment

CSS for starter , written by saturngod ( www.saturngod.net )

16

Page 17: CSS for Stater

• background-position

Background - background attchmentကၽြနေတာ background-attchment အေၾကာငး မေျပာခရေသးပါဘး။ background attachment မလပခင ေအာကက code ေလးက စမးၾကညပါအး။

<html>

<head>

<style type="text/css">

body

{

background-image:url('smiley.gif');

background-repeat:no-repeat;

}

</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>

CSS for starter , written by saturngod ( www.saturngod.net )

17

Page 18: CSS for Stater

အမာ ကၽြနေတာတ႕စာက ဆြခလကရင background image ေလး ေပာကသြားပါလမမယ။ background image မေပာကခငဘး။ fixed ျဖစေနေစခငတယဆရင ေအာကကလ ေျပာငးေရးလကပါ။

<style type="text/css">

body

{

background-image:url('smiley.gif');

background-repeat:no-repeat;

background-attachment:fixed;

}

</style>

ဒ code ေလးကေတာ ကယတင စမးၾကညလကပါ။

All CSS background properties

Property Description Values

background background အားလးအတြက သးႏငသည။

background-colorbackground-imagebackground-repeatbackground-attachmentbackground-positioninherit

background-attachment

background image fix လပမလား scrolls လပမလား အတြက

scrollfixedinherit

background-color background color ထညသြငးရန

color-rgbcolor-hexcolor-nametransparentinherit

background-image image background တြင ထညသြငးရန

url(URL)noneinherit

CSS for starter , written by saturngod ( www.saturngod.net )

18

Page 19: CSS for Stater

Property Description Values

background-position background image position က ခနညရန

left topleft centerleft bottomright topright centerright bottomcenter topcenter centercenter bottomx% y%xpos yposinherit

background-repeat image မားက repeat ဘယလ လပမညအတြက။

repeatrepeat-xrepeat-yno-repeatinherit

CSS for starter , written by saturngod ( www.saturngod.net )

19

Page 20: CSS for Stater

CSS Text FormattingText formatting ဆတာကေတာ စာလးေတြက အေရာငထညတာေတြ ေနာကျပး font ေတြေျပာငးတာ alignment လပတာ စတာေတြက css က ေဆာငရြကလ႕ရပါတယ။

Text Color

text color ကေတာ CSS မာ color လ႕သးပါတယ။ ေအာကမာ ဥပမာ ၾကညပါ။

body { color:#FF0000; }

လ႕ဆရင body စာလးေတြက အနေရာငန႕ ျပေပးမာပါ။

Text alignment

text alignment ကေတာ left, right , center,justify ဆျပး သတမတေပးတာပါ။ ကၽြနေတာတ႕ html မာက align န႕ လပခတာ မတမအးမယထငပါတယ။ CSS မာကေတာ

p { text-align: center; }

h1 { text-align: right; }

h2 { text-align : justify }

left ကေတာ default ပါ။ ဒါေလးေတြက လြယေသးေတာ ကယဘာသာ ကယစမးၾကညလကပါ။

Text Transformation

ကၽြနေတာတ႕ေတြ HTML မာ upper case ေတြ lower case ေတြေျပာငးခငရင စာေတြ ျပနျပငရကရပါတယ။ CSS သးရင အလ ျပနျပငရကတ ျပနာ ရငးသြားပါတယ။ ေအာကက example ေလး က ၾကညၾကညပါ။

<html>

<head>

<title>Sample</title>

<style type="text/css">

CSS for starter , written by saturngod ( www.saturngod.net )

20

Page 21: CSS for Stater

p.uppercase {text-transform:uppercase;}

p.lowercase {text-transform:lowercase;}

p.capitalize {text-transform:capitalize;}

</style>

<body>

<p class="uppercase">uppder case</p>

<p class="lowercase">LOWER CASE</p>

<p class="capitalize">capitalize</p>

</body>

</head>

</html>

အဒါေလး က run လကရင ေအာကကလ ျမငရပါလမမယ။

Text Indentation

စာလးေတြကေရႊ႕ခငတယဆရင indentation က သးလ႕ရပါတယ။ ေအာကက ဥပမာေလး ကၾကညၾကညပါ။

<html>

<head>

<title>Sample</title>

<style type="text/css">

p {text-indent:50px;}

</style>

<body>

<p>

Testing Testing Testing Testing Testing Testing Testing Testing

Testing Testing Testing Testing Testing Testing Testing Testing

CSS for starter , written by saturngod ( www.saturngod.net )

21

Page 22: CSS for Stater

Testing Testing Testing Testing Testing Testing Testing Testing

Testing Testing Testing Testing

</p>

</body>

</head>

</html>

အဒါေလး က run လကရင ေအာကကလ ျမငရပါလမမယ။

Space between characters

Characters တစခန႕ တစခၾကား space ေတြက ျခားခငရငေတာ letter-spacing ဆတာက သးလ႕ရပါတယ။

<html>

<head>

<style type="text/css">

h1 {letter-spacing:2px;}

h2 {letter-spacing:-3px;}

</style>

</head>

<body>

<h1>This is heading 1</h1>

<h2>This is heading 2</h2>

</body>

</html>

အဒါက ေအာကကလ ေပၚပါလမမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

22

Page 23: CSS for Stater

Space Between Lines

Characters တစခန႕ တစခၾကား space အကြာအေဝး ခနညလ႕ရသလ line တစခန႕ တစခၾကားလညး line-height န႕ ခနညလ႕ရပါတယ။ ေအာကက example ေလးက ေလလာၾကညပါ။

<html>

<head>

<style type="text/css">

p.small {line-height:90%;}

p.big {line-height:200%;}

</style>

</head>

<body>

<p>

This is a paragraph with a standard line-height.

The default line height in most browsers is about 110% to 120%.

This is a paragraph with a standard line-height.

</p>

<p class="small">

This is a paragraph with a smaller line-height.

This is a paragraph with a smaller line-height.

This is a paragraph with a smaller line-height.

</p>

<p class="big">

This is a paragraph with a bigger line-height.

This is a paragraph with a bigger line-height.

CSS for starter , written by saturngod ( www.saturngod.net )

23

Page 24: CSS for Stater

This is a paragraph with a bigger line-height.

</p>

</body>

</html>

အဒါကေတာ ေအာကကလ ေတြ႕ရပါလမမယ။

Right To Left Text

ဒါကေတာ ကၽြနေတာတ႕ေတြ သးခတယ။ left to right ေရးရတ ဘာသာစကားေတြအတြက သးတာပါ။ ဥပမာ ေတာ မျပေတာဘး။ ဘယလေပၚလ သခငရင စမးၾကညႏငပါတယ။

p{direction:rtl;}

Word Spacing

Character spacing , line spacing ေတြျပးေတာ word spacing ေပါ။<html>

<head>

<style type="text/css">

p

{

word-spacing:30px;

}

</style>

</head>

CSS for starter , written by saturngod ( www.saturngod.net )

24

Page 25: CSS for Stater

<body>

<p>

This is some text. This is some text.

</p>

</body>

</html>

word-spacing သးလကရင ေအာကကလ ျမငရပါလမမယ။

Nowrap

စာလးေတြက wrap မျဖစခငဘး။ စာလးက တစတနးျပညသြားေပမယ ေအာကတစလငး မဆငးသြား ေစခငဘးဆရင white-space က nowrap ေပးရပါတယ။

p

{

white-space:nowrap;

}

ကယဘာသာ ကယစမးၾကညလကေပါ။

Vertical Align

image ေတြမာ ကၽြနေတာတ႕ေတြ HTML တနးက align ေတြလကထညရတယ။ text align ညတာေပါ။ အလမးပ CSS မာလညး သးလ႕ရပါတယ။

<html>

<head>

<style type="text/css">

img.top {vertical-align:text-top;}

img.bottom {vertical-align:text-bottom;}

CSS for starter , written by saturngod ( www.saturngod.net )

25

Page 26: CSS for Stater

</style>

</head>

<body>

<p>An <img src="w3schools_logo.gif" alt="W3Schools" width="270"

height="50" /> image with a default alignment.</p>

<p>An <img class="top" src="w3schools_logo.gif" alt="W3Schools"

width="270" height="50" /> image with a text-top alignment.</p>

<p>An <img class="bottom" src="w3schools_logo.gif" alt="W3Schools"

width="270" height="50" /> image with a text-bottom alignment.</p>

</body>

</html>

ဒလေလးေပၚလမမယ။

Text-shadow

စာလးေတြေနာကမာ shadow ထညခငတအခါမာေတာ text-shadow က သးႏငပါတယ။

<html>

<head>

<style>

p.test {

text-shadow: #6374AB 20px 25px 2px;

}

CSS for starter , written by saturngod ( www.saturngod.net )

26

Page 27: CSS for Stater

</style>

</head>

<body>

<p class="test">This is txt shadow</p>

</body>

</html>

text-shadow: #အေရာင , X , Y, bluer ဆျပး ထညေပးရတာပါ။ အေပၚက code ေလးက run လကရင ေအာကကလ ေပၚပါလမမယ။

CSS Text Properties

Property Description Values

color text color color

direction text direction ltrrtl

line-height line တစခန႕ တစခၾကား အျမင normalnumberlength%

letter-spacing characters တစခန႕ တစခၾကား အကြာအေဝး normallength

text-align text align ညျခငး leftrightcenterjustify

CSS for starter , written by saturngod ( www.saturngod.net )

27

Page 28: CSS for Stater

Property Description Values

text-decoration add decoration to text noneunderlineoverlineline-throughblink

text-indent indent ေရႊ႕ျခငး length%

text-shadow အရပထညျခငး nonecolorlength

text-transform uppercase , lowercase ေျပာငးျခငး nonecapitalizeuppercaselowercase

vertical-align vertical align baselinesubsupertoptext-topmiddlebottomtext-btoomlength%

white-space wrap text လပမလပ normalprenowrap

word-spacing word တစခန႕တစခၾကား spacing normallength

CSS for starter , written by saturngod ( www.saturngod.net )

28

Page 29: CSS for Stater

FontsHTML မာတနးက ကၽြနေတာတ႕ေတြ font tag န႕ စာလးေတြက ေျပာငးခတာ မတမအးမယထငပါတယ။ CSS မာလညး font ေတြက ေျပာငးလလ႕ရပါတယ။ font tag သးမယဆရင ေနရာ အမားၾကးမာ font tag ေတြ လကထညေနရလမမယ။ ဒေတာ CSS class ေလး သးျပး လြယလြယကက ဖနတးႏငပါတယ။

Font Family

ေအာကက code ေလးက ေရးၾကညျပး စမးၾကညလကပါ။

<html>

<head>

<title>Font family</title>

<style type="text/css">

.time

{

font-family: "Times New Roman", Times, serif;

}

.arial

{

font-family: Arial,Verdana;

}

</style>

</head>

<body>

<p class="time">This is time class</p>

<p class="arial">This is arial class</p>

</body>

</html>

အဒါက browser မာ ဖြငလကရင ေအာကကလ ျမငရမယ။ စာလး font မတတာက ေတြ႕ရမာပါ။ ကယ အသးျပခငတ font က font-family ထမာ ေရးရပ။ font list က , န႕ေရးရတယ။ ေရ႕ဆး font မရရင ဒတယ font က အသးျပပါတယ။

CSS for starter , written by saturngod ( www.saturngod.net )

29

Page 30: CSS for Stater

Font Style

စာလးေတြက italic လပခငတ အခါမာေတာ font style က အသးျပရပါတယ။<html>

<head>

<style type="text/css">

p.normal {font-style:normal;}

p.italic {font-style:italic;}

p.oblique {font-style:oblique;}

</style>

</head>

<body>

<p class="normal">This is a paragraph, normal.</p>

<p class="italic">This is a paragraph, italic.</p>

<p class="oblique">This is a paragraph, oblique.</p>

</body>

</html>

အဒ code ေလးက browser မာ ၾကညရင ေအာကကလ ျမငရမာပါ။

Font Size

CSS for starter , written by saturngod ( www.saturngod.net )

30

Page 31: CSS for Stater

html မာ font size ေတြက font tag န႕ ျပငရပါတယ။ CSS မာေတာ လြယလြယကကေလး ျပငလ႕ရတယ။ ေအာကက code ေလးက ၾကညလကပါ။

<html>

<head>

<style type="text/css">

h1 {font-size:40px;}

h2 {font-size:30px;}

p {font-size:14px;}

</style>

</head>

<body>

<h1>This is heading 1</h1>

<h2>This is heading 2</h2>

<p>This is a paragraph.</p>

<p>Specifying the font-size in px allows Firefox, Chrome, and

Safari to resize the text, but not Internet Explorer.</p>

</body>

</html>

အဒါေလးက run လကရင ေအာကကလ ျမငရပါလမမယ။

Font size with em

CSS for starter , written by saturngod ( www.saturngod.net )

31

Page 32: CSS for Stater

Internet Explorer မာ တစခါတစေလ font size ေပၚတ ပျခငးမတတတဘး။ W3C ကေတာ px အစား em က သးဖ႕ recommend လပထားပါတယ။

h1 {font-size:2.5em;} /* 40px/16=2.5em */

h2 {font-size:1.875em;} /* 30px/16=1.875em */

p {font-size:0.875em;} /* 14px/16=0.875em */

16px em က 1 em န႕ ညပါတယ။

Font Bold

font ေတြက bold လပခငတ အခါမာ b tag ထညေပးရပါတယ။ တစခါတညး CSS မာလညး bold လပမယလ႕ ေျပာလ႕ရပါတယ။

ေအာကက code ေလးက တခကၾကညလကပါ။

<html>

<head>

<style type="text/css">

p.normal {font-weight:normal;}

p.light {font-weight:lighter;}

p.thick {font-weight:bold;}

p.thicker {font-weight:900;}

</style>

</head>

<body>

<p class="normal">This is a paragraph.</p>

<p class="light">This is a paragraph.</p>

<p class="thick">This is a paragraph.</p>

<p class="thicker">This is a paragraph.</p>

</body>

</html>

အဒ code ေလးက run ၾကညလကရင ဒလ ေလးျမငရပါလမမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

32

Page 33: CSS for Stater

သပျပး ထးထးျခားျခား ေျပာငးလသြားတာက ေတြ႕ရမာ မဟတပါဘး။ အဓက bold ျဖစမျဖစ ပ ကြာျခားမႈ ရပါတယ။

Font Variant

font variant ကေတာ font ပစေျပာငးတာေပါ။ အကနလးက စာလးအၾကးေတြပ။ ဒါေပမယ ေရ႕ဆးအလးက font အၾကးလပခငတအခါေတြမာ သးလ႕ရပါတယ။ ရငးသြားေအာင ေအာကက example ေလးက ၾကညလကပါ။

<html>

<head>

<style type="text/css">

p.normal {font-variant:normal;}

p.small {font-variant:small-caps;}

</style>

</head>

<body>

<p class="normal">My name is Hege Refsnes.</p>

<p class="small">My name is Hege Refsnes.</p>

</body>

</html>

CSS for starter , written by saturngod ( www.saturngod.net )

33

Page 34: CSS for Stater

Font Properties

Property Description Values

font font properties အားလး က အသးျပရန

font-stylefont-variantfont-weightfont-sizefont-family

font-family font နာမည font-name

font-size font အရြယအစား xx-smallx-smallsmallmediumlargex-largexx-largesmallerlarger%lengthinherit

font-style font style normalitalicobliqueinherit

font-variant small caps text ပ normalsmall-cpasinherit

CSS for starter , written by saturngod ( www.saturngod.net )

34

Page 35: CSS for Stater

Property Description Values

font-weight font bold ပစ normalboldbolderlighter100200..900

CSS for starter , written by saturngod ( www.saturngod.net )

35

Page 36: CSS for Stater

Style LinkLink ေတြကလညး css က အသးျပလ႕ရပါတယ။ ဘယလမးေတြလဆေတာ စာလး အေရာင ၊ font ၊ background စတာေတြက ထညသြငးလ႕ရတာေပါ။

link အတြက selector ၄ ခ ကသဖ႕ လပါတယ။

1. a:link - ပမန အေျခအေန2. a:visited - visited လပျပးသား link3. a:hover - mouse တငလကတ အခန4. a:active - mouse click လကတ အခန

ေအာကက code ေလးက စမးၾကညလကပါ။

<html>

<head>

<style type="text/css">

a:link {color:#FF0000;} /* unvisited link */

a:visited {color:#00FF00;} /* visited link */

a:hover {color:#FF00FF;} /* mouse over link */

a:active {color:#0000FF;} /* selected link */

</style>

</head>

<head>

<a href="http://www.saturngod.net">Saturngod’s Blog</a>

</head>

</html>

မရငး အနကေန mouse တငလကတ အခါမာ စာအေရာငေျပာငးသြားတာေတြ႕ပါမယ။ click လပျပး mouse က ဖထားခနမာေတာ အျပာေရာင ေျပာငးသြားပါမယ။ Link က တစေခါကႏပျပးသြားရင သ႕မဟတ သြားထားဖးရငေတာ အစမးေရာင ျဖစေနပါလမမယ။

Common Link Style

CSS for starter , written by saturngod ( www.saturngod.net )

36

Page 37: CSS for Stater

link န႕ အဓက တြသးလ႕ရတ style ေလးေတြ ျပသြားပါမယ။ link ရ႕ selector ၄ ခက နားလညသြားရင css code ေတြက စတၾကကထညသြငးေရးသားႏငပါျပ။ စာသားအေရာင ေနာကခ အေရာင အျပင အေရာငမးမး လြယလငတက ေရးသားႏငပါတယ။

Text Decoration

link န႕ အဓက အသးမားတာကေတာ text-decoration ပါ။ သက ဘာလပေပးတာလဆေတာ link မာ underline ေဖာကခငတ အခါမာ အသးျပႏငပါတယ။

a:link {text-decoration:none;}

a:hover{text-decoration: underline}

link က ပမန underline ပါေပမယ text-decoration:none ဆရင underline ေပာကသြားပါတယ။ mouse တငလကတ အခါမာ ျပနေပၚခငတအတြကေၾကာင a:hover မာ text-decoration:underline ဆျပး သးလကပါတယ။

background color

ကၽြနေတာ ေထြေထြ ထးထး မေျပာေတာပါဘး။ background-color န႕ ပတသကျပးေတာ ကၽြနေတာ အေပၚမာ ေျပာထားချပးပါျပ။ link မာ css က code ေတြက လြယလငတက အသးျပႏငပါတယ။ အတတပါပ။ link မာ အဓက selector ၄ ခက အသးျပတယဆတာက မတမဖ႕ပလပါတယ။

<html>

<head>

<style type="text/css">

a:link {background-color:#B2FF99;}

a:visited {background-color:#FFFF85;}

a:hover {background-color:#FF704D;}

a:active {background-color:#FF704D;}

</style>

</head>

<head>

<a href="http://www.google.com">Google</a>

</head>

</html>

CSS for starter , written by saturngod ( www.saturngod.net )

37

Page 38: CSS for Stater

ListsList ဆတာကေတာ ul န႕ ol ပ ေပါ။ ul က အခေနာကပငး CSS ေတြမာ table အစား အသးျပလာတာ ေတြ႕ရပါတယ။ table အစား အသးျပတယဆတာက ရးရး html မာ မျဖစႏငသလပ။ ဒါေပမယ CSS န႕ ေပါငးျပး သးလကတ အခါမာေတာ Table လမး ဖနတးလာႏငပါတယ။

Different List Item Markers

<html>

<head>

<style type="text/css">

ul.a {list-style-type:circle;}

ul.b {list-style-type:square;}

ol.c {list-style-type:upper-roman;}

ol.d {list-style-type:lower-alpha;}

</style>

</head>

<body>

<p>Example of unordered lists:</p>

<ul class="a">

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ul>

<ul class="b">

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ul>

<p>Example of ordered lists:</p>

<ol class="c">

CSS for starter , written by saturngod ( www.saturngod.net )

38

Page 39: CSS for Stater

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ol>

<ol class="d">

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ol>

</body>

</html>

အဒါက run လကရင ေအာကကလ ျမငရပါမယ။

ပမန HTML မာလညး လြယလငတက ဖနတးႏငသလ css န႕လညး ဖနတးႏငပါတယ။ CSS ရ႕ အားသာခကေတြကေတာ ကၽြနေတာေျပာျပးပါျပ။ ဒါေၾကာင css က အသးျပျပး ေျပာငးလလ႕ရတာဟာ

CSS for starter , written by saturngod ( www.saturngod.net )

39

Page 40: CSS for Stater

list ေတြ အမားၾကးအတြက အဆငေျပလပါတယ။ အခမာေတာ list မာ ဘာေတြပါလဆတာေလာကပ ေရးပါအးမယ။ ေနာကပငးမာေတာ list န႕ menu တညေဆာကပေတြ ရငးျပသြားပါမယ။

value for Unordered list property

Value Description

none No marker

disc Default. စကဝငးအမညး

circle စကဝငး

square ေလးေထာငပ

Value for Ordered Lists

Value Description

armenian Traditional Amenian numbering

decimal number

decimal-leading-zero number padded by initial zeros (01,02,03,etc)

geogrian tradional Georgian numbering (an,ban,gan,etc)

lower-alpha lower-alpha (a,b,c,d,etc)

lower-greek lower-greek(alpha,beta,gamma,etc)

lower-latin lower-latin(a,b,c,d,etc)

lower-roman lower-roman(i,ii,iii,etc)

upper-alpha upper-alpha (A,B,C,etc)

upper-latin upper-latin(A,B,C,D,etc);

upper-roman upper-roman( I, II,III,etc)

CSS for starter , written by saturngod ( www.saturngod.net )

40

Page 41: CSS for Stater

Image List

တစခါတစေလ ကၽြနေတာတ႕ေတြ list ေတြက ကယပင image ေလးေတြန႕ ထညခငတယ။ A,B,C,D , I, II , III စတာေတြက မသးခငဘး။ အဒါဆရငေတာ HTML တခတညးန႕ မရေပမယ CSS န႕ ေပါငးျပး အလြယတက ဖနတးႏငပါတယ။

<html>

<head>

<style type="text/css">

ul

{

list-style-image:url('sqpurple.gif');

}

</style>

</head>

<body>

<ul>

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ul>

</body>

</html>

အဒါက browser မာ ၾကညလကရင ေအာကကလ ေတြ႕ပါလမမယ။ image ကေတာ ခပေသးေသးပေပါ။ 9 x 9 px ဆရင ရပါျပ။

IE , Opera တ႕မာ နညးနညးေလး image က ျမငေနပါလမမယ။ Chrome, Safari, Firefox တ႕ေလာက ၾကညမေကာငးပါဘး။ ဒါေလးက ဂရစကဖ႕ လပါလမမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

41

Page 42: CSS for Stater

Cross browser Solution

အကနလးမာ ေသခာေပၚဖ႕အတြကဆရငေတာ နညးနညး ပျပး ထပေရးရပါလမမယ။

<html>

<head>

<style type="text/css">

ul

{

list-style-type:none;

padding:0px;

margin:0px;

}

li

{

background-image:url(sqpurple.gif);

background-repeat:no-repeat;

background-position:0px 5px;

padding-left:14px;

}

</style>

</head>

<body>

<ul>

<li>Coffee</li>

<li>Tea</li>

<li>Coca Cola</li>

</ul>

</body>

</html>

ဒ code က နညးနညးမားသြားျပ။ ul က list-style-type က none လပျပး padding, margin က 0px ေပးျပး ညလကတယ။ ျပးမ li က background-image န႕ ပထညျပး position က ေရႊ႕လကတာေပါဗာ။

CSS for starter , written by saturngod ( www.saturngod.net )

42

Page 43: CSS for Stater

အဒနညးလမးက အရငကနညးလမးထက ေကာငးတာေတာ အမနပဗ။ browser အားလးမာ အဆငေျပေျပ ျမငရတာေပါ။

Shorthand property

တစခါတစေလ လငးတစေၾကာငးတညးန႕ ျပးသြားေစခငတ အခါမာ shorthand style သးျပး ေ၇းလကလ႕ရပါတယ။

ul

{

list-style:square url("sqpurple.gif");

}

ေရးတ အခါမာေတာ

• list-style-type• list-style-position• list-style-image

ဆျပး အစအစဥတငးေရးပါတယ။ ၃ ခလး တျပငတညး မဟတရငေတာင တစခတညးပ ျဖစျဖစ ၂ ခတြပ ျဖစျဖစ တြျပး ေရးႏငပါတယ။

CSS List Properties

Property Description Values

list-style property ေတ အကန တစေနရာတညးမာ ျဖညျခငး

list-style-typelist-style-positionlist-style-image

list-style-image list item မာ ပန႕ အသးျပ > ? @ AB URLnone

list-style-position list item ေပၚC D EA ေနရာ insideoutside

CSS for starter , written by saturngod ( www.saturngod.net )

43

Page 44: CSS for Stater

Property Description Values

list-style-type list item အမ GB H I J B nonedisccirclesquaredecimaldecimal-leading-zeroarmeniangeorgianlower-alphaupper-alphalower-greeklower-latinupper-latinlower-romanupper-roman

CSS for starter , written by saturngod ( www.saturngod.net )

44

Page 45: CSS for Stater

CSS TablesHTML table က CSS န႕တြျပး သးတ အခါမာ ေအာကကလမး table တစခ ဖနတးႏငပါတယ။

Tables Borders

အေပၚက ပမာ table က border color န႕ ေတြ႕ရမာပါ။

<html>

<head>

<style type="text/css">

table,th,td

{

border:1px solid black;

}

</style>

</head>

<body>

<table>

<tr>

<th>Firstname</th>

<th>Lastname</th>

</tr>

CSS for starter , written by saturngod ( www.saturngod.net )

45

Page 46: CSS for Stater

<tr>

<td>Peter</td>

<td>Griffin</td>

</tr>

<tr>

<td>Lois</td>

<td>Griffin</td>

</tr>

</table>

</body>

</html>

အဒ code ေလးက run ၾကညလကပါ။ ေအာကကလ ျမငရပါမယ။ CSS က border တစခပ ထညထားပါတယ။ border ကေတာ ေနာကပငးမာ ရငးျပပါမယ။ သးသန႕ ရငးျပမျဖစမာမ႕ပါ။

Collapse Borders

အေပၚမာ boder က ဟ ေနပါတယ။ တစကယလ႕ border တစခတညး ျဖစခငရငေတာ Collapse Borders ဆတာက သးရပါမယ။ code က တခကေလာက ၾကညလကပါ။

<html>

<head>

<style type="text/css">

table

{

border-collapse:collapse;

}

table, td, th

{

border:1px solid black;

}

CSS for starter , written by saturngod ( www.saturngod.net )

46

Page 47: CSS for Stater

</style>

</head>

<body>

<table>

<tr>

<th>Firstname</th>

<th>Lastname</th>

</tr>

<tr>

<td>Peter</td>

<td>Griffin</td>

</tr>

<tr>

<td>Lois</td>

<td>Griffin</td>

</tr>

</table>

<p><b>Note:</b> If a !DOCTYPE is not specified, the border-

collapse property can produce unexpected results.</p>

</body>

</html>

border-collapse:collapse;

ဆတာေလး ထညလကတ အခါမာေတာ border တစခတညး ျဖစသြားပါတယ။

Table န႕ ပတသကလ႕မားမား စားစားမရပါဘး။ ပမန CSS ေတြက ေခၚသးသြားတာ။ အဓကေတာ html tag ေတြက css န႕ တြသးလကတာပါ။ table, th, td စတ selector ေတြက ယသးျပး ပမန CSS ပ သးသြားတာပါ။

CSS for starter , written by saturngod ( www.saturngod.net )

47

Page 48: CSS for Stater

Table Width And Height

<html>

<head>

<style type="text/css">

table,td,th

{

border:1px solid black;

}

table

{

width:100%;

}

th

{

height:50px;

}

</style>

</head>

<body>

<table>

<tr>

<th>Firstname</th>

<th>Lastname</th>

<th>Savings</th>

</tr>

<tr>

<td>Peter</td>

<td>Griffin</td>

<td>$100</td>

</tr>

<tr>

<td>Lois</td>

<td>Griffin</td>

<td>$150</td>

CSS for starter , written by saturngod ( www.saturngod.net )

48

Page 49: CSS for Stater

</tr>

<tr>

<td>Joe</td>

<td>Swanson</td>

<td>$300</td>

</tr>

<tr>

<td>Cleveland</td>

<td>Brown</td>

<td>$250</td>

</tr>

</table>

</body>

</html>

code ေလးကေတာ ပမနပါပ။ table ရ႕ width က 100% သးလကျပးေတာ th ရ႕ height ကေတာ 50 px ေပးလကပါတယ။ သာမာန ရးရငး တ code ေလးပါပ။

Table Text Alignment

Text alignment မာ vertical န႕ horizontal ဆျပး ၂ မးရပါတယ။ horizontal ကေတာ text-align ကပသးပါတယ။ text-align မာ left, right, center, justify ဆျပး ရပါတယ။ အခေတာ သသာေအာင

text-align:right;

န႕ ျပထားပါတယ။

<html>

CSS for starter , written by saturngod ( www.saturngod.net )

49

Page 50: CSS for Stater

<head>

<style type="text/css">

table,td,th

{

border:1px solid black;

}

td

{

text-align:right;

}

</style>

</head>

<body>

<table>

<tr>

<th>Firstname</th>

<th>Lastname</th>

<th>Savings</th>

</tr>

<tr>

<td>Peter</td>

<td>Griffin</td>

<td>$100</td>

</tr>

<tr>

<td>Lois</td>

<td>Griffin</td>

<td>$150</td>

</tr>

<tr>

<td>Joe</td>

<td>Swanson</td>

<td>$300</td>

</tr>

<tr>

<td>Cleveland</td>

CSS for starter , written by saturngod ( www.saturngod.net )

50

Page 51: CSS for Stater

<td>Brown</td>

<td>$250</td>

</tr>

</table>

</body>

</html>

အဒ code က run လကရင

စာေတြ အကန ညာဖက ကပေနတာက ေတြ႕မာပါ။

vertical align ကေတာ top , bottom , middle ဆျပး ရပါတယ။ တခကေလာက code ေလးက ၾကညလကရေအာင

td

{

height:50px;

vertical-align:bottom;

}

ကပ သးထားတယ။

<html>

<head>

<style type="text/css">

table,td,th

{

border:1px solid black;

CSS for starter , written by saturngod ( www.saturngod.net )

51

Page 52: CSS for Stater

}

td

{

text-align:right;

}

</style>

</head>

<body>

<table>

<tr>

<th>Firstname</th>

<th>Lastname</th>

<th>Savings</th>

</tr>

<tr>

<td>Peter</td>

<td>Griffin</td>

<td>$100</td>

</tr>

<tr>

<td>Lois</td>

<td>Griffin</td>

<td>$150</td>

</tr>

<tr>

<td>Joe</td>

<td>Swanson</td>

<td>$300</td>

</tr>

<tr>

<td>Cleveland</td>

<td>Brown</td>

<td>$250</td>

</tr>

</table>

</body>

CSS for starter , written by saturngod ( www.saturngod.net )

52

Page 53: CSS for Stater

</html>

အဒါက run လကရင ေအာကကလ ေတြ႕ပါမယ။

အကနလး ေအာကမာ ေရာကေနတာက ေတြ႕ပါလမမယ။

Table Padding

table မာ padding က အေရးၾကးပါတယ။ padding က ဘာလဆတာကေတာ HTML table အခနးမာ ျပနလည ဖတရႈႏငပါတယ။ ရငးေအာင ေျပာရရငေတာ padding က border န႕ စာ အကြာအေဝးလ႕ ဆရပါလမမယ။

padding အတြကကေတာ

td

{

padding:15px;

}

အလမးေရးပါတယ။ code အျပညအစကေတာ

<html>

CSS for starter , written by saturngod ( www.saturngod.net )

53

Page 54: CSS for Stater

<head>

<style type="text/css">

table, td, th

{

border:1px solid black;

}

td

{

padding:15px;

}

</style>

</head>

<body>

<table>

<tr>

<th>Firstname</th>

<th>Lastname</th>

<th>Savings</th>

</tr>

<tr>

<td>Peter</td>

<td>Griffin</td>

<td>$100</td>

</tr>

<tr>

<td>Lois</td>

<td>Griffin</td>

<td>$150</td>

</tr>

<tr>

<td>Joe</td>

<td>Swanson</td>

<td>$300</td>

</tr>

<tr>

<td>Cleveland</td>

CSS for starter , written by saturngod ( www.saturngod.net )

54

Page 55: CSS for Stater

<td>Brown</td>

<td>$250</td>

</tr>

</table>

</body>

</html>

အဒါက run ၾကညလကရင

စာသားေတြက ေဘာငန႕ ျခားသြားတာက ေတြ႕ႏငပါလမမယ။

Table Color

table မာ ေနာကထပ လပ ေအာငျပငရမယ အပငးကေတာ color ပါပ။ color ဆတအထမာ border color န႕ background color ဆျပး ရပါတယ။ border အေၾကာငးကေတာ basic css style ေတြ ျပးသြားျပး box Model အပငးမာ ရငးျပေပးပါမယ။

table အတြကက color ကေတာ

table, td, th

{

border:1px solid green;

}

CSS for starter , written by saturngod ( www.saturngod.net )

55

Page 56: CSS for Stater

th

{

background-color:green;

color:white;

}

ဆျပး သးပါတယ။ တခကေလာက code အျပညအစက ၾကညလကရေအာင။

<html>

<head>

<style type="text/css">

table, td, th

{

border:1px solid green;

border-collapse:collapse;

padding:5px;

}

th

{

background-color:green;

color:white;

}

</style>

</head>

<body>

<table>

<tr>

<th>Firstname</th>

<th>Lastname</th>

<th>Savings</th>

</tr>

<tr>

<td>Peter</td>

<td>Griffin</td>

<td>$100</td>

</tr>

<tr>

CSS for starter , written by saturngod ( www.saturngod.net )

56

Page 57: CSS for Stater

<td>Lois</td>

<td>Griffin</td>

<td>$150</td>

</tr>

<tr>

<td>Joe</td>

<td>Swanson</td>

<td>$300</td>

</tr>

<tr>

<td>Cleveland</td>

<td>Brown</td>

<td>$250</td>

</tr>

</table>

</body>

</html>

က.. အဒ code ေလးက run လကရင ေအာကကလ ျမငရပါလမမယ။

ပမန table န႕ လးဝက မတေတာပါဘး။ ကၽြနေတာတ႕ code က နညးနညးေလး ျပနျပငရေအာင။ တစေၾကာငးျပးတငး အေရာငေလးေတြ ေျပာငးသြားေအာငေပါ။

tr.alt

{

background-color:#D5FFC8;

}

CSS for starter , written by saturngod ( www.saturngod.net )

57

Page 58: CSS for Stater

ဆျပး ထပျဖညလကမယ။code အျပညအစကေတာ ေအာကမာ ၾကညပါ။ tr တစခေကာတငးမာ alt ဆျပး class ေတြ လကျဖညထားတာက ေတြ႕ပါလမမယ။

<html>

<head>

<style type="text/css">

table, td, th

{

border:1px solid green;

border-collapse:collapse;

padding:5px;

}

tr.alt

{

background-color:#D5FFC8;

}

th

{

background-color:green;

color:white;

}

</style>

</head>

<body>

<table>

<tr>

<th>Firstname</th>

<th>Lastname</th>

<th>Savings</th>

</tr>

<tr>

<td>Peter</td>

<td>Griffin</td>

<td>$100</td>

</tr>

CSS for starter , written by saturngod ( www.saturngod.net )

58

Page 59: CSS for Stater

<tr class='alt'>

<td>Lois</td>

<td>Griffin</td>

<td>$150</td>

</tr>

<tr>

<td>Joe</td>

<td>Swanson</td>

<td>$300</td>

</tr>

<tr class='alt'>

<td>Cleveland</td>

<td>Brown</td>

<td>$250</td>

</tr>

</table>

</body>

</html>

အဒါက run လကရငေတာ

ဆျပး ျမငရပါလမမယ။

အခဆရငေတာ CSS style basic ပငးျပးသြားပါျပ။ ေနာကအပငးကေတာ box model အေၾကာငးလာပါေတာမယ။ border ေတြ အေၾကာငးေပါ။

CSS for starter , written by saturngod ( www.saturngod.net )

59

Page 60: CSS for Stater

Chapter 3: CSS Box ModelBox ModelCSS Box Model ဆတာကေတာ CSS မာ တြျပးသးရမယ margin , padding , border စတာေတြက ေျပာျပသြားမာပါ။ margin န႕ padding က အစ ေလလာသေတြ အေနန႕ အျမေရာေထြးေနတတပါတယ။ ရငးသြားေအာင ေအာကက ပေလးက တခကၾကညလကပါ။

content ဆတာကေတာ ကၽြနေတာတ႕ စာေတြ ေပၚမယေနရာေပါ။

padding ဆတာက ေတာ border န႕ content ၾကား အကြာအေဝးေပါ။

border ဆတာကေတာ content ရ႕ ေဘာငေပါ။margin ကေတာ လကရ ရေနတ ေနရာကေန အကြာအေဝးလ႕ ဆလ႕ရပါတယ။

ပျပး ရငးသြားေအာင ေအာကက code ေလးက ၾကညလကပါ။

<html>

<head>

<style type="text/css">

div.ex

CSS for starter , written by saturngod ( www.saturngod.net )

60

Page 61: CSS for Stater

{

width:220px;

padding:10px;

border:5px solid gray;

margin:0px;

}

</style>

</head>

<body>

<img src="250px.gif" width="250" height="1" /><br /><br />

<div class="ex">The line above is 250px wide.<br />

The total width of this element is also 250px.</div>

<p><b>Important:</b> This example will not display correctly in

IE!<br />

However, we will solve that problem in the next example.</p>

</body>

</html>

အဒါက browser မာ ေအာကကလ ျမငရပါမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

61

Page 62: CSS for Stater

padding 10px ေၾကာင အေပၚက img န႕ 10 px ေလာကကြာေနတာက ေတြ႕ပါမယ။ border 5 px လပထားတအတြကေၾကာင div ရ႕ border က ထေနပါတယ။ solid ျဖစတအတြကေကာင လငးက အျပညေပၚပါတယ။ အေရာငကေတာ gray ေပါ။

CSS Borderက... table အခနးကတညးက ပါလာတ border အေၾကာငး အခ ရငးပါျပ။ border ဆတာ ဘာလဆတာကေတာ ေထြေထြထးထး ရငးဖ႕ မလေတာပါဘး။

Border StyleBorder style ကေတာ border က ဘယလမး ပလဆတာအတြကေပါ။ border style မာ solid border ကေတာ အေရ႕မာ သးခပါတယ။

border-style values:

value ေတြက dotted, dashed , solid, double, grrove , ridge , inset, outset ေတြပါ။ ပေတြကေတာ ေအာကကလ ျမငရပါတယ။

CSS for starter , written by saturngod ( www.saturngod.net )

62

Page 63: CSS for Stater

<html>

<head>

<style type="text/css">

p.none {border-style:none;}

p.dotted {border-style:dotted;}

p.dashed {border-style:dashed;}

p.solid {border-style:solid;}

p.double {border-style:double;}

p.groove {border-style:groove;}

p.ridge {border-style:ridge;}

p.inset {border-style:inset;}

p.outset {border-style:outset;}

p.hidden {border-style:hidden;}

</style>

</head>

<body>

<p class="none">No border.</p>

<p class="dotted">A dotted border.</p>

<p class="dashed">A dashed border.</p>

<p class="solid">A solid border.</p>

<p class="double">A double border.</p>

<p class="groove">A groove border.</p>

CSS for starter , written by saturngod ( www.saturngod.net )

63

Page 64: CSS for Stater

<p class="ridge">A ridge border.</p>

<p class="inset">An inset border.</p>

<p class="outset">An outset border.</p>

<p class="hidden">A hidden border.</p>

</body>

</html>

အဒါက run ၾကညလကရငေတာ

Border Width

border width ကေတာ border အထအပါးက အသးျပပါတယ။ border-width ဆျပး သးပါတယ။

<html>

<head>

<style type="text/css">

p.one

{

border-style:solid;

CSS for starter , written by saturngod ( www.saturngod.net )

64

Page 65: CSS for Stater

border-width:5px;

}

p.two

{

border-style:solid;

border-width:medium;

}

p.three

{

border-style:solid;

border-width:1px;

}

</style>

</head>

<body>

<p class="one">Some text.</p>

<p class="two">Some text.</p>

<p class="three">Some text.</p>

<p><b>Note:</b> The "border-width" property does not work if it is

used alone. Use the "border-style" property to set the borders

first.</p>

</body>

</html>

အဒါေလးက browser မာ ဒလျမငရပါမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

65

Page 66: CSS for Stater

border အထအပါး ေတြ ကြာျခားေနတာက သတျပႏငပါတယ။

Border Color

border color ကေတာ border ရ႕ အေရာငေတြေပါ။ HTML မာ အေရာငသးတ ကစၥက ကၽြနေတာ ေရးခဖးပါတယ။ name သ႕မဟတ #RRGGBB န႕ အသျပပါတယ။ CSS မာေတာ rgb(0,0,255) လမး အသးျပလ႕ရပါေသးတယ။

အခ code ေလးမာေတာ border-color က သးထားတာကေတြ႕ႏငပါတယ။

<html>

<head>

<style type="text/css">

p.one

{

border-style:solid;

border-color:red;

}

p.two

{

border-style:solid;

border-color:#98bf21;

}

</style>

</head>

<body>

<p class="one">A solid red border</p>

<p class="two">A solid green border</p>

CSS for starter , written by saturngod ( www.saturngod.net )

66

Page 67: CSS for Stater

<p><b>Note:</b> The "border-color" property does not work if it is

used alone. Use the "border-style" property to set the borders

first.</p>

</body>

</html>

အဒါကေတာ ေအာကကလ ျမငရပါလမမယ။

Border- Individual sides

left လား right လား top လား bottom လား စျပး အေသးစတက အသးျပလ႕ရေအာငလညး CSS မာ ေရးသားႏငပါတယ။ တစခါတစေလ ညာဘကမာ border style တစမး ေျပာငးျပး ေဖာျပခငတ အခါမးမာေပါ

p

{

border-top-style:dotted;

border-right-style:solid;

border-bottom-style:dotted;

border-left-style:solid;

}

ဆျပး အသးျပပါတယ။ code အျပညအစန႕ စမးၾကညမယဆရငေတာ

<html>

<head>

<style type="text/css">

p

{

CSS for starter , written by saturngod ( www.saturngod.net )

67

Page 68: CSS for Stater

border-top-style:dotted;

border-right-style:solid;

border-bottom-style:dotted;

border-left-style:solid;

}

</style>

</head>

<body>

<p>2 different border styles.</p>

</body>

</html>

ဘယလမး ေပၚမလဆရငေတာ

တကယလ႕ ၄ ေၾကာငးမေရးပန႕ ၁ေၾကာငးတညး ဒလေရးလ႕ရပါတယ။

border-style:dotted solid;

ေရ႕ကေတာ အေပၚန႕ ေအာကျဖစျပး ေနာကကေန ဘယန႕ ညာန႕ ပါ။ အေပၚန႕ ေအာက အတတ ပျဖစေနရင ဘယန႕ ညာ အတတပ ျဖစေနရင တစေၾကာငးတညးန႕ ေရးလ႕ရပါတယ။border-style မာ value က ၄ ခေလာကထ ထညလ႕ရပါတယ။

border-style: dotted solid double dashed;

top border က dottedright border က solidbottom border က doubleleft border ကေတာ dashed

border-style: dotted solid double;

CSS for starter , written by saturngod ( www.saturngod.net )

68

Page 69: CSS for Stater

top border က dottedright န႕ left border က solidbottom border က double

border-style: dotted solid;

top န႕ bottom border က dottedright န႕ left border က solid

border-style: dotted;

border အားလး dotted

Border - Shorthand property

တကယလးက ေပါငးျပး တစေၾကာငးတညး ေရးခငရငတာ border: ဆျပး ေရးပါတယ။ table အခနးမာေရးသြားတာက shorthand ပစပါ။ border 5px solid red အတြက အေၾကာငးေတြ အမားၾကး မေရးပ

border:5px solid red;

ဆျပး ေရးလ႕ရပါတယ။

property ကေတာ

border-widthborder-styleborder-color

ဆျပး အသးျပပါတယ။

CSS for starter , written by saturngod ( www.saturngod.net )

69

Page 70: CSS for Stater

CSS Border Properties

Property Description Values

border properties အားလး အတြက border-widthborder-styleborder-color

border-bottom border bottom properties အားလးအတြက

border-bottom-widthborder-bottom-styleborder-bottom-color

border-bottom-color bottom border color ေျပာငးရန

border-color

border-bottom-style border bottom style ျပငရန border-style

border-bottom-width border bottom width က ျပငရန

border-width

border-color border အားလးအတြက color color_namehex_numberrgb_numbertransparent

border-left border left properties အားလးအတြက

border-left-widthborder-left-styleborder-left-color

border-left-color border left color အတြက ျပငရန

border-color

border-left-style border left style ျပငရန border-style

border-left-width border left width ျပငရန border-width

border-right border right အတြက အကနျပငရန

border-right-widthborder-right-styleborder-right-color

border-right-color border right color ျပငရန border-color

border-right-style border right style ျပငရန အတြက

border-style

CSS for starter , written by saturngod ( www.saturngod.net )

70

Page 71: CSS for Stater

Property Description Values

border-right-width border right width ျပငရနအတြက

border-width

border-style border အားလးအတြက style nonehiddendotteddashedsoliddoublegrooveridgeinsetoutsetinherit

border-top border top ႏင သကဆငရာ အားလး

border-top-widthborder-top-styleborder-top-color

border-top-color border top color ျပငရန border-color

border-top-style border top style ျပငရန border-style

border-top-width border top width ျပငရန border-width

border-width border အားလးရ႕ width thinmediumthicklength

CSS for starter , written by saturngod ( www.saturngod.net )

71

Page 72: CSS for Stater

CSS Outlineoutline ကေတာ link ေတြထညလကတအခါ ပေတြ ၊ စာေတြရ႕ ပတလညမာ dotted line ေလး က ေျပာတာပါ။ သ႕က border န႕ မားတတပါတယ။ ေသခာေအာင ေအာကက example ေလးက ၾကညလကပါ။

<html>

<head>

<style type="text/css">

p

{

border:1px solid red;

outline:green dotted thick;

}

</style>

</head>

<body>

<p><b>Note:</b> IE8 supports the outline properties only if a !

DOCTYPE is

specified.</p>

</body>

</html>

အဒ code ေလးက run လကတ အခါမာ ေအာကကလ ျမငရပါလမမယ။

border ကေတာ အနေရာငျဖစျပး outline ကေတာ အစမးေရာင dotted ေလးန႕ ျပထားပါတယ။

outline ကေတာ

outline:[color] [style] [width];

CSS for starter , written by saturngod ( www.saturngod.net )

72

Page 73: CSS for Stater

ဆျပး အသးျပပါတယ။

CSS MarginCSS မာ margin န႕ padding ပငးက အေရးၾကးပါတယ။ margin န႕ padding က အစပငးမာ ေရာေထြးေနတတပါတယ။ သ႕ေပမယ margin န႕ padding က လးဝ ကြာျခားပါတယ။ ဒ အေၾကာငးက HTML မာတနးက ကၽြနေတာ ေျပာချပးပါျပ။ margin က ေအာကကလ မး အသးျပပါတယ။

margin:25px 50px 75px 100px;

top margin က 25pxright margin က 50pxbottom margin က 75pxleft margin က 100px

လ႕ ဆတာပါ။

margin: 25px 50px 75px;

top margin က 25pxright န႕ left margin က 50pxbottom margin ကေတာ 75px

လ႕ ဆတာပါ။

margin:25px 50px;

top န႕ bottom က 25px right န႕ left ကေတာ 50px

ပါ။

CSS for starter , written by saturngod ( www.saturngod.net )

73

Page 74: CSS for Stater

margin:25px;

margin အားလးက 25px

လ႕ဆပါတယ။

margin က စမးထားတ example ေလး ၾကညရေအာင။

<html>

<head>

<style type="text/css">

p

{

background-color:yellow;

}

p.margin

{

margin:100px 50px;

}

</style>

</head>

<body>

<p>This is a paragraph with no specified margins.</p>

<p class="margin">This is a paragraph with specified margins.</p>

</body>

</html>

အဒါက run လကရင ေအာကကလ ေတြ႕မာပါ။

CSS for starter , written by saturngod ( www.saturngod.net )

74

Page 75: CSS for Stater

top န႕ bottom က 100px ျဖစျပး left န႕ right က 50px ကြာထားတာက ေတြ႕ႏငပါတယ။ margin က အျပငကေန အကြာအေဝးပါ။ padding ကေတာ အတြငး အကြာအေဝးေပါ။ ေနာကျပး တစခ ျခငးဆ အေနန႕ ခြေရးလညးရပါတယ။

margin-top:100px;margin-bottom:100px;margin-right:50px;margin-left:50px;

margin top က 100 px , bottom ကလညး 100px , left န႕ right ကေတာ 50 px ဆျပး တစချခငးဆ ေရးသားထားတာပါ။

CSS Paddingpadding ကလညး margin လမးပါပ။ သကေတာ အတြငးကေန အကြာအေဝးပါ။ သ႕ အသးျပပကလညး margin အတငးပါပ။

padding:25px 50px 75px 100px;

top padding က 25pxright padding က 50pxbottom padding က 75pxleft padding က 100px

လ႕ ဆတာပါ။

padding: 25px 50px 75px;

CSS for starter , written by saturngod ( www.saturngod.net )

75

Page 76: CSS for Stater

top padding က 25pxright န႕ left padding က 50pxbottom padding ကေတာ 75px

လ႕ ဆတာပါ။

padding:25px 50px;

top န႕ bottom က 25px right န႕ left ကေတာ 50px

ပါ။

padding:25px;

padding အားလးက 25px

လ႕ဆပါတယ။

သ႕ကလညး တစခ ျခငးဆ ခြေရးလ႕ရပါတယ။

padding-top:25px;padding-bottom:25px;padding-right:50px;padding-left:50px;

က။ ဥပမာေလး ၾကညရေအာင။

<html>

<head>

<style type="text/css">

p

{

background-color:yellow;

CSS for starter , written by saturngod ( www.saturngod.net )

76

Page 77: CSS for Stater

}

p.padding

{

padding-top:25px;

padding-bottom:25px;

padding-right:50px;

padding-left:50px;

}

</style>

</head>

<body>

<p>This is a paragraph with no specified padding.</p>

<p class="padding">This is a paragraph with specified paddings.</

p>

</body>

</html>

အဒါကေလးက run လကရင ေအာကကလ ျမငရပါမယ။

အဒါဆရငေတာ padding န႕ margin က သေဘာေပါကေလာကပါျပ။

အခဆရငေတာ CSS အေျခခအဆငေလာကက သသြားျပလ႕ ဆႏငပါျပ။ ေနာကအခနးေတြကေတာ advanced ပငး နညးနညးေရာကလာပါျပ။ ဒါေၾကာင example ေတြ အကနမျပေတာ သလ အေသးစတ႐ငးလငးခကေတြလညး သပျပး ပါလာေတာမာ မဟတပါဘး။

CSS for starter , written by saturngod ( www.saturngod.net )

77

Page 78: CSS for Stater

Chapter 4: Advanced CSSGrouping CSSCSS ေတြေရးတ အခါမာ တညတ code ေတြက စစညးျပး ေၾကျငာလ႕ရပါတယ။ ဥပမာ

h1

{

color:green;

}

h2

{

color:green;

}

p

{

color:green;

}

လ႕ ေရးထားတာက

h1,h2,p

{

color:green;

}

လ႕ ျပငေရးလ႕ ရပါတယ။

တညတာေတြက စစညးေရးသားလကျခငးအားျဖင စာေၾကာငးတသြားသလ file size လညး ေသးသြားပါတယ။ ဒါေၾကာင website loading လညး ပျမနလာပါလမမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

78

Page 79: CSS for Stater

Nesting Selectors

ကၽြနေတာတ႕ေတြ တစခါတစေလ မာ ဘယ ေအာကက ဘာ ဆျပး ေခၚသးခငတာေတြ ႐ပါတယ။ ဥပမာ ။။ .marked ေအာကက p ဆျပးေတာေပါ။ အဒါက ဒလေရးလ႕ရပါတယ။

p

{

color:blue;

text-align:center;

}

.marked

{

background-color:blue;

}

.marked p

{

color:white;

}

လ႕ ေရးထားတာက .marked ေအာကက p tag ေတြအားလးက အျဖေရာငန႕ ျပဆျပး ေၾကျငာလကတာပါ။

CSS DimensionCSS မာ အရြယအစားေတြ က သတမတဖ႕ ေအာကက properties ေတြက အသးျပႏငပါတယ။

CSS for starter , written by saturngod ( www.saturngod.net )

79

Page 80: CSS for Stater

Property Description Value

height ပေသ အျမင ျဖစသည။ စာေၾကာငးမားသြားလင အျမင ထပမတး သလ စာနညးေနရငလညး မေလာပါ။ ပေသ သတမတခကျဖစသည။

autopx%

max-height အမားဆး ေရာက႐ခြင႐သည အျမငျဖစသည။

autopx%

max-width အမားဆး ေရာက႐ခြင႐သည အကယျဖစသည။

autopx%

min-height အနညးဆးထားရမည အျမင ျဖစသည။

autopx%

min-width အနညးဆးထားရမည အကယျဖစသည။

width ပေသ အကယ ျဖစသည။ စာေၾကာငးမားသြားလင ထပမကယေတာ သလ စာနညးေနရငလညး မတပါ။ ပေသ သတမတခကျဖစသည။

CSS Display and Visibilityမျမငလတ selector ေတြက display:none သ႕မဟတ visibility:hidden ဆျပး ေဖာကထားလ႕ရပါတယ။ မျမငခငတ စာေတြက ေဖာကတာေတြက အဓက javascript န႕ တြျပး အသးျပပါတယ။ ဥပမာ ။။ ပေတြက button ေလးႏပလကမ ေပာကသြားတာမးေပါ။ အဒ အပငးက css တစခတညးန႕ မရပါဘး။ javascript ပါ တြ သးရပါတယ။ အခေတာ ကၽြနေတာ a tag န႕ တြသးျပပါမယ။

<html>

<head>

<style type="text/css">

CSS for starter , written by saturngod ( www.saturngod.net )

80

Page 81: CSS for Stater

a:hover {visibility:hidden;}

</style>

</head>

<body>

<a href="http://www.saturngod.net">hover and hide</a>

</body>

</html>

က run တ အခါမာ hover and hide ဆတာ ေပၚလာပါမယ။ အဒ ေပၚ mouse တငလကရင စာ ေပာကသြားတာ ေတြ႕ရမာပါ။

<html>

<head>

<style type="text/css">

h1.hidden {display:none;}

</style>

</head>

<body>

<h1>This is a visible heading1</h1>

<h1 class="hidden">This is a hidden heading 2</h1>

<p>Notice that the hidden heading does not take up space.</p>

</body>

</html>

က စမးၾကညရင ဒလ ျမငရပါမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

81

Page 82: CSS for Stater

Block and Inline Elements

Block န႕ Inline ကေတာ list ေတြန႕ တြသးၾကပါတယ။ list န႕ တြသးျပမသာ block န႕ inline က နားလညပါလမမယ။ block ကေတာ block တစခလး အျပညယသြားတာပါ။ inline ကေတာ တစေနရာတညးမာ တစေၾကာငးတညး အေနန႕ ေဖာျပေပးမာပါ။ ဥပမာ။။ menu ေတြ လမးေပါ။

<html>

<head>

<style type="text/css">

li{display:inline;}

</style>

</head>

<body>

<p>Display this link list as a horizontal menu:</p>

<ul>

<li><a href="/html/default.asp" target="_blank">HTML</a></li>

<li><a href="/css/default.asp" target="_blank">CSS</a></li>

<li><a href="/js/default.asp" target="_blank">JavaScript</a></li>

<li><a href="/xml/default.asp" target="_blank">XML</a></li>

</ul>

</body>

</html>

က run လကရင ေအာကကလ ျမငရပါမယ။

li ေတြက inline သးထားတအတြက list ေတြက တစေၾကာငးတညးမာ ျမငရေနတာပါ။ default က display:block ျဖစတအတြက တစေၾကာငးစ ခြျပး ျမငေနရတာပါ။

CSS for starter , written by saturngod ( www.saturngod.net )

82

Page 83: CSS for Stater

HTML မာ တနးက တစေၾကာငးတညးမာ အသးျပခငလ႕ div အစား span က သးခတာ မတမအးမယ ထငပါတယ။ span က div လမး line breaking ျဖစသြားေအာင display:block န႕ ဖနတးလ႕ရပါတယ။

<html>

<head>

<style type="text/css">

span

{

display:block;

}

</style>

</head>

<body>

<h2>Nirvana</h2>

<span>Record: MTV Unplugged in New York</span>

<span>Year: 1993</span>

<h2>Radiohead</h2>

<span>Record: OK Computer</span>

<span>Year: 1997</span>

</body>

</html>

က run လကရင ေအာကကလ ျမငရပါမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

83

Page 84: CSS for Stater

CSS for starter , written by saturngod ( www.saturngod.net )

84

Page 85: CSS for Stater

PositionCSS မာ position က အေရးပါတ အထမာ ပါပါတယ။ Position မာ fixed , relative , absolute ဆတာေတြ ရပါတယ။

Fixed Position

Fixed ဆတာကေတာ တစေနရာတညးမာ အတညျဖစေနတာပါ။ ဥပမာ ေျပာရရငေတာ facebook က chat လမး ေအာကမာ ကပေနတာမးေပါ။

<html>

<head>

<style type="text/css">

p.pos_fixed

{

position:fixed;

top:10px;

right:5px;

}

p.pos_fixed2

{

position:fixed;

bottom:5px;

left:5px;

background:#453245;

color:#FFF;

}

</style>

</head>

<body>

<p class="pos_fixed">Some more text</p>

<p><b>Note:</b> IE7 and IE8 supports the fixed value only if a

!DOCTYPE is specified.</p>

CSS for starter , written by saturngod ( www.saturngod.net )

85

Page 86: CSS for Stater

<p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</

p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</

p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</

p><p>Some text</p><p>Some text</p><p>Some text</p><p

class="pos_fixed2">Bottom</p>

</body>

</html>

အဒ code ေလးက run လကရင ေအာကကလ ျမငရပါလမမယ။

windows က ေသးေသးထားျပး scroll ဆြၾကညပါ။ ဘယဘက အေပၚက စာန႕ ေအာကညာဘကက စာက ေနရာမေျပာငးပ အျမ ကပေနတာေတြ႕ပါလမမယ။

Relative Position

Relative position ကေတာ လကရ ရေနတ position ေပၚမာ မတညျပး ေျပာငးလ ေပးတာပါ။ ေအာကက ဥပမာ ေလးက ၾကညၾကညလကပါ။ သက position absolute န႕ အျမ ေရာေထြးတတပါတယ။

<html>

CSS for starter , written by saturngod ( www.saturngod.net )

86

Page 87: CSS for Stater

<head>

<style type="text/css">

h2.pos_left

{

position:relative;

top:-40px;

}

</style>

</head>

<body>

<h2>This is a heading with no position</h2>

<h2 class="pos_left">This heading is moved left according to its

normal position</h2>

<div><h2>Another One</h2><h2 class="pos_left">This heading is

moved left according to its normal position</h2></div>

<p>This is testing page</p>

</body>

</html>

အဒါေလးက ေအာကကလ ျမငရပါလမမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

87

Page 88: CSS for Stater

Absolute Position

စာမကႏာေပၚမာ ၾကကတ ေနရာက ေရႊ႕ခငတအခါမာ position က absolute ထားေပးရပါတယ။ ျပးရင top , bottom ,left,right value ေတြန႕ ေရႊ႕ေပးလ႕ရပါတယ။ ေအာကက ဥပမာ ေလးက ၾကညၾကညလကပါ။

<html>

<head>

<style type="text/css">

h2

{

position:absolute;

left:100px;

top:150px;

}

</style>

</head>

<body>

<h2>This is a heading with an absolute position</h2>

<p>With absolute positioning, an element can be placed anywhere on

a page. The heading below is placed 100px from the left of the

page and 150px from the top of the page.</p>

</body>

</html>

CSS for starter , written by saturngod ( www.saturngod.net )

88

Page 89: CSS for Stater

အဒါက run လကရင ေအာကကလ ျမငရပါမယ။

အခ position relative န႕ position absolute က ၾကညရေအာင။

<html>

<head>

<style type="text/css">

h2.abs

{

position:absolute;

left:100px;

top:0px;

}

h2.abs2 {

position:absolute;

top:0px;

right:0px;

}

div.relative {

color:#FFF;

background:#000;

position:relative;

height:200px;

}

</style>

</head>

<body>

CSS for starter , written by saturngod ( www.saturngod.net )

89

Page 90: CSS for Stater

Lorem Ipsum is simply dummy text of the printing and typesetting

industry. Lorem Ipsum has been the industry's standard dummy text ever

since the 1500s, when an unknown printer took a galley of type and

scrambled it to make a type specimen book. It has survived not only five

centuries, but also the leap into electronic typesetting, remaining

essentially unchanged. It was popularised in the 1960s with the release

of Letraset sheets containing Lorem Ipsum passages, and more recently

with desktop publishing software like Aldus PageMaker including versions

of Lorem Ipsum.

<div>

<h2 class="abs">This is header</h2>

</div>

<div class="relative">

Sample Text

<h2 class="abs2">This is header</h2>

</div>

</html>

အဒါက run လကရင ေအာကကလ ျမငရပါမယ။

position က absolute ထားလကတ အခါမာ browser ေပၚက ၾကကတ ေနရာက ေရႊ႕လ႕ရပါတယ။ သ႕ေပမယ menu ေတြ တညေဆာကတအခါမာ ျဖစျဖစ layout ခတ ေနရာ မာ ျဖစျဖစ div layer ထက ၾကကတ ေနရာက ပ ေရႊ႕ခငတအခါမာ div က position: relative ဆျပး ေၾကျငာထားရပါမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

90

Page 91: CSS for Stater

Z-Index

Z-Index ဆတာကေတာ CSS မာ ဘယသက အေပၚမာ ေျပာေစခငလဆတာက သတမတတာပါ။ တနညးေျပာရင တစခန႕ တစခထပေနတအခါ ဘယသက အေပၚ ဘယသက ေအာကဆျပး သတမတေပးတာပါ။

<html>

<head>

<style type="text/css">

div.below,div.upper {

position:absolute;

top:100px;

left:100px;

}

div.below {

background:#0F0;

z-index:1;

}

div.upper {

background:#F00;

left:130px;

z-index:10;

}

</style>

</head>

<body>

<div class="upper">

Sample

</div>

<div class="below">

Sample

</div>

</body>

</html>

CSS for starter , written by saturngod ( www.saturngod.net )

91

Page 92: CSS for Stater

တကယတနးေတာ ေအာကက ေရးထားတ background အနေရာငေပၚ အစမးေရာငက ဖးေနရမာပါ။ သ႕ေပမယ z-index ကြာတာေၾကာင အနေရာငက အစမးေရာငက ဖးထားျပးသား ျဖစသြားတာပါ။

CSS for starter , written by saturngod ( www.saturngod.net )

92

Page 93: CSS for Stater

CSS FloatingCSS Floating ဆတာက ဘယဘက ကပမလား ညာဘကကမလားဆျပး သတမတေပးတာပါ။ position absolute န႕ မတတာက သက လကရ ရေနတ ေနရာကေန ညာဘက သြားကပတာပါ။ ေအာကက code ေလးက ၾကညျပး run ၾကညလကပါ။

<html>

<head>

<style type="text/css">

img

{

float:right;

}

</style>

</head>

<body>

<p>In the paragraph below, we have added an image with style

<b>float:right</b>. The result is that the image will float to the

right in the paragraph.</p>

<p>

<img src="logocss.gif" width="95" height="84" />

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

</p>

</body>

</html>

CSS for starter , written by saturngod ( www.saturngod.net )

93

Page 94: CSS for Stater

အဒါက browser မာ ဒလ ျမငရပါမယ။

float က right ထားလကတာေၾကာင image က ညာဘက ေထာငကပသြားတာက ေတြ႕ရမာပါ။

အခေတာ float က သးျပး gallery ေလး လပၾကညရေအာင။ ပမန အားျဖင img ေတြက ေရးလကရင တစလငးဆငးျပးေတာ ေပၚေနပါလမမယ။ ဒါေၾကာင float:left ဆျပး အကနလးက တစလငးထ ေပၚေအာင ဖနတးလကပါမယ။ float left က display:inline န႕ မတတာကေတာ screen width ျပညသြားရင သ႕အလလ ေနာကတစလငး ေျပာငးသြားေပးတာပါ။

<html>

<head>

<style type="text/css">

.thumbnail

{

float:left;

width:110px;

height:90px;

margin:5px;

}

</style>

</head>

<body>

<h3>Image Gallery</h3>

CSS for starter , written by saturngod ( www.saturngod.net )

94

Page 95: CSS for Stater

<p>Try resizing the window to see what happens when the images

does not have enough room.</p>

<img class="thumbnail" src="klematis_small.jpg" width="107"

height="90">

<img class="thumbnail" src="klematis2_small.jpg" width="107"

height="80">

<img class="thumbnail" src="klematis3_small.jpg" width="116"

height="90">

<img class="thumbnail" src="klematis4_small.jpg" width="120"

height="90">

<img class="thumbnail" src="klematis_small.jpg" width="107"

height="90">

<img class="thumbnail" src="klematis2_small.jpg" width="107"

height="80">

<img class="thumbnail" src="klematis3_small.jpg" width="116"

height="90">

<img class="thumbnail" src="klematis4_small.jpg" width="120"

height="90">

</body>

</html>

အဒါက run လကရင ေအာကကလ ျမငရပါမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

95

Page 96: CSS for Stater

ေနာကျပးေတာ float က ရငးခငရငေတာ clear:both ဆျပး အသးျပပါတယ။ ေနာကထပ code တစခက ထပၾကညရေအာင။

<html>

<head>

<style type="text/css">

.thumbnail

{

float:left;

width:110px;

height:90px;

margin:5px;

}

.text_line

{

clear:both;

margin-bottom:2px;

}

</style>

</head>

<body>

<h3>Image Gallery</h3>

<p>Try resizing the window to see what happens when the images

does not have enough room.</p>

<img class="thumbnail" src="klematis_small.jpg" width="107"

height="90">

<img class="thumbnail" src="klematis2_small.jpg" width="107"

height="80">

<img class="thumbnail" src="klematis3_small.jpg" width="116"

height="90">

<img class="thumbnail" src="klematis4_small.jpg" width="120"

height="90">

<h3 class="text_line">Second row</h3>

<img class="thumbnail" src="klematis_small.jpg" width="107"

height="90">

CSS for starter , written by saturngod ( www.saturngod.net )

96

Page 97: CSS for Stater

<img class="thumbnail" src="klematis2_small.jpg" width="107"

height="80">

<img class="thumbnail" src="klematis3_small.jpg" width="116"

height="90">

<img class="thumbnail" src="klematis4_small.jpg" width="120"

height="90">

</body>

</html>

အဒါက browser မာ ဒလေပၚေနပါမယ။

All CSS Float Properties

Property Description Value

clear float က ရငးရန leftrightbothnone

float box က ေရႊ႕ရန leftrightnone

CSS for starter , written by saturngod ( www.saturngod.net )

97

Page 98: CSS for Stater

CSS for starter , written by saturngod ( www.saturngod.net )

98

Page 99: CSS for Stater

CSS Pseudo ClassCSS pseudo-class ကေတာ အထးသးသန႕ selector ေတြပါ။ ဘယလ ေတြလဆေတာ ကၽြနေတာတ႕ anchor မာ သးခသလ a:hover , a:link တ႕မာ :hover , :link တ႕က pseudo class ေတြပါပ။

First Child

first-child pseudo class ကေတာ ပထမဆး child က ေခၚတာပါ။ ရငးသြားေအာင code ေလးက ၾကညလကပါ။

<html>

<head>

<style type="text/css">

p:first-child

{

color:blue;

}

</style>

</head>

<body>

<p>This is some text.</p>

<p>This is some text.</p>

<p><b>Note:</b> For :first-child to work in IE8 and earlier, a

DOCTYPE must be declared.</p>

</body>

</html>

အဒါက browser မာ ဒလ ျမငရပါမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

99

Page 100: CSS for Stater

ပထမဆး p က အျပာေရာငန႕ ေပၚေနတာက ေတြ႕ပါလမမယ။

ထပျပး ရငးသြားေအာင ေအာကက code က ထပၾကညၾကညပါ။

<html>

<head>

<style type="text/css">

p > i:first-child

{

color:blue;

}

</style>

</head>

<body>

<p>I am a <i>strong</i> man. I am a <i>strong</i> man.</p>

<p>I am a <i>strong</i> man. I am a <i>strong</i> man.</p>

<p><b>Note:</b> For :first-child to work in IE8 and earlier, a

DOCTYPE must be declared.</p>

</body>

</html>

အမာ ပထမဆး i tag န႕ ေရးထားတ strong က အျပာေရာင ျဖစေနပါလမမယ။

p>i ဆတာကေတာ p ေအာကမာ ရတ i က ဆလတာပါ။ p:first-child i ဆရငေတာ ပထမဆး p ရ႕ i က ပ ေျပာငးပါလမမယ။ အဒါကေတာ ကယတင စမးၾကညလကပါ။

:before and :after

CSS for starter , written by saturngod ( www.saturngod.net )

100

Page 101: CSS for Stater

:before န႕ :after selector ေတြက content န႕ တြျပး အသးျပပါတယ။ စာန႕ ရငးျပေနရင နညးနညး ရႈပပါတယ။ code ေလးက ၾကညလကပါ။

<html>

<head>

<style type="text/css">

p.no1:before {

content:"Hello";

background:#000;

color:#FFF;

}

p.no2:after {

content:"good bye";

background:#000;

color:#FFF;

}

</style>

</head>

<body>

<p class="no1">

This is sample text

</p>

<p class="no2">

This is sample text

</p>

</body>

</html>

အဒါက ေအာကကလ ျမငရပါလမမယ။

CSS for starter , written by saturngod ( www.saturngod.net )

101

Page 102: CSS for Stater

before ကေတာ မတငခငမာ ထပျဖညေပးတာေပါ။ after ကေတာ ျပးတ အခါမာ ထပျဖညဖ႕ အတြကပါ။

All Pseudo Property

Property Example Description

:link a:link unvisited link ေတြ အားလးက အတြက selector

:visited a:visited visited link ေတြ အတြက selector

:active a:active active ျဖစတအခနအတြက selector

:hover a:hover mouse hover လပလကတ အခနအတြက

:focus input:focus input မာ focus ျဖစသြားတ အခနအတြက selector

:first-letter p:first-letter paragraph မာ ပထမဆး စာလး အတြက selector

:first-line p:first-line <br/> မတငခင ပထမဆး line အတြက

:first-child p:first-child ပထမဆး child အတြက

:before p:before paragraph တြင စာ မ စခင အတြက

:after p:after paragraph တြင စာ ဆးျပး အတြက

CSS for starter , written by saturngod ( www.saturngod.net )

102

Page 103: CSS for Stater

Opacityပေတြ background color ေတြက ေဖာကျပး ျမငရေအာင အတြက opacity က ေလာခေပးရပါတယ။ ေအာကက code ေလးက ေလလာၾကညပါ။

<html>

<head>

<style type="text/css">

body {

background:#000;

}

div {

background:#F00;

opacity:0.5;

color:#FFF;

}

</style>

</head>

<body>

<div>

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Nullam velit nisl, aliquet vitae egestas a, fringilla quis arcu.

Sed pulvinar nunc et tortor lacinia sed elementum arcu ultricies.

Integer non dolor dolor. Vivamus lobortis sem ut nibh mattis

interdum. Proin tristique rhoncus erat vitae mollis. Ut vulputate

adipiscing nibh, sit amet imperdiet nisi adipiscing ac. Aliquam

lacinia odio quis ipsum semper aliquet. Fusce aliquet ligula

felis, non euismod enim. Quisque viverra, diam non fringilla

commodo, nisi tortor dignissim dolor, sed lacinia ante dolor sed

elit. Maecenas adipiscing purus nec urna molestie et vehicula elit

iaculis. Mauris eget elit bibendum nibh mattis sollicitudin

tristique ac purus. Vestibulum ante ipsum primis in faucibus orci

luctus et ultrices posuere cubilia Curae; Ut ultrices egestas

quam, sit amet pellentesque augue hendrerit eu.

</div>

CSS for starter , written by saturngod ( www.saturngod.net )

103

Page 104: CSS for Stater

</body>

</html>

အဒါက browser မာ ဆရင ေအာကကလ ျမငေနရပါမယ။

အနေရာငက opacity ေလာခထားတအတြက အနကေရာငဘကက ေဖာကျပး ျမငေနရပါတယ။ ေသခာ ေအာင ကၽြနေတာ တ႕ background က image ထညျပး ၾကညရေအာင။

background image ထညလကရင အေပၚကလမး ျမငရပါလမမယ။ အခ ပက စာပါ opacity ေလာသြားပါတယ။ background တစခပ ေလာခငရငေတာ rgba က သးရပါမယ။ ေအာကက ဥပမာ ေလးက ၾကညလကပါ။

<html>

<head>

<style type="text/css">

body {

background:url('pattern.gif');

}

div {

background:rgba(255,0,0,0.5);

color:#FFF;

}

CSS for starter , written by saturngod ( www.saturngod.net )

104

Page 105: CSS for Stater

</style>

</head>

<body>

<div>

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Nullam velit nisl, aliquet vitae egestas a, fringilla quis arcu.

Sed pulvinar nunc et tortor lacinia sed elementum arcu ultricies.

Integer non dolor dolor. Vivamus lobortis sem ut nibh mattis

interdum. Proin tristique rhoncus erat vitae mollis. Ut vulputate

adipiscing nibh, sit amet imperdiet nisi adipiscing ac. Aliquam

lacinia odio quis ipsum semper aliquet. Fusce aliquet ligula

felis, non euismod enim. Quisque viverra, diam non fringilla

commodo, nisi tortor dignissim dolor, sed lacinia ante dolor sed

elit. Maecenas adipiscing purus nec urna molestie et vehicula elit

iaculis. Mauris eget elit bibendum nibh mattis sollicitudin

tristique ac purus. Vestibulum ante ipsum primis in faucibus orci

luctus et ultrices posuere cubilia Curae; Ut ultrices egestas

quam, sit amet pellentesque augue hendrerit eu.

</div>

</body>

</html>

အဒါက run လကရင ေအာကကလ ျမငရပါမယ။

opacity က အကနလးက သကေရာကေစပါတယ။ background color တစခတညး သကေရာက ေစလတ အခါမာ rgba က အသးျပႏငပါတယ။ rgba ဆတာကေတာ red , green , blue , alpha ပါ။ alpha န႕ opacity က အတတပါပ။ value အျမငဆးက 1 ျဖစျပး အနမဆးကေတာ 0 ပါ။

CSS for starter , written by saturngod ( www.saturngod.net )

105

Page 106: CSS for Stater

Image Spriteimage sprite ဆတာကေတာ ပေတြ အမားၾကးထက ပ တစပထမာ ထညထားတာပါ။ အဒ အတြကေၾကာင ပ ေတြ အမားၾကးအတြက တစခါပ request လပရပါပ။ ျပးမ ပေတြက ခြ ျပးေတာ ျပနသးတာေပါ။

ဆတ ပေလးမာ ပ ၃ ပက တစခတညး ေပါငးထားတာပါ။ ပကေတာ http://www.w3schools.com/css/img_navsprites.gif ကေန ရယထားပါတယ။

အဒါက အသးျပျပး ေအာကက code က ေရးလကပါမယ။

<html>

<head>

<style type="text/css">

img.home

{

width:46px;

height:44px;

background:url(img_navsprites.gif) 0 0;

}

img.next

{

width:43px;

height:44px;

background:url(img_navsprites.gif) -91px 0;

}

</style>

</head>

<body>

<img class="home" src="img_trans.gif" width="1" height="1" />

<br /><br />

CSS for starter , written by saturngod ( www.saturngod.net )

106

Page 107: CSS for Stater

<img class="next" src="img_trans.gif" width="1" height="1" />

</body>

</html>

background က 0 0 သးထားတာက ေတြ႕မာပါ။ left position က 0 , top position က 0 လ႕ ဆထားတာပါ။ တတယ ပ left position က 91px မာ စပါမယ။ တတယ ပက ေခၚခငေတာ -91px ဆျပး ေခၚလကပါတယ။ ဒတယပက ေခၚခငရငေတာ -47 ဆျပး ေခၚလကဖ႕ လပါလမမယ။ အဒါက browser မာ ေအာကကလ ျမငရပါလမမယ။

အဒ image က သးျပးေတာ navigation ေဆာကၾကညရေအာင။ ေသခာေအာင ေအာကက example ေလးက ထပၾကညလကပါ။

<html>

<head>

<style type="text/css">

#navlist{position:relative;}

#navlist li{margin:0;padding:0;list-

style:none;position:absolute;top:0;}

#navlist li, #navlist a{height:44px;display:block;}

#home{left:0px;width:46px;}

#home{background:url('img_navsprites.gif') 0 0;}

#prev{left:63px;width:43px;}

#prev{background:url('img_navsprites.gif') -47px 0;}

#next{left:129px;width:43px;}

#next{background:url('img_navsprites.gif') -91px 0;}

</style>

CSS for starter , written by saturngod ( www.saturngod.net )

107

Page 108: CSS for Stater

</head>

<body>

<ul id="navlist">

<li id="home"><a href="default.html"></a></li>

<li id="prev"><a href="css_intro.html"></a></li>

<li id="next"><a href="css_syntax.html"></a></li>

</ul>

</body>

</html>

အဒါက run လကရင ေအာကကလ ျမငရပါလမမယ။

ကၽြနေတာတ႕က row တစခ တညးျဖစေနတအတြက top က 0px န႕ ပ ေခၚေနပါတယ။ တကယလ႕ ကၽြနေတာတ႕ေတြ hover effect ေတြ သးခငတအခါမာ row ၂ ခက အသးျပရင ရသလ ၁ ခ တညးမာလညး ရပါတယ။ အခ top position အေၾကာငး သသြားေအာင ေအာကက ပက အသးျပပါမယ။

ဒတယ row ကေတာ hover လပတအခါမာ ေျပာငးသြားဖ႕ပါ။ ပကေတာ http://www.w3schools.com/css/img_navsprites_hover.gif ကေန ရယႏငပါတယ။

<html>

<head>

<style type="text/css">

#navlist{position:relative;}

#navlist li{margin:0;padding:0;list-

style:none;position:absolute;top:0;}

CSS for starter , written by saturngod ( www.saturngod.net )

108

Page 109: CSS for Stater

#navlist li, #navlist a{height:44px;display:block;}

#home{left:0px;width:46px;}

#home{background:url('img_navsprites_hover.gif') 0 0;}

#home a:hover{background: url('img_navsprites_hover.gif') 0

-45px;}

#prev{left:63px;width:43px;}

#prev{background:url('img_navsprites_hover.gif') -47px 0;}

#prev a:hover{background: url('img_navsprites_hover.gif') -47px

-45px;}

#next{left:129px;width:43px;}

#next{background:url('img_navsprites_hover.gif') -91px 0;}

#next a:hover{background: url('img_navsprites_hover.gif') -91px

-45px;}

</style>

</head>

<body>

<ul id="navlist">

<li id="home"><a href="default.html"></a></li>

<li id="prev"><a href="css_intro.html"></a></li>

<li id="next"><a href="css_syntax.html"></a></li>

</ul>

</body>

</html>

အေပၚက code မာ hover effect အတြက top ေတြက -45px က သးထားတာက ေတြ႕ႏငပါတယ။

CSS for starter , written by saturngod ( www.saturngod.net )

109

Page 110: CSS for Stater

Attribute Selectorတစခါတစေလမာ selector ေတြက attribute န႕ အသးျပဖ႕ လပါတယ။ ဥပမာ input လမးေပါ။ input ရ႕ type ေတြမာ textbox , password , checkbox , file , submit , image စတာေတြ ရတအခါမာ textbox ေတြ အကနလးကပ select လပခငတယ။ အဒ အခါမးမာ attribute selector က အသးျပႏငပါတယ။

<html><head><style type="text/css">input[type="text"] { background:#F00; color:#FFF;}</style></head>

<body><input type="text" value="Text" /><input type="password" value="password" /></body></html>

ဆတာက browser မာ ေအာကကလ ျမငရပါမယ။

type=”text” ျဖစေနတာကပ ေျပာငးေပးထားတာက ေတြ႕ႏငပါတယ။

attribute selector က အသးျပတအခါမာေတာ

[attribute_name=attribute_value]

ဆျပး ေလးေထာင ကြငးန႕ အသးျပႏငပါတယ လ႕ ေျပာရငး နဂး ခပလကပါတယ။

CSS for starter , written by saturngod ( www.saturngod.net )

110

Page 111: CSS for Stater

What Next ?HTML န႕ CSS က ေလလာျပးတအခါမာေတာ ထပျပးေတာ javascript , jquery တ႕က ေလလာသငပါတယ။ အခ ကၽြနေတာ ေရးထားခတ စာအပ က HTML 4 န႕ CSS 2 ပ ရပါေသးတယ။ ဒါေၾကာင HTML 5 န႕ CSS 3 က လညး ေလလာသငပါတယ။ HTML 5 န႕ CSS 3 မာ ပမေကာငးမြနတ feature ေတြ အေျမာကအျမား ပါဝငပါတယ။ javascript , jquery တ႕က တတကြမးထားတ အခါမာ HTML , CSS တ႕န႕ တညေဆာကတ website ထကပ ျပးေကာငးမြန ေအာင လပလ႕ရလာပါတယ။ ဒါေၾကာင စာအပဖတျပးသြားတ အခါမာ ရပမေနပ အသစသစေတြက ထပမေလလာျပး လပ ေကာငးမြနတ web site ေတြ တညေဆာကႏငၾကပါေစဗာ။

CSS for starter , written by saturngod ( www.saturngod.net )

111