LaptopGuard AcademyLaptopGuard Academy
  • Kursus Online
    • MODUL

      • LGA Schematic 101
      • Transistor 101
      • Power Regulator & IC’s
      • Kapasitor
      • Resistor
      • Reballing Class
      • Dioda

      Promo

      • BASIC Class
      • ADVANCE Class
      • MASTER Class
  • Blog
  • Program Afiliasi
      • DAFTAR LOGIN

        Connect with:

        Login with Facebook Login with Google

        Login with your site account

        Lost your password?

        Not a member yet? Register now

    • Kursus Online
      • MODUL

        • LGA Schematic 101
        • Transistor 101
        • Power Regulator & IC’s
        • Kapasitor
        • Resistor
        • Reballing Class
        • Dioda

        Promo

        • BASIC Class
        • ADVANCE Class
        • MASTER Class
    • Blog
    • Program Afiliasi
    • Home
    • Positioning

    Positioning

    • Posted by anton
    • Date June 5, 2015

    Positioning

    The CSS positioning properties allow you to position an element. It can also place an element behind another, and specify what should happen when an element’s content is too big.

    Elements can be positioned using the top, bottom, left, and right properties. However, these properties will not work unless the position property is set first. They also work differently depending on the positioning method.

    There are four different positioning methods.


    Static Positioning

    HTML elements are positioned static by default. A static positioned element is always positioned according to the normal flow of the page.

    Static positioned elements are not affected by the top, bottom, left, and right properties.


    Fixed Positioning

    An element with a fixed position is positioned relative to the browser window, and will not move even if the window is scrolled:

    Example

    p.pos_fixed {
        position: fixed;
        top: 30px;
        right: 5px;
    }
    Note Note: IE7 and IE8 support the fixed value only if a !DOCTYPE is specified.

    Fixed positioned elements are removed from the normal flow. The document and other elements behave like the fixed positioned element does not exist.

    Fixed positioned elements can overlap other elements.


    Relative Positioning

    A relative positioned element is positioned relative to its normal position:

    Example

    h2.pos_left {
        position: relative;
        left: -20px;
    }
    
    h2.pos_right {
        position: relative;
        left: 20px;
    }

    The content of relatively positioned elements can be moved and overlap other elements, but the reserved space for the element is still preserved in the normal flow.

    Example

    h2.pos_top {
        position: relative;
        top: -50px;
    }

    Relatively positioned elements are often used as container blocks for absolutely positioned elements.


    Absolute Positioning

    An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is <html>:

    Example

    h2 {
        position: absolute;
        left: 100px;
        top: 150px;
    }

    Absolutely positioned elements are removed from the normal flow. The document and other elements behave like the absolutely positioned element does not exist.

    Absolutely positioned elements can overlap other elements.


    Overlapping Elements

    When elements are positioned outside the normal flow, they can overlap other elements.

    The z-index property specifies the stack order of an element (which element should be placed in front of, or behind, the others).

    An element can have a positive or negative stack order:

    Example

    img {
        position: absolute;
        left: 0px;
        top: 0px;
        z-index: -1;
    }

    An element with greater stack order is always in front of an element with a lower stack order.

    Note Note: If two positioned elements overlap without a z-index specified, the element positioned last in the HTML code will be shown on top.
    • Share:
    anton

    Previous post

    Margins and Paddings
    June 5, 2015

    Next post

    Pseudo-classes
    5 June, 2015

    Search

    Categories

    • Blog
    • Business
    • Design / Branding
    • Uncategorized

    Latest Courses

    Learn Python – Interactive Python Tutorial

    Learn Python – Interactive Python Tutorial

    Rp 69
    Your Complete Guide to Photography

    Your Complete Guide to Photography

    Rp 60
    Learning jQuery Mobile for Beginners

    Learning jQuery Mobile for Beginners

    Rp 30

    Latest Posts

    demo_image
    Why You Should Read Every Day
    20Jan2016
    demo_image
    Relaxing after work
    20Jan2016
    demo_image
    Online Learning Glossary
    20Jan2016
    • About Us
    • Blog
    • Contact
    • Become a Teacher

    LAPTOP GUARD ACADEMY

    Laptop Guard Academy adalah pusat pelatihan laptop yang menghasilkan alumni handal dan memiliki kompetensi yang berkualitas. Dan sekarang kami memiliki kelas online yang dapat diakses dimana saja, kapan saja.

    LaptopGuard Academy

    Jika ada yang ingin berkonsultasi lebih lanjut, silakan kontak langsung melalui akun Facebook saya Maula Hassan
    PS:
    Info tentang pelatihan teknisi laptop silakan hubungi
    081929041569
    085228201684
    BB 3144411b
    Laptopguard.co.id

    Jl. Glagahsari No. 100
    Umbulharjo, D.I. Yogyakarta
    Indonesia, 55164

    +62 274 419927

    academy@laptopguard.co.id

    JADI TEKNISI HANDAL SEKARANG JUGA!
    Daftar GRATIS Sekarang
    • Privacy
    • Terms
    • Sitemap

    Copyright © 2016 LaptopGuard Academy. All rights reserved.

    Made with ♥ in Yogyakarta by Pixld.co.