CSS Tutorial: Position absolute, relative, fixed and sticky in CSS | Web Development Tutorials #25

Поделиться
HTML-код
  • Опубликовано: 1 фев 2025

Комментарии • 797

  • @julurisaichandu5844
    @julurisaichandu5844 4 года назад +1211

    For those who are searching for fixed and sticky difference:
    Fixed and sticky are both similar, but
    If you make a particular element inside a container as fixed, then irrespective of container height, as we scroll, the element stays at the same position till you scroll to end of web page.
    If you make an element as sticky and if its inside a container, then as you scroll, the element will be in the same position until the container height. While scrolling, if the container is also scrolled down, then the sticky element in the container will also move top with container.
    i.e., sticky will be fixed only till the end of the container, But fixed will be fixed until the end of web page.

    • @anshulagarwal4445
      @anshulagarwal4445 4 года назад +14

      In sticky, I was unable to use right, left alignment of box as can be used in fixed.

    • @abhisheksrivastav1706
      @abhisheksrivastav1706 4 года назад +66

      Good job 👍 i came to the comment box only see differences between fixed and sticky and i got it.
      I was 1000% sure that I'll get answer in comment box.
      Thanks buddy 🙂

    • @Anonymous-vr1hj
      @Anonymous-vr1hj 4 года назад +1

      @@anshulagarwal4445 same with me bro

    • @kaafideepak
      @kaafideepak 3 года назад +17

      also, sticky occupies space in the website unlike fixed. So sticky will not cover any other element of the website like fixed. The elements will simply show after it even when you scroll while in case of fixed they will get hidden behind it.

    • @abdulsamadkhan9031
      @abdulsamadkhan9031 3 года назад +3

      Appreciated

  • @sheetaljain4288
    @sheetaljain4288 4 года назад +47

    When you were saying, while writing reference as notes for all the positions, "pahle dekh lete hai kya hai static ". I was getting that this is called best pedagogy. As bro you know, in India, teachers first give reference and then take tests and say to rote and write about. I am an BCA 5th semester student. In my graduation I got to know that why is Indian graduates wet behind the years even if having graduation degree.
    Thanks Brother what are teaching has 25000 rupees cost in market. Student like me, who don't have financial asistance, really thankful to all of you. May god fulfill your all wishes as you are making fill of other.

  • @thrilleracaste400
    @thrilleracaste400 3 года назад +66

    After all the research I did, I can now finally conclude that this playlist is the best playlist for the web development course. Thanks Harry bhai!❤️

  • @algalg4359
    @algalg4359 4 года назад +28

    Tutorial 25th Completed and now the time to create a website in the video!
    Hope that everybody has created their websites!
    Tqsm Harry Bhaiya!

  • @noorulain5093
    @noorulain5093 9 месяцев назад +8

    6:19 Here is the thing that i want to highlight . Since there are no other elements in this webpage therefore it seems that on adding parent div, now div 3 is positioned relative to parent div. But that is not the case. Div 3 is still positioned relative to parent body tag. Later on when we will be adding other elements in this webpage we will realise that its not positioned relative to its parent div but to its parent body.
    The more precise defination of absolute position is "An element with position: absolute; is positioned relative to the closest ancestor 𝐭𝐡𝐚𝐭 𝐡𝐚𝐬 𝐚 𝐩𝐨𝐬𝐢𝐭𝐢𝐨𝐧𝐞𝐝 𝐩𝐫𝐨𝐩𝐞𝐫𝐭𝐲 𝐨𝐭𝐡𝐞𝐫 𝐭𝐡𝐚𝐧 𝐬𝐭𝐚𝐭𝐢𝐜. If none of its ancestors have a positioned property (i.e., position: static;, which is the default), then it will be positioned relative to the element, or the viewport if no element is present."
    So if we want div 3 to be positioned relative to its parent div (absolute position) then we need to make parent div a positioned element
    .container {
    position :relative; }
    this position :relative; alone will not have any effect on the position of parent div (since we have not defined values of top,right,bottom or left property) but will still make parent div a positioned element.

  • @aryan_raj_07
    @aryan_raj_07 Год назад +9

    I honestly love the fact that people in the comment section also try to help each other to learn and grow. Together we are not only learning but also creating a good community. ❤✨

  • @Dhiman_20
    @Dhiman_20 Год назад +6

    The way he said we are legends because we go live on vs code has made me feel delightful

  • @utkarshpatil3180
    @utkarshpatil3180 2 года назад +34

    2:25 position property, 4:20 top/left/bottom/right, 5:00 note, 8:20 9:29 position: fixed , 11:38 sticky, 12:57 website design

  • @developerninja5011
    @developerninja5011 4 года назад +45

    i am your big fan sir....someone told me that adsense pay to only those which adds are not skiiped. thats why i watch full adds so that i can pay for what you gave us .
    thankyou sir @codewithharry

    • @bharatmishra250
      @bharatmishra250 4 года назад

      He is a mimic artist too 😂😂😂 visit (Hindi gaming zone)

    • @shauryakumar5421
      @shauryakumar5421 3 года назад

      @@bharatmishra250 yes bro he is amazing

  • @boyapatiramakrishna2068
    @boyapatiramakrishna2068 4 года назад +9

    Thank you brother. I searched a lot in youtube to understand relative and absolute positions, But I couldn't understand much. But, in this video I could understand so clearly. Now I have no doubts about relative and absolute positions
    Thank you verymuch brother. From Hyderabad, TS.

  • @shridhar6053
    @shridhar6053 Год назад +11

    The main difference is that a "sticky" element behaves as "relative" until a specific scroll threshold is reached, after which it becomes "fixed" relative to its container. Meanwhile, a "fixed" element remains in the same position on the viewport, regardless of scrolling..
    Hope that helps ❤.

  • @arbajbhai5108
    @arbajbhai5108 2 года назад +2

    I think all you tuber are good but for me harry sir is best because he explained in simple way because most of people are not from computer field they begginer s
    And other you tuber are good but they explain good but I don't understand some topic of them because they say ki ye to wese hi hojayega easy h are bhai hme nhi ata explain in step by step bhai hmara background computer se nhi tha hme thoda time lagega but Harry sir is good teacher for me !

  • @shree4641
    @shree4641 2 года назад

    You are the best…Hindi me dekhe huye videos humesha yaad rehte hai, Thank you Hindi me videos banane ke liye.
    Maine bahut books aur course bhi kiye the css par…lekin position kabhi clearly samjhme hi nhi aaya.
    Aapke video se aasani se samjh gai.. Thanks a lot.

  • @bhau1843
    @bhau1843 Год назад +4

    2:25 position properties
    3:36 position: absolute, relative
    5:00 uses of relative and absolute
    8:20 position:sticky

  • @sakshigoyal65
    @sakshigoyal65 3 года назад +20

    if anyone use position:absolute and you want to change its position relative to your parent element make sure u use position:relative in parent element and in child parent:absolute unless it wont work as the child element will take its position relative to body not relative to its parent

    • @umarjanbhat3819
      @umarjanbhat3819 2 года назад +1

      It takes relative to html tag or may be browser window. Body is also static by default.

    • @babitatiwari1745
      @babitatiwari1745 2 года назад

      Thankyou sooo much🥺...I was dwelling over it for the past 3-4 days and now I get it...Harry should have explained it...😗

    • @amit_pawar_9111
      @amit_pawar_9111 Год назад

      Exactly, I was going to post the same thing here

  • @muskansingh6948
    @muskansingh6948 2 года назад +3

    Your line keyboard toot jaega mere tezz maarne se meko apni ye aadat sudharni chahiye ye sun ke suddenly meko hasii aa gyi padhte padhte nyc yr your videos such a magic for us ❤️❤️❤️❤️❤️❤️

  • @riyadhossain1706
    @riyadhossain1706 3 года назад +2

    Oww, he didn't even subscribe to his own channel. Really cool.😎😎
    This proves he actually want real subscribers. Much appreciated.
    Love from Bangladesh ❤❤❤❤

    • @Husshar_Ladka
      @Husshar_Ladka 2 года назад +2

      Bro sign in nahi kiya tha
      Subscribe karne ke liye sign in karna padta hai...

  • @muhammadjawad6632
    @muhammadjawad6632 2 года назад +1

    Thanks harry Bhai (that's work for me)
    position: absolute
    top:039px;

  • @ummi7292
    @ummi7292 2 года назад

    Thanks!

  • @saisuryamuddalapuram6252
    @saisuryamuddalapuram6252 4 года назад +7

    Baiah am following every tut and practicing and listening all ur suggestions and all and I'll prepare a web site as u said to prepare good task given ...and am sharing wd all my friends who what to learn these Web-Development ....love from Andhra bro ...keep going lots of support 😊😊👍👍

    • @shahed3056
      @shahed3056 3 года назад

      Bro did you complete this playlist? How is your experience?? Please share

    • @lesicss
      @lesicss Год назад

      @@shahed3056 amazing experience

  • @mohduzair6392
    @mohduzair6392 3 года назад +6

    Element with position absolute is relative to the nearest positioned ancestor ( i.e. ancestor whose position is set to relative, absolute, fixed or sticky ). If there is no positioned ancestor then it will be relative to the body.

  • @dhruvchoudhary7966
    @dhruvchoudhary7966 3 года назад +1

    sir itni achche se toh aaj tk kisi ne hi sikhaaya, you have done a great work and i admire your work, thanks a lot for these videos

  • @desiguy5508
    @desiguy5508 2 года назад

    You have an amazing way of explaining things. I read so many blogs, but couldn't understand positioning in CSS properly. When I saw your videos everything is crystal clear. Thank you so much.

  • @mstechi3524
    @mstechi3524 2 года назад

    Apki Typing aur Apki Keyboard chalane ki technique ko to dag Deni padegi... Super Harry Bhai..

  • @musicaltandav505
    @musicaltandav505 Год назад +1

    I love your teaching, I am now learning my passion of programing through your vids and i am 13 years old

  • @adtex02
    @adtex02 3 года назад +143

    I see how he got into IIT , he seems very hard working. The thing that most non-IITians miss is only hardwork....

    • @saarza9991
      @saarza9991 Год назад +24

      Very judgemental. Those who didn't make it into IITs are not hardworking? Maybe they are like me, who couldn't afford coaching. I studied by myself and scored 90%, missed cutoff just by .7%

    • @Emotekofficial
      @Emotekofficial Год назад +16

      Well inversely I have seen people ibeing IITians but not that sharp, and People who are sharp but not IITians. A degree is a tag. Curiosity, Research and Knowledge is the weapon.

    • @edward-soli
      @edward-soli Год назад +3

      ​@saarza9991
      Correctly said bro,
      This is the story of every average student but I am below that level 😢

    • @kiddoinblack
      @kiddoinblack Год назад

      ​@@saarza9991u need some great respect... (It that's true)

    • @Ji_zooz
      @Ji_zooz 11 месяцев назад +1

      ​@@Emotekofficial well said but degree and skills both mattr brother:)

  • @siddhantjaiswal4231
    @siddhantjaiswal4231 4 года назад +36

    There's a mistake i think-
    The container class has to be styled as position:relative. Only then its children will be positioned(with absolute) relative to .container class.

    • @demonboy2693
      @demonboy2693 4 года назад +5

      I think he missed this part.
      if i didnt knew about this already, i would be confused,
      I hope he sees this comment.

    • @paramjotsingh8406
      @paramjotsingh8406 2 года назад +4

      YES!! I was wondering the same thing... @CodeWithHarry please look into this... Position absolute will position the element to the nearest parent which was previously "positioned". If no "position" is defined to any parent element before the "absolute" element (the child) will the relative to "body". top, right, bottom, left will place the absolute child element IN RELATIVE TO THE BODY.

    • @umarjanbhat3819
      @umarjanbhat3819 2 года назад +3

      @@paramjotsingh8406 not to the body. Body is static as well. I checked it takes HTML tag as reference.

    • @umarjanbhat3819
      @umarjanbhat3819 2 года назад

      Main thing in this topic to understand.

    • @GULLAPUDILIKITHBCE
      @GULLAPUDILIKITHBCE 2 года назад

      really thanks have the same doubt
      so what you told is absolute is not based on parent element rather than relative parent element .

  • @sweetybaghwar2367
    @sweetybaghwar2367 5 месяцев назад

    Very simple, neat, clean presentation. Good work. Bohot acche se smajh aa gya. Thank you very much for this video.

  • @sharayumalokar8591
    @sharayumalokar8591 Год назад

    aapne abati hui chije dimag me ek baar hi me chhap jati hai. thank you............

  • @MC-Smug
    @MC-Smug Год назад +1

    for those who not understand sticky and fixed : in short sticky is the alt for relative and fixed is the alternate for absolute

  • @sktamim_01
    @sktamim_01 4 года назад +2

    I'm very thankful to you sir.
    I learned many of things from your video.Thanks for giving us so much for free.
    may god bless you.
    Sir You are great.

  • @In_short_video
    @In_short_video 3 года назад +1

    Is serries ki css m relatively sabse achi video 👍❤️👌

  • @glorysingh
    @glorysingh 3 года назад

    the way you say 'I will see you next time' is awesome 😊❤️

  • @dpvlogs0921
    @dpvlogs0921 3 года назад +4

    Position absolute, relative, fixed and sticky are used for placing and making things where they supposed to be.

  • @shaikyaseenyaseen7692
    @shaikyaseenyaseen7692 Год назад

    a very excellent and talented trainer for all the courses this the best course am learning thank you soo much sir

  • @AhsanRaza-tg5xg
    @AhsanRaza-tg5xg 5 лет назад +1

    Thank you harry bhai love u mujhe boht faida ho ra hai apke tutorials se

  • @Vishal-nb2lx
    @Vishal-nb2lx 2 года назад +1

    A sticky element toggles between relative and fixed , depending on the scroll position. It is positioned relative until a given offset position is met in the viewport - then it "sticks" in place (like position:fixed).

    • @anandshete9170
      @anandshete9170 2 года назад

      W3 schools ha kamla hai babu bhiya aur kuch nhi

  • @raghavgupta3168
    @raghavgupta3168 5 лет назад +5

    Thank You Harry bhai for this amazing video. This video has cleared many of my doubts related to position.
    But Sir, Could you please tell in a more good way that What is the difference b/w Fixed and Sticky Position.

  • @SureshKumar-qx6vh
    @SureshKumar-qx6vh 3 года назад

    Your hindi classes more and more relatively me absolute super. Nice👌👌

  • @omsaimohapatra8171
    @omsaimohapatra8171 3 года назад

    Oho wowwwwwwwww best line ever hum legends hai hum vs code mein live jaate hein insta mein nai.

  • @bishalbhowmik7626
    @bishalbhowmik7626 3 года назад +1

    Sir, your teaching method is very informative and easy to understand.

  • @anfalkhan7063
    @anfalkhan7063 2 года назад

    Thanks Harry bro love from Pakistan
    It helps me alot as a begginer😍

  • @Piyush_Sharma--
    @Piyush_Sharma-- Год назад

    Harry bhai mujhe tumhari display properties wali video samajh me nahi aayi mene kahi or se sikhli and you are telling your thought we are legends we don't go live on insta or facebook 😅😅😅😅. Nice line...

  • @ronycb7168
    @ronycb7168 Год назад

    Actually need to set the position of container to relative first (dont know why only relative yet, absolute causes weirdness) for this to work properly otherwise it will use body as the positioned parent... tried it with four containers and 16 boxes total..
    plz keep this comment it would be useful for my future reference... Thanks for the awsm series.. I will soon start following the new webdev series also thanks for the free lesson helps me get practice.. TY🤩

  • @iammature7044
    @iammature7044 4 года назад

    Thanks sir for free such course i think learning from online and having such good teacher is the best and fastest way to learn it.

  • @adityakushwaha980
    @adityakushwaha980 4 года назад +58

    best line 😂😂 "Relative means "Ristedar"😂♥

  • @Israr_Memon
    @Israr_Memon Год назад

    I was watching Angela Yu Course and the positioning concept wasn't clearly explained their came here and understood it thanks

  • @amitbirajdar3613
    @amitbirajdar3613 Год назад +1

    Sir Again I started #Day 2/100
    Thak you so much

  • @krishnagupta4847
    @krishnagupta4847 4 года назад

    Very very thanks Harry bhai, mai aapni zindagi badal raha hu aapakai kirpaya sai

  • @iamaniketkr
    @iamaniketkr 4 года назад +2

    Superb explanation in JS, Thankyou Harry 😊♥️

  • @ManishKumar-vj9nb
    @ManishKumar-vj9nb 2 года назад

    WAY OF TEACHING OUTSTANDING 🤩🤩👍👍

  • @Ajit_For_You
    @Ajit_For_You 3 года назад +1

    Thanks bro one day you will being a legend for the world ❤️🔥👍

  • @KashifAli-yg6yk
    @KashifAli-yg6yk 3 года назад +5

    1:42 feasible, sir Well played 😄💙

  • @muhammadadil-or3kb
    @muhammadadil-or3kb 2 года назад

    great harry you are one of the best in the world

  • @sushankhyachapagain788
    @sushankhyachapagain788 3 года назад

    Best Course on Web Development.

  • @movieshub-y2q
    @movieshub-y2q 2 года назад

    best teacher i ever seen😍😍😍😍🥰🥰😘😘🥰🥰😘😘😘😘

  • @neerajsinghtangariya2587
    @neerajsinghtangariya2587 5 лет назад

    Thanks harry bhai...for this video...
    jo m search krna chaa rha tha wo issme easily mil gya...
    Thanks again..:)

  • @royalflames6533
    @royalflames6533 5 месяцев назад +2

    13:50 for website design information

  • @hrithiksethi4257
    @hrithiksethi4257 Год назад

    the 'fixed' position sets the position of the HTML elements according to the viewport( Screen display area )
    the 'sticky' position sets the position according to the parent element

  • @Ahmad_Editz1
    @Ahmad_Editz1 2 года назад

    I have never learned anything thanks to this man. Thank you so much harry!

  • @dileshnannaware4881
    @dileshnannaware4881 3 года назад +1

    Ur tutorials are like "learn with fun"🥳

  • @AnkitSaini-ld4hy
    @AnkitSaini-ld4hy 2 года назад

    Nice sir, Aap ne sikha dia sir!salute from muzaffarnagar

  • @ankitrawat9729
    @ankitrawat9729 5 лет назад

    Harry bhai html css pura ho gya avi.. Thanks alot

  • @arghyabanerjee900
    @arghyabanerjee900 4 года назад

    keyboard tut jayega😆😆😆😆😆...... nice sir you are a best teacher ...... Because you give knowledge and entertain us equally,....... Thnkx for he videos

  • @praveen353
    @praveen353 3 года назад

    You are real legend harry bhai.🤩🤩🤩

  • @tanmoyhazra6182
    @tanmoyhazra6182 3 года назад

    Thank you so much aapka video Mera bahut help karti aapka video 😌😌

  • @rasid_khan
    @rasid_khan 2 года назад

    harry bhai bahut hi mast video tha, akdam samaj gaye

  • @walimuhammad6955
    @walimuhammad6955 3 года назад

    I like the way you explain everything in detail
    Wali from Pakistan

  • @meghashah5473
    @meghashah5473 2 года назад

    The best tutorials so far..Thank you

  • @mohitbisht4437
    @mohitbisht4437 2 года назад +1

    east ho ya west harry bhai always best!

  • @amberahmed6356
    @amberahmed6356 Год назад

    try it, set container margin: 100px box3 absolute and its top : 30px. It will set top relative to browser not it's parent that is container.

  • @AliRaza-sk5vb
    @AliRaza-sk5vb 3 года назад

    Amazingly stated my web carrier or ye boht interesting tutorials han. Thank you Harry Potter ,😁❤😂

  • @whatsappstatushd5932
    @whatsappstatushd5932 3 года назад

    Mahan purush hai Harry bhai❤️

  • @abdullah.2127
    @abdullah.2127 3 года назад

    Watching this Legend in 2021!
    Means it still Worth a lot to Beginners

  • @Carloadib-b9h
    @Carloadib-b9h 2 года назад +1

    It was too helpful ,Thanks to harry bhai

  • @moviebuff3030
    @moviebuff3030 3 года назад +1

    Thanks for the notes. Today in this video I got that you have provided notes too.

  • @moviewithpawan
    @moviewithpawan 2 месяца назад

    Mai final year me hu 7 semester abhi just end hua maine kabhi coding nhi kara ab bss 6 month hai aur mai promise karta hu aapka css frame work frontend and backend sab acchee se complete kar ke 20+:Lpa ka placement le lunga Yaha coding me codechef par 2 star hu par 6 month baad 5 star ho jaaunga ....I am accepting this challenge under you guidance
    Sir

  • @joybera4466
    @joybera4466 9 месяцев назад

    4:10 relative = rishtedar = ghar k enmy

  • @kingmysterio2349
    @kingmysterio2349 3 месяца назад

    Self Notes:
    relative: relative to its normal position and will leave a gap at its normal position
    absolute: relative to the position of its first immediate parent
    fixed: positions the element relative to the browser window
    sticky: position of the element remains fixed until the parent container is scrolled down

  • @MayurPatil-pj2qy
    @MayurPatil-pj2qy 3 года назад

    udemy pe course liya aur ye topic dekhne ke liye yaha aaya .. 😂😂 harry bhai legend he hamare

  • @info-tech6041
    @info-tech6041 2 года назад

    position relative means-apni jgah pr hi reh kr move hogi.
    position absolute means parent ke acording move krega or ani jgah chordegaaa.

  • @engineerbhai7642
    @engineerbhai7642 5 лет назад +1

    Great tutorial. Bestcoder in you tube.

  • @Dineshtamang6267
    @Dineshtamang6267 2 года назад +1

    thank you so much for this amazing course..❤️🥰

  • @chibum6886
    @chibum6886 3 года назад

    Aaj harry bhaiya poore mood me lag rahe the🤣🤣🤣. Maza aaya aaj. Aise hee thoda humour daala kijiye maza aata hai😂😂😂

  • @Mayankkumar-hq6is
    @Mayankkumar-hq6is 3 года назад +2

    I want to mention a very important point for why we love to learn code by Harry bhai:
    His awesome vocal makes us learn code by him..
    Guys, observe this if you've not already...!

  • @rakeshraman4380
    @rakeshraman4380 3 года назад

    Good day, Sir. You are great. Keep it up. God may bless you with all success in life.

  • @codewithrudra1964
    @codewithrudra1964 3 года назад

    Thank You Harry Sir For This Web Development Tutorials.

  • @codewithree930
    @codewithree930 4 года назад +2

    Really, your video helping a lot.

  • @priyanshughatiya2129
    @priyanshughatiya2129 4 года назад +1

    Bhai ek no.. yrrr

  • @someshlakhe563
    @someshlakhe563 2 года назад

    Jinko absolute position me confusion hai unke liye -->
    Position ko absolute karne se jo baki ke elements hai wo aise behave karenge ki wo waha pe hai hi nahi,, simple hai absolute position kisi bhi element ko ghost👻 bana deta hai...ham absolute element ko kisi bhi position pe set kr sakte hai irrespective to any other elements..
    Agar ham koi element kisi bhi website ke bich me dal de to baki element ki position bighad jayengi but agar absolute element bich me dal de to baki element ko kuch bhi farak nahi padega

  • @sumankrishna5842
    @sumankrishna5842 3 года назад

    at 1:55 harry bhai ke recent used emojis khul gya😄😄

  • @Motherboard__Zone
    @Motherboard__Zone Год назад

    ye wala episode bahut khas tha mere liye sir

  • @AK-ln2ko
    @AK-ln2ko 2 года назад

    Position absolute leaves gap whereas relative does not leave any gap.
    Position absolute moves elements with respect to parent element whereas, position relative moves with respect to its actual position

  • @rumpamondal7333
    @rumpamondal7333 3 года назад +1

    Thanks for the video series.Just awesome. I also want to learn graphic designing. Can you please provide a full series of graphic designing?

  • @lavies907
    @lavies907 3 года назад +1

    Useful Video 👍

  • @garimabhardwaj1043
    @garimabhardwaj1043 11 месяцев назад

    sir, ap bhut acha smjhate ho thanx

  • @ASHISHKUMAR-dd9el
    @ASHISHKUMAR-dd9el 4 года назад

    awesome, started loving web development
    thanks harry bhai!!!!!!

  • @aditisharma9412
    @aditisharma9412 4 года назад +1

    Thank you so much sir for sharing such amazing and easy understandable vidoes....:)

  • @NatureSycho
    @NatureSycho Год назад

    Honestly Nice bro ♥️❤️❤️ love it

  • @MalhotraHarshika
    @MalhotraHarshika Год назад +1

    sticky will be fixed only till the end of the container, But fixed will be fixed until the end of web page.