Center an Image

အခု image ကို စာ ရဲ႕ center မွာ ေပၚေအာင္ လုပ္ၾကည့္ပါမယ္။

css မွာ text-center ဆုိတဲ့ class ထပ္ျဖည့္ပါမယ္။

.text-center {
    text-align: center;

index.html ကိုေတာ့ ေအာက္ကလို ေျပာင္းလိုက္မယ္။

    <title>Styling Text</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <h1>One Piece</h1>
    <h2>by Eiichiro Oda</h2>
    <ul class="menu">
        <li><a href="./home.html">Home</a></li>
        <li><a href="./anime.html">Anime</a></li>
        <li><a href="./download.html">Download</a></li>
        <img class='cover' src="onepice_cover.jpg" title="One Piece Cover" width="150px" height="200px" alt="onepice cover">
    <p>One Piece is a Japanese <span class='highlight'>shounen manga series</span> written and illustrated by Eiichiro Oda. It has been serialized in Weekly Shōnen Jump since August 4, 1997; the individual chapters are being published in tankōbon volumes by Shueisha, with the first released on December 24, 1997, and the 70th volume released as of March 2013. </p>
<div class='text-center'><img src="images/luffy.png" class="middle" alt="Luffy" title="Luffy"></div>
    <p>One Piece follows the adventures of <span class='highlight'>Monkey D. Luffy</span>, a young boy whose body gains the properties of rubber after unintentionally eating a Devil Fruit, and his diverse crew of pirates, named the Straw Hat Pirates. Luffy explores the ocean in search of the world's ultimate treasure known as One Piece in order to become the next Pirate King.</p>

အဲဒီ code ထဲမွာ

<div class='text-center'><img src="images/luffy.png" class="middle" alt="Luffy" title="Luffy"></div>

ဆိုတာက div ကို အသံုးျပဳျပီးေတာ့ image ကို text-align:center နဲ႕ အလယ္ကို ပို႕လိုက္တာပါ။ image ကိုသာမက text ေတြကိုလည္း text-align:center ကို သံုးျပီး စာကို အလယ္မွာ ေပၚေအာင္ ဖန္တီးႏုိင္ပါတယ္။ အဲဒီ code ေလးကို ေအာက္ကလို ျမင္ရပါမယ္။

Figure 5-11

Figure 5-11

results matching ""

    No results matching ""