CSS waddo waren.. position problem

nfs

Well-known member
  • Mar 29, 2009
    1,638
    76
    48
    ඇයි එන්නද??
    machan CSS wala

    position:relative;

    kiyala dana ekei

    position:absolute;

    kiyala dena ekei wenasa mokak da? :eek::eek:


    mekai ban seen eka.

    2m484mf.png


    machan mama H kiyana block ekata position:absolute; kiyala dammama oya 1st pic eke thiyena widihatai enne, eth mama e position:absolute kiyana eka position:relative; kiyala wenas karama menna me widihata (2 weni pic eke) widihata enawa. mata balanna oni relative eka baluwe kage idanda kiyala


    vi0dg2.jpg



    menna code ekath,

    stylesheet eka

    HTML:
     background-color:red;
     position:absolute;
     top:330px;
     left:680px;
    }
    
    #g
    {width:150px;
     height:150px;
     background-color:red;
     position:absolute;
     top:490px;
     left:680px;
    }
    
    #h
    {width:500px;
     height:100px;
     background-color:red;
     position:relative;
     left:170px;
     top:780px;
    }
    html file eka

    HTML:
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <title></title>
    
        <link rel="stylesheet" type="text/css" href="TextFile1.css" />
    
    
    </head>
    <body>
    
        <div id="a"></div>
        <div id="b"></div>
        <div id="c"></div>
        <div id="d"></div>
        <div id="e"></div>
        <div id="f"></div>
        <div id="g"></div>
        <div id="h"></div>
    
    
    
    
    </body>
    
    
    
    </html>
     
    Last edited:

    BruceWayne92

    Well-known member
  • Oct 8, 2013
    12,190
    1
    13,074
    113
    Gotham City
    machan CSS wala

    position:relative;

    kiyala dana ekei

    position:absolute;

    kiyala dena ekei wenasa mokak da? :eek::eek:
    මට තේරෙන විදියට නම් relative position එක කියන්නේ අදාළ එලමන්ට් එක ඒ එලමන්ට් එකේ සාමන්‍ය ස්ථානයට( එහෙම නැත්තම් ඔරිජිනල් ස්ථානය ...ehema නැත්තම් HTML Element එක කිසිම මොඩිෆිකේශන් එකකින් තොරව පවතින ස්ථානය )සාපෙක්ෂව වෙනස් කරන ස්තානය .

    …Absolute position eka කියන්නේ එහෙම කිසිම සාපේක්ෂ බවක් නැහ .ඒ කියන්නේ අදාළ එලමන්ට් එකක ස්ථානය වෙනස් කරන්න අගයන් යොදා ස්ථානය වෙනස් වෙන්නේ ඒ එලමන්ට් එක කිසිම මොඩිෆිකේෂන් එකකින් තොරව පවතින ස්ථානයට අනුව නෙමේ .ea කියන්නේ මුල් ස්ථානයේ බල පෑමක් නැහැ
     
    Last edited:
    • Like
    Reactions: nfs

    nfs

    Well-known member
  • Mar 29, 2009
    1,638
    76
    48
    ඇයි එන්නද??
    මට තේරෙන විදියට නම් relative position එක කියන්නේ අදාළ එලමන්ට් එක ඒ එලමන්ට් එකේ සාමන්‍ය ස්ථානයට( එහෙම නැත්තම් ඔරිජිනල් ස්ථානය ...ehema නැත්තම් HTML Element එක කිසිම මොඩිෆිකේශන් එකකින් තොරව පවතින ස්ථානය )සාපෙක්ෂව වෙනස් කරන ස්තානය .

    …Absolute position eka කියන්නේ එහෙම කිසිම සාපේක්ෂ බවක් නැහ .ඒ කියන්නේ අදාළ එලමන්ට් එකක ස්ථානය වෙනස් කරන්න අගයන් යොදා ස්ථානය වෙනස් වෙන්නේ ඒ එලමන්ට් එක කිසිම මොඩිෆිකේෂන් එකකින් තොරව පවතින ස්ථානයට අනුව නෙමේ .ea කියන්නේ මුල් ස්ථානයේ බල පෑමක් නැහැ


    position:relative වල,
    ඒ එලමන්ට් එකේ "සාමන්‍ය ස්ථානය"
    කියලා කිව්වේ මොකක් ගැනද?
     

    nfs

    Well-known member
  • Mar 29, 2009
    1,638
    76
    48
    ඇයි එන්නද??

    Ayeshlive

    Well-known member
  • Jul 1, 2011
    10,570
    943
    113
    *̶͑̾̾​̅ͫ͏̙̤g͛͆̾ͫ̑͆&
    Position: absolute elements position wenne parent position:relative element eke left top corner ekata wenna. e position:relative element eka athule position:absolute elements keeyak thibunath e okkoma ekak uda ekak widihata thamai set wenne. position:relative thamai normal behavior eka. elements ekak uda ekak yanne na.

    position:absolute elements wala order eke set wenne z-index property eken. z-index:1 element ekata udin z-index:L 5 element eka place wenawa, likewise.
     

    nfs

    Well-known member
  • Mar 29, 2009
    1,638
    76
    48
    ඇයි එන්නද??
    Position: absolute elements position wenne parent position:relative element eke left top corner ekata wenna. e position:relative element eka athule position:absolute elements keeyak thibunath e okkoma ekak uda ekak widihata thamai set wenne. position:relative thamai normal behavior eka. elements ekak uda ekak yanne na.

    position:absolute elements wala order eke set wenne z-index property eken. z-index:1 element ekata udin z-index:L 5 element eka place wenawa, likewise.

    machan post eka update kara. tikak eka balanna puluwanda?
     

    M E T H

    Active member
  • Oct 23, 2013
    647
    48
    28
    Position: absolute elements position wenne parent position:relative element eke left top corner ekata wenna. e position:relative element eka athule position:absolute elements keeyak thibunath e okkoma ekak uda ekak widihata thamai set wenne. position:relative thamai normal behavior eka. elements ekak uda ekak yanne na.

    position:absolute elements wala order eke set wenne z-index property eken. z-index:1 element ekata udin z-index:L 5 element eka place wenawa, likewise.

    මේ කියල දීල තියෙන්නේ ලස්සනට...:yes::cool:
     

    M E T H

    Active member
  • Oct 23, 2013
    647
    48
    28
    මට බන් ඕක සිංහලෙන් කොටල පැහැදිලි කරල දෙන්න අමාරුයි... :oo::baffled: මම පොඩි කෝඩ් කෑල්ලක් ගැහැව මේකේ තියෙන වෙනස්කම් තේරුම් අරන් මේක තේරුම් ගන්න බලපන්.. උබ පිංතූර දාල දෙයක් ඉගෙන ගන්න කැපවීමෙන් දඟලන විදිය දැකපු නිසයි මේක දාන්නනේ.. :D:yes:

    Code:
    <html>
    <head>
    <style>
    .float_left{float:left}
    .common_width_n_height{ width:200px; height:200px; background:red; position:relative;}
    #wrapper { width:600px; height:auto; background:green}
    .small_box{ width:50px; height:50px; [COLOR="Red"]position:relative;[/COLOR] background:blue;}
    
    .left_top{ left:0; top:0}
    .left_bottom{ left:0; bottom:0}
    .right_top{ right:0; top:0}
    .right_bottom{ right:0; bottom:0}
    </style>
    </head>
    
    <body>
    
    <div id="wrapper" class="float_left">
    <div class="common_width_n_height float_left"></div>
    <div class="common_width_n_height float_left"></div>
    <div class="common_width_n_height float_left">
    	<div class="small_box left_top"></div>
        <div class="small_box left_bottom"></div>
        <div class="small_box right_top"></div>
        <div class="small_box right_bottom"></div>
    </div>
    </div>
    
    </body>
    </html>

    --------------------

    Code:
    <html>
    <head>
    <style>
    .float_left{float:left}
    .common_width_n_height{ width:200px; height:200px; background:red; position:relative;}
    #wrapper { width:600px; height:auto; background:green}
    .small_box{ width:50px; height:50px; [COLOR="Red"]position:absolute;[/COLOR] background:blue;}
    
    .left_top{ left:0; top:0}
    .left_bottom{ left:0; bottom:0}
    .right_top{ right:0; top:0}
    .right_bottom{ right:0; bottom:0}
    </style>
    </head>
    
    <body>
    
    <div id="wrapper" class="float_left">
    <div class="common_width_n_height float_left"></div>
    <div class="common_width_n_height float_left"></div>
    <div class="common_width_n_height float_left">
    	<div class="small_box left_top"></div>
        <div class="small_box left_bottom"></div>
        <div class="small_box right_top"></div>
        <div class="small_box right_bottom"></div>
    </div>
    </div>
    
    </body>
    </html>

    ඔය රතුපාටින් හයිලයිට් කරපු එකේ වෙනස් කම මත වෙන වෙනස අනුව ඔය දේ තේරුම් ගනින්...:D
     
    • Like
    Reactions: nfs

    BruceWayne92

    Well-known member
  • Oct 8, 2013
    12,190
    1
    13,074
    113
    Gotham City
    position:relative වල,
    ඒ එලමන්ට් එකේ "සාමන්‍ය ස්ථානය"
    කියලා කිව්වේ මොකක් ගැනද?
    ඒ කිව්වේ උඹ අපි හිතමු .Header (h1,h2,h3,etc...)එකක් හැදුව කියමු .ඒ හෙඩර් එක තියෙන HTML ෆිලෙ එක නොමල් රන් කරපුවහම බ්‍රව්සර් එකේ දි ඒ හෙඩර් ekea ලියලා තියෙන දේ පේනවනේ .අන්න් ඒ පේන ස්ථානය තමා සාමන්‍ය් ස්ථානය කියන්නේ :yes::yes::yes::yes:
    මේ කොඩ් එක ගැන හිතන්න ....
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    
    
    
    <body>
    <h2>This is a heading with an absolute position</h2>
    
    </body>
    
    </html>

    මේ කෝඩ් එක රන් කරාහාම එන අවුට් පුට් එකෙන් ලැබෙනවානේ හෙඩර් එකට ස්ථානයක් .අන්න ඒ ස්ථානය තමා සාමාන්‍ය ස්ථානය කියන්නේ
    :yes::yes::yes::yes::yes::yes:
     
    Aug 2, 2009
    31,526
    1,506
    0
    Good bye machan
    දන්න විදියට කියන්නම්. සමහර විට වැරදි ඇති.

    අපි පේජ් එකක් ඩිසයින් කරද්දි මුලින් මේන් div එකක් දාගන්නවනෙ.
    ඒක ඇතුලෙනෙ දාන සෙල්ලං දාන්නෙ.

    ඔය වගේ හැම එන div එකක් ඇතුලෙම තව ඕන තරං div දාගන්න පුලුවන්.

    Relative කියන්නෙ අපි ඒ ගත්ත div එක ඊට පිටින් තියන parent div එකේ හැසිරීමට relatively වෙනස් වෙන විදියට දාන එක.

    Absolute කියන්නෙ Regardless of the parent div අපිට ඕනෙ div එක අපිට ඕනෙ විදියට තියාගන්න එක.

    ඒ ඒ අවස්ථාවට හරි යන විදියට ඒක යොදාගන්න ඕනෙ.

    Responsive design එකක් නම් ගොඩක් දුරට Relative තමා ගන්න ඕනෙ. :yes:
     
    • Like
    Reactions: nfs

    nfs

    Well-known member
  • Mar 29, 2009
    1,638
    76
    48
    ඇයි එන්නද??

    මේ කියල දීල තියෙන්නේ ලස්සනට...:yes::cool:

    මට බන් ඕක සිංහලෙන් කොටල පැහැදිලි කරල දෙන්න අමාරුයි... :oo::baffled: මම පොඩි කෝඩ් කෑල්ලක් ගැහැව මේකේ තියෙන වෙනස්කම් තේරුම් අරන් මේක තේරුම් ගන්න බලපන්.. උබ පිංතූර දාල දෙයක් ඉගෙන ගන්න කැපවීමෙන් දඟලන විදිය දැකපු නිසයි මේක දාන්නනේ.. :D:yes:

    Code:
    <html>
    <head>
    <style>
    .float_left{float:left}
    .common_width_n_height{ width:200px; height:200px; background:red; position:relative;}
    #wrapper { width:600px; height:auto; background:green}
    .small_box{ width:50px; height:50px; [COLOR=Red]position:relative;[/COLOR] background:blue;}
    
    .left_top{ left:0; top:0}
    .left_bottom{ left:0; bottom:0}
    .right_top{ right:0; top:0}
    .right_bottom{ right:0; bottom:0}
    </style>
    </head>
    
    <body>
    
    <div id="wrapper" class="float_left">
    <div class="common_width_n_height float_left"></div>
    <div class="common_width_n_height float_left"></div>
    <div class="common_width_n_height float_left">
        <div class="small_box left_top"></div>
        <div class="small_box left_bottom"></div>
        <div class="small_box right_top"></div>
        <div class="small_box right_bottom"></div>
    </div>
    </div>
    
    </body>
    </html>
    --------------------

    Code:
    <html>
    <head>
    <style>
    .float_left{float:left}
    .common_width_n_height{ width:200px; height:200px; background:red; position:relative;}
    #wrapper { width:600px; height:auto; background:green}
    .small_box{ width:50px; height:50px; [COLOR=Red]position:absolute;[/COLOR] background:blue;}
    
    .left_top{ left:0; top:0}
    .left_bottom{ left:0; bottom:0}
    .right_top{ right:0; top:0}
    .right_bottom{ right:0; bottom:0}
    </style>
    </head>
    
    <body>
    
    <div id="wrapper" class="float_left">
    <div class="common_width_n_height float_left"></div>
    <div class="common_width_n_height float_left"></div>
    <div class="common_width_n_height float_left">
        <div class="small_box left_top"></div>
        <div class="small_box left_bottom"></div>
        <div class="small_box right_top"></div>
        <div class="small_box right_bottom"></div>
    </div>
    </div>
    
    </body>
    </html>
    ඔය රතුපාටින් හයිලයිට් කරපු එකේ වෙනස් කම මත වෙන වෙනස අනුව ඔය දේ තේරුම් ගනින්...:D

    thanks machan.. wade goda..... :D
    ඒ කිව්වේ උඹ අපි හිතමු .Header (h1,h2,h3,etc...)එකක් හැදුව කියමු .ඒ හෙඩර් එක තියෙන HTML ෆිලෙ එක නොමල් රන් කරපුවහම බ්‍රව්සර් එකේ දි ඒ හෙඩර් ekea ලියලා තියෙන දේ පේනවනේ .අන්න් ඒ පේන ස්ථානය තමා සාමන්‍ය් ස්ථානය කියන්නේ :yes::yes::yes::yes:
    මේ කොඩ් එක ගැන හිතන්න ....
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    
    
    
    <body>
    <h2>This is a heading with an absolute position</h2>
    
    </body>
    
    </html>

    මේ කෝඩ් එක රන් කරාහාම එන අවුට් පුට් එකෙන් ලැබෙනවානේ හෙඩර් එකට ස්ථානයක් .අන්න ඒ ස්ථානය තමා සාමාන්‍ය ස්ථානය කියන්නේ
    :yes::yes::yes::yes::yes::yes:

    thanks machan... elakiri.. :D


    පැටියා;15977721 said:
    දන්න විදියට කියන්නම්. සමහර විට වැරදි ඇති.

    අපි පේජ් එකක් ඩිසයින් කරද්දි මුලින් මේන් div එකක් දාගන්නවනෙ.
    ඒක ඇතුලෙනෙ දාන සෙල්ලං දාන්නෙ.

    ඔය වගේ හැම එන div එකක් ඇතුලෙම තව ඕන තරං div දාගන්න පුලුවන්.

    Relative කියන්නෙ අපි ඒ ගත්ත div එක ඊට පිටින් තියන parent div එකේ හැසිරීමට relatively වෙනස් වෙන විදියට දාන එක.

    Absolute කියන්නෙ Regardless of the parent div අපිට ඕනෙ div එක අපිට ඕනෙ විදියට තියාගන්න එක.

    ඒ ඒ අවස්ථාවට හරි යන විදියට ඒක යොදාගන්න ඕනෙ.

    Responsive design එකක් නම් ගොඩක් දුරට Relative තමා ගන්න ඕනෙ. :yes:

    thanks machan... :yes: :D

    relative kiyanne mokakhari element ekakata sapekshawa.
    absolute kiyanne margin eke indan..
    wenna ona..:P
    thanks machan...


    Position: absolute elements position wenne parent position:relative element eke left top corner ekata wenna. e position:relative element eka athule position:absolute elements keeyak thibunath e okkoma ekak uda ekak widihata thamai set wenne. position:relative thamai normal behavior eka. elements ekak uda ekak yanne na.

    position:absolute elements wala order eke set wenne z-index property eken. z-index:1 element ekata udin z-index:L 5 element eka place wenawa, likewise.

    thanks machan...... :D


    thanks wewa...... :D

    මට තේරෙන විදියට නම් relative position එක කියන්නේ අදාළ එලමන්ට් එක ඒ එලමන්ට් එකේ සාමන්‍ය ස්ථානයට( එහෙම නැත්තම් ඔරිජිනල් ස්ථානය ...ehema නැත්තම් HTML Element එක කිසිම මොඩිෆිකේශන් එකකින් තොරව පවතින ස්ථානය )සාපෙක්ෂව වෙනස් කරන ස්තානය .

    …Absolute position eka කියන්නේ එහෙම කිසිම සාපේක්ෂ බවක් නැහ .ඒ කියන්නේ අදාළ එලමන්ට් එකක ස්ථානය වෙනස් කරන්න අගයන් යොදා ස්ථානය වෙනස් වෙන්නේ ඒ එලමන්ට් එක කිසිම මොඩිෆිකේෂන් එකකින් තොරව පවතින ස්ථානයට අනුව නෙමේ .ea කියන්නේ මුල් ස්ථානයේ බල පෑමක් නැහැ
    aha.. ela machan....... :)


    ela... :yes:
     

    NO_MeRcY

    Well-known member
  • Jun 14, 2010
    5,423
    449
    83
    Singapore
    සරළවම කිව්වොත්

    Relative එකේ දි වෙන්නේ උබ css මුලින් කරන්න කලින් ඒ element එක තිබ් බ Position එකට සාපේක්ශව තමයි style කරද්දි element එක move වෙන්නේ. එ කියන්නෙ උබ <div> එකක් Relative දාල style කලොත්. මුලින් දැම්ම <div> එකම මුලින් තිබ්බ තැන ඉදන් තමයි move වෙන්නේ

    Absolute එකේදි ඒ element එක අලුතෙන් place කරනවා උබ කරන style එකට අනුව. මුල් Position එකට සාපෙක්ශව move වෙන්නේ නෑ.

    example ටිකක් කරල බලපන් මල්ලී. උබට තේරේවි

    meka balapan mallie http://www.barelyfitz.com/screencast/html-training/css/positioning/
     

    nfs

    Well-known member
  • Mar 29, 2009
    1,638
    76
    48
    ඇයි එන්නද??

    thanks..
    සරළවම කිව්වොත්

    Relative එකේ දි වෙන්නේ උබ css මුලින් කරන්න කලින් ඒ element එක තිබ් බ Position එකට සාපේක්ශව තමයි style කරද්දි element එක move වෙන්නේ. එ කියන්නෙ උබ <div> එකක් Relative දාල style කලොත්. මුලින් දැම්ම <div> එකම මුලින් තිබ්බ තැන ඉදන් තමයි move වෙන්නේ

    Absolute එකේදි ඒ element එක අලුතෙන් place කරනවා උබ කරන style එකට අනුව. මුල් Position එකට සාපෙක්ශව move වෙන්නේ නෑ.

    example ටිකක් කරල බලපන් මල්ලී. උබට තේරේවි

    meka balapan mallie http://www.barelyfitz.com/screencast/html-training/css/positioning/

    thanks machan.. elazzz :D