Responsive FAQ accordion dropdown | HTML and CSS Tutorial

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

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

  • @NicoHeinrich
    @NicoHeinrich 3 года назад +5

    I was anxious that I couldn't do a responsive AND animated accordion with css only and this video is exactly what I needed! Thank you sir!

  • @frujunior67
    @frujunior67 4 года назад +26

    This is my first time seeing a tutorial on RUclips which looks like a paid course on udemy, thanks man love the way you explain in details, anyone can understand it with ease.
    Once again thanks man and I'm here to stay on this channel. One subscribe added and will share to friends just hope you keep it up .

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

      search more you will find many

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

    You are the best. Through your tutorials, I've learned over 60% of all the CSS I know. Thank you.

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

      keep learning mate

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

      My cat taught me more about CSS than this guy

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

    This video is a perfect example of what RUclips tutorials should be like. Like someone said in the comments..."...looks like a paid course on Udemy". Besides, most Udemy courses isn't even near this in quality. I salute you, Julio :)

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

    When I first saw this video months back I said "well I will be back", now I'm back coz I need it.

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

    Oh man, it's really working, true youtuber guys !

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

    Bro you are true savior, the code was clean and easy to understand........ i really appreciate it.

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

    Thank you so mush for the concept of the accordion add and remove icon.
    You just made my work easier for me. I'm applying that concept to open forms.

  • @ashiqurrahman8584
    @ashiqurrahman8584 4 года назад +4

    Thank you so much brother .This is actually what I am looking for.

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

    Great tutorial man, thank you very much! One question, how do I get the same answer box to close when I click on it? Because we can transition between them but the same one that's opened won't close again. Many thanks!!

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

    thanks a lot man, love you pls dont ever delete this video thanksssssssss

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

    Hi nice tutorial, but I have a question when you place more then one accordion on one page how comes that the actions off the one who stands open is affected when you click in the second one. For example: accordion 1 has his selection open and I would like that accordion 2 has also his selected option open? How do you do that?

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

    That was really good, I knew nothing about CSS - but I learnt a lot from implementing this thanks for the Video.

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

    Awesome video bruh. This helped me with a project. Appreciations man

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

    Brilliant Tutorial, thanks a bunch!

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

    wow beautiful man, that's amazing, thanks for the video :D

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

    Hi Julio, a question, how can I do when I have different heights in each .answer? What if I want to prevent the page from reloading? but keep the accordion working, thanks

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

    Thanks very much for the clear tutorial bro

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

    Hi Julio, Thanks for the video, learned a lot! One question: We coded exactly the same however when answers are long contents the answer part only displays partially, how could we fix this? Many thanks again!

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

      Change the max height in your .accordion-item: target .answer{} to a larger number

  • @caiosilva7755
    @caiosilva7755 5 лет назад +2

    Make more videos like this, keep this frequency

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

    How do I prevent the webpage from scrolling to the # when clicked on it? Can it be done? If so, please demo with relevant example. Appreciate this!

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

      @Rizwan Mustafa Thanks for replying. When I do that, the answer box doesn't drop

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

    God Bless You for this tutorial

  • @LuisReyes-zs4uk
    @LuisReyes-zs4uk 2 года назад +2

    great video!
    is there anyway to make the "open" animation of currently selected and "close" animation of previously selected be simultaneous? thanks!

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

      if you find the way to do that send it to me please , thanks

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

    Amazing Julio, is it possible to add a search box that brings that filters the questions?

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

    one of the best!

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

    man you are the best i love it thank u so much for teaching this i learned alot thanks

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

    by far THE most helpful tutorial I've come across with! Thank you so much, but can I know how to make the whole FAQ tabs to be significantly larger? Not sure if I got some of the steps incorrect (most likely) but my final product is really small and its very hard to read the texts...Also, how do we allow the user to close all the question tabs without having to leave any of it open/displayed?

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

    hi Julio, how can i close the tab that is open without opening another one? can it be done with CSS or do i need JS ?

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

    What's the best/cleanest way to move the icon to the left of the words in the accordion-item/accordion-link in css?

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

    Dude, how to make remove button clickable? So if you click remove its close the tab?(sorry for my english)

  • @Живыекартины-т8ъ
    @Живыекартины-т8ъ 3 года назад +2

    Great tutorial! Thanks! Just one more question - how to close them all? With this example one item will be opened forever as soon as I click on it at the first time

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

    This works really really great, except for one problem I'm not sure how to fix.. when this FAQ is part of a longer page, every click jolts the viewport so that the target accordion-item is positioned directly at the browser's top. This is not surprising as an anchor click is supposed to do just that.. but is there a way to prevent it somehow? It essentially makes the whole thing unusable :/

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

      have you found an answer to this?

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

      @@pedroasaph6921 afraid not. Ended up using a different type of accordion for this

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

      @@MikeXwolf What'd you use? Exact same problem, trying to find a fix is driving me nuts.

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

      @@benjohnson5164 this is the one I ended up going with: ruclips.net/video/pzy_QStQaqA/видео.html
      It's sort of the same thing, minus this silly glitch

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

      @@MikeXwolf Perfect! Been torturing myself for a week over this before I remembered to check back here. Exactly what I was looking for. Worked like a charm, super clean code. Thanks man.

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

    I am facing a challenge, I don't see anyone mentioning it here when the link is clicked the page jumps to up it opens the answer but shifts the layout of content, is there a fix for this? preventing the layout shift I guess it a default behavior for a tag

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

    Excelente tutorial!!

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

    Thank you very much it's very helpful for me awesome explanation 👍

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

    great job julio

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

    Hey bro thx for the vid
    i got 1 question: is it possible to lower the entire section?

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

    Can you help me out on how to add the feature - collapse, when I click on " - " on the accordian-link ?

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

    Thanks man. It was really helpful to me

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

    Hi...I created a page in my local system with the exact code and it works fine...but when I use it on my WordPress website page , the click functionality i.e :target is not working...can u please suggest what can be the issue?

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

    Awesome video but Julio how do you hide the answer back after clicking?

    • @juliocodes
      @juliocodes  5 лет назад +2

      You’d need to do it the JavaScript way or css but using check boxes.

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

      Julio Codes Thanks Julio but I’m really confused on how to use both ways so can you please help me with the JavaScript way

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

    Awesome man !

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

    Thanks a lot for the video Julio! When I use this code, It forces the label to go to the top of the page, when I want the label to stick where it is and the text to open under it. Any ideas how to fix this?

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

      This is the normal behavior for links that use a # within the href. I think that if links are changed to a button element instead it could be a better option. Can't say for sure though since I haven't tried it. Ideally though, a dropdown is better executed when done with javascript since it eliminates odd behaviors like that

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

    Thank you for this tuts.. very helpful

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

    Sick video! What editing software do you use?

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

    Can this method be adopted in Squarespace coding?

  • @GauravJoshi-Vlogs
    @GauravJoshi-Vlogs Год назад

    What if i want to set the height dynamically (according to the content) and not hardcoded?

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

    where can i get the codes?

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

    Where is the code link?

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

    Thank you so much!

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

    Hey. Thanks for the tutorial. But I'm having an issue. After setting the "accordion-item" on target, whenever I click the max-height does not change.

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

      Yes, it's not working

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

      I have the same problem, too. Did you solve it or are you still working on it?
      I used these but it still didn't work:
      href="#question1"
      href={"#question1"}

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

      @@altanreis1616 yep we should add the #

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

    Great Job

  • @sankarmondal89
    @sankarmondal89 5 лет назад +3

    Excellent, this is what I was looking for. Can you please share those files in the description of the video?

    • @FhishFhish
      @FhishFhish 5 лет назад +4

      type that shit over bro!

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

    Nice tutorial but for those trying to use it in an actual website be warned its pushing the section down beneath it. Unless I didn't follow the tutorial correctly. Ill have to re-watch the tutorial. Otherwise, I will have to diagnose and fix this issue

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

    Nice, but missed how to close by clicking on the close button, but it can be an exercise to practice :) ty

  • @VDub-wc0x
    @VDub-wc0x 4 месяца назад

    It didn't work for me. I did everything the same but the accordion answer is never shown on clicked

  • @mandresyfenomanantsoa6647
    @mandresyfenomanantsoa6647 4 года назад +4

    thx for this great video , can anyone tell me how can I make it drop back up when clicked for the second time? (without clicking on another link item)

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

    como podria hacer para que al volver a dar click el acordeon vuelva a cerrarse? con target?

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

    Is there a way for me to make the answer go back to hidden after clicking it again?

  • @44aliano
    @44aliano Год назад

    stud, thank you

  • @kingdavid2446
    @kingdavid2446 5 лет назад +2

    can you please do a functioning pagination

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

    I don't know if you still answer but ion icon updated. I get it to show the icons but I can't target the tag in the css sheet to make the remove icon disappear.

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

      Can you maybe paste your code here so I can copy it ?

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

      .accordion-link :last-child{
      display: none;
      }
      i used this and it worked

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

      Assign class to it :) in latest version it uses name to fetch icons so.

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

    Amazing! thank u so much!

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

    hey how can we overcome the jumping effect of the accordian cuz of the #id we used plz someone tell me

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

    Thanks man. very useful :-)

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

    hi! where I can get source code ?

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

    How do I even get to the html index?

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

    thanks a lot for your video ma , mush love

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

    anyone know how to whack an unordered list into this? ive managed to put it there but cannot for the life of me get the bullets to show up

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

    excelente contenido mi estimado. Abrazo grande!

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

    can someone share the code shown in the tutorial ?

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

    how your browser simultaneously changes as you are changing the CSS?

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

      On VS Code you can do it this way with this extension: ruclips.net/video/y4qqQeUDCBQ/видео.html

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

    I'm having auto height. It's not working.

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

    Dude, why don't you finish the previous projects before going to another?

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

      Because there’s a difference between a short video and a long one. I don’t have the time complete a 1+ hour video at the moment, it’ll be out this week.

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

      @@juliocodes Oh! Okay...I'll wait.

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

    Hello sir. I have a small problem. When I click the link, the scroll down activates so the first question hides in view.

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

      Use this code - codepen.io/sudodeepak/pen/qBdgPPQ

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

      check box name change kar ke "Radio" likho

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

    how we can do that with ionic 5?

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

      Just follow the instructions on the ion icon website. Use instead of , works fine.
      To reference the "name" attribute in css file, do this for the add button: "ion-icon[name=add]{ }". It's the same thing with remove.
      I just did that and it works.

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

    Do you a link for the source code?

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

    does someone knows how I can stop the scroll towards the question when clicking to open it ? I'm a bit stuck right now, it feels messy, i just want the answer to open and no scrolling :/

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

      did you ever find out how to stop it?
      I'm struggling hard.

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

    So the source code is nowhere to copy/paste!? I have to type all of these? seriously ?

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

    Heyy! Need the code of this

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

    thanks man

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

    any one knows why the max-height property wont transition ?

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

    im having an error, when i click the question, jumps to anothers page that says Your file was not found It may have been moved or deleted. i think is the href

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

      +Leonardo Arenas is the href blank?

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

      @@juliocodes I find the error! but thanks for the help!!! I wrote href=question1 without the "#" before

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

    Thank you for this. Waiting for the next upload.. A'dy

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

    I have an error about the : target part, when I click on the question it won't show the answer

    • @MiguelGonzalez-eb9lj
      @MiguelGonzalez-eb9lj 5 лет назад

      I am having the same problem!

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

      Watch that portion of the video again to make sure you’re chaining the classes correctly.

    • @MiguelGonzalez-eb9lj
      @MiguelGonzalez-eb9lj 5 лет назад

      Julio Codes I found what I did wrong lol I put a letter that wasn’t suppose to be there lol

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

      Hey, I'm unable to figure out this part!! the .answer class isn't getting the height of 20rem

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

      Edit:- its fixed... Its just a spelling mistake

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

    Can you share the source code!

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

    Help me for the :target part please, they don't show the answer

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

      I’d have to see that portion of the css to know what the issue is

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

      @@juliocodes just like what you wrote :( that's for my school assignment

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

      There must be an issue somewhere tho. If it’s exact as mine there would be none. A lot of the times it can be a simple syntax or even grammar mistake

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

      @@juliocodes ok i'll rewatch your video 😌

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

    the add and remove icon are not showing in my end lol welp anyway thanks man

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

    Please the source code??

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

    Wow, but how do we close it, thanks man

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

      This is just a simple way of doing it if you need something quick, but not ideal. Using JavaScript is a better option for this type of thing. The live coding video I did a few weeks ago shows how it's done

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

      @@juliocodes I have done it, I was an able to close it with jQuery

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

      It's working very fine and I have implemented it to the website am building, but I edited your CSS code, I removed and add some things

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

      @@cdcoinltd1528 Awesome! Glad to hear you found a solution!

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

      @@juliocodes I spent all night doing it, I almost gave up on it but thanks to God, I had to use crome inspect to debug it and that was how I did it

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

    6:55 in video rn 2/26/21 11:46pm

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

    When used in the middle of an existing page it jumps to the top of the screen when clicked due to the href="#" I do believe, did some searching and couldn't find a way to prevent it, any way you know of preventing that ??
    Also is there a way of closing them completely when the link is clicked instead of opening another box?

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

      This is mostly a demo type of thing on how this can be achieved with only CSS, however, as you mentioned it’s not perfect. I don’t think there’s really much getting around the link jumping, you can make it so that it jumps to the container holding everything as opposed to the top of the page by using a new ID on the container and matching with the link. One could also use :focus but that would require to add a ‘tab-index’ to the html element to turn it into a focusable item. This would make it so that they close all together after the items are no longer focused. The best way to actually get this done would be by using JS to toggle classes.

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

      @@juliocodes Thanks again

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

      have u got the solution of this problem?

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

    15:00

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

    Watch at 1.25x

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

    the target part doesn't work, have exactly the same code

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

      Having the same problem..

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

      @@nonshalantfx yeah same for me. :(

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

      Same problem
      Edit:- lol i made a spelling mistake

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

      bro i am trying this code and i am facing the same problem did you find any solution?

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

    not is responsive, from the moment you need to change the html tag to make the font smaller it is NOT RESPONSIVE

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

    volay ... ocay ...

  • @prachichaudhari785
    @prachichaudhari785 6 месяцев назад

    give code and then will subscribe

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

    This is not close that's very bad bro. :(
    ///////

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

    Don't waste your time with this, it's clickbait..