Skip to Content

  • Sign in
    • Home
    • IDE
    • SDK
    • WislyFlux
    • Course
    • Forum
    • About Us
  •   wisly.web77@gmail.com

     
     
  • Contact Us

      • Home
      • IDE
      • SDK
      • WislyFlux
      • Course
      • Forum
      • About Us
    •   wisly.web77@gmail.com

       
       
    • Sign in
    • Contact Us

    Welcome!

    Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

    Sign up

    You need to be registered to interact with the community.
    All Posts People Badges
    About this forum
    You need to be registered to interact with the community.
    All Posts People Badges
    About this forum
    Help

    What is the difference between when should each one be used?

    Subscribe

    Get notified when there's activity on this post

    This question has been flagged
    2 Replies
    6 Views
    Avatar
    Ali

    Why is this a difficult question?

    This question tests more than just memorization. To answer it properly, you need to understand:

    • How the CSS layout flow works.
    • How parent and child elements interact.
    • How positioning behaves during scrolling.
    • Real-world use cases such as navigation bars, tooltips, modals, and dropdown menus.

    Expected Answer Summary:

    • position: relative – The element stays in its normal position but can be moved relative to itself.
    • position: absolute – The element is positioned relative to its nearest positioned ancestor.
    • position: fixed – The element is positioned relative to the browser viewport and stays in place when scrolling.
    • position: sticky – The element behaves like a normal element until a scroll threshold is reached, then it sticks to a specified position.
    • .parent {
    •     position: relative;
    • }
    .child {
        position: absolute;
        top: 10px;
        right: 10px;

    }

    In this example, .child is positioned relative to .parent.

    Why do interviewers ask this question?

    Because many developers can write CSS, but fewer truly understand how positioning works under the hood. A solid understanding of positioning is essential for building responsive and professional web interfaces.

    0
    Avatar
    Discard
    Avatar
    Ali
    Author Best Answer

    Good 

    Allah bless you 


    0

    Subscribe

    Avatar
    Discard
    Avatar
    Founder of Wisly
    Best Answer

    CSS positioning defines how elements are placed on a webpage.

    • relative → Element stays in its normal place but can move relative to itself.
    • absolute → Element is positioned relative to the nearest positioned parent.
    • fixed → Element stays fixed on the screen during scrolling.
    • sticky → Element behaves normally until scrolling reaches a limit, then it sticks
    • .parent {
    •     position: relative;
    • }
    .child {
        position: absolute;
        top: 10px;
        right: 10px;

    }

    Here, .child is positioned relative to .parent.

    0

    Subscribe

    Avatar
    Discard
    Enjoying the discussion? Don't just read, join in!

    Create an account today to enjoy exclusive features and engage with our awesome community!

    Sign up

    What We Offer

    We provide modern eLearning experiences, web development courses, and practical programming education designed to help learners build real-world digital skills. Our platform focuses on interactive learning, hands-on projects, quizzes, achievements, and community growth to help students become confident developers and tech professionals.

    View Course

    © 2026 Wisly. All Rights Reserved.