Align an Image Horizontally

CSS မွာ float ဆုိတဲ့ proptery က image ကို စာရဲ႕ horizontal positioning ခ်ိန္ညိွရာမွာ အသံုးျပဳႏိုင္ပါတယ္။ float အတြက္ left ဆုိရင္ စာေတြဟာ ပံုရဲ႕ ညာဘက္မွာ ေပၚမွာ ျဖစ္ျပီး flat right ဆုိရင္ေတာ့ စာေတြဟာ ဘယ္ဘက္ ေရာက္သြားမယ္။ ေအာက္မွာ style.css ကို ျပင္ထားတာေလး ၾကည့္လုိက္ပါ။

style.css မွာ cover class ကို ထပ္ျဖည့္လိုက္တယ္။

.cover {
    float: right;
    padding-left: 10px;
}

index.html က cover ပံုမွာ css class ျဖည့္လိုက္ပါတယ္။

<img class='cover' src="onepice_cover.jpg" title="One Piece Cover" width="150px" height="200px" alt="onepice cover">

အဲဒီ အခါမွာ ေအာက္ကလို ျမင္ရပါတယ္။

Figure 5-9

Figure 5-9

ပံုဟာ ညာဘက္ အျခမ္းကပ္သြားျပီး စာသားနဲ႕ padding 10px ခြာထားပါတယ္။

results matching ""

    No results matching ""