CSS Flip Card Effect

Поділитися
Вставка
  • Опубліковано 16 жов 2024
  • Create a flip card using just HTML and CSS3. The process requires just 5 essential blocks of CSS code. Flip cards are great space-savers for website content, and can greatly boost online user experiences. The code snippet for this tutorial is in the comments.

КОМЕНТАРІ • 366

  • @ArjunKhara
    @ArjunKhara  7 років тому +145

    Here is the code snippet for this tutorial on CSS flip cards. Feel free to customise the code and content for your projects.

    CSS Card Flip
    body{
    background: #3C5377;
    }
    /* THE MAINCONTAINER HOLDS EVERYTHING */
    .maincontainer{
    position: absolute;
    width: 250px;
    height: 320px;
    background: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    }
    /* THE CARD HOLDS THE FRONT AND BACK FACES */
    .thecard{
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    transform-style: preserve-3d;
    transition: all 0.8s ease;
    }
    /* THE PSUEDO CLASS CONTROLS THE FLIP ON MOUSEOVER AND MOUSEOUT */
    .thecard:hover{
    transform: rotateY(180deg);
    }
    /* THE FRONT FACE OF THE CARD, WHICH SHOWS BY DEFAULT */
    .thefront{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    backface-visibility: hidden;
    overflow: hidden;
    background: #ffc728;
    color: #000;
    }
    /* THE BACK FACE OF THE CARD, WHICH SHOWS ON MOUSEOVER */
    .theback{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    backface-visibility: hidden;
    overflow: hidden;
    background: #fafafa;
    color: #333;
    text-align: center;
    transform: rotateY(180deg);
    }
    /*This block (starts here) is merely styling for the flip card, and is NOT an essential part of the flip code */
    .thefront h1, .theback h1{
    font-family: 'zilla slab', sans-serif;
    padding: 30px;
    font-weight: bold;
    font-size: 24px;
    text-align: center;
    }
    .thefront p, .theback p{
    font-family: 'zilla slab', sans-serif;
    padding: 30px;
    font-weight: normal;
    font-size: 12px;
    text-align: center;
    }
    /*This block (ends here) is merely styling for the flip card, and is NOT an essential part of the flip code */


    Front of CardThis is the front of the card. It contains important information. Please see overleaf for more details.
    Back of CardYour use of this site is subject to the terms and conditions governing this and all transactions.
    Submit

    • @lesterdiaz6786
      @lesterdiaz6786 6 років тому

      how to make it responsive?

    • @appleproschoolnyheter5810
      @appleproschoolnyheter5810 6 років тому +1

      Awesome effect but when I hover my text gets reverse... Even if I copy your code here, plz help me understand why and how I can fix it

    • @vandebansal2331
      @vandebansal2331 6 років тому +1

      Thanku for giving this code i like it.... G@@d

    • @BMYL2022
      @BMYL2022 5 років тому +1

      Bonjour c'est pas possible de nous faire la vidéo en francais s'il vous plait merci

    • @saintwinner9769
      @saintwinner9769 5 років тому +1

      thank you

  • @TomTom-jv5sv
    @TomTom-jv5sv 4 роки тому +65

    WTF. In 6 minutes everything explained. And then the sandwich example. Wow respect. Perfect explained.

  • @gwija5783
    @gwija5783 Рік тому +11

    This tutorial is gold. Not only it shows you how to achieve the desired effect in a straight to the point way, but it then takes the time to explain how everything works and why! Thank you for making this

    • @ArjunKhara
      @ArjunKhara  Рік тому +2

      Thanks very much for your comments; made my day!

  • @naushadansari708
    @naushadansari708 3 роки тому +5

    that's called the way of explaining things perfectly, Respect you to provide the quality content

  • @kaushikdr
    @kaushikdr 3 роки тому +5

    I just got it and I hope I can make you guys get this as well.
    So the key is the backface-visibility, the transform for the back, and the pseudoclass. Basically, what he is doing is he is creating two faces and having them be invisible when either one is on their back.
    By having theback be flipped at the beginning, the front is visible and the back is not (which is why we don't need to worry about z-index!) So, every time the hover psuedoclass is called (basically means that when you hover over a class, something will happen), one of the cards will be flipped invisible and the other one will be flipped visible!

  • @rileygriffin8006
    @rileygriffin8006 Рік тому +1

    Finally! An easy-to-understand tutorial that gets straight to the point and it works

  • @Mehrankhan-bh4gf
    @Mehrankhan-bh4gf 3 роки тому +1

    I am watching this video in 2021 but i have never watched a video of explanation like that great job

  • @RD-lf3pt
    @RD-lf3pt 4 роки тому +14

    Awesome video. Just remember for Safari to also include: -webkit-backface-visibility: hidden;

    • @ArjunKhara
      @ArjunKhara  4 роки тому

      yes that fallback should’ve been included. Thanks for sharing mate :)

    • @SchwarzerFalke
      @SchwarzerFalke 2 роки тому

      You are my hero dude. Thank you. Almost get crazy :D

  • @alexgochenour8740
    @alexgochenour8740 5 років тому +1

    Thank you, Arjun. I have struggled to get this great feature to work for days... until I found your channel. Now I have a prettier website. Have a great day!

    • @ArjunKhara
      @ArjunKhara  5 років тому

      Hi Alex - You’re very welcome. I’m glad the tutorial helped and thanks very much for your amazing comment. Absolutely made my day :D cheers

  • @sksahinparvej5500
    @sksahinparvej5500 6 місяців тому +1

    This can't be more easier than this great explanation sir thank you helps a lot ♥️

  • @salman-asghar
    @salman-asghar Рік тому +1

    Hello Dear,
    Your coding skills and experience are great. Welcome, Viewers Arjun Khara is doing a difficult thing in a easy way. Thanks, Thank, Thanks a lot Arjun Khara 🤩🤩

  • @julialee690
    @julialee690 2 роки тому +1

    Tried to make it work with other videos too but yours is the only video that actually helped me!!! Thank you !!

    • @ArjunKhara
      @ArjunKhara  2 роки тому

      Hi Julia, glad it worked for you! Please let me know if you have any questions. Cheers!

  • @ashleysangma407
    @ashleysangma407 3 роки тому +1

    The best explanation I found.

  • @darius94arad15
    @darius94arad15 Рік тому +1

    I have only admiration for your work, the way you explain and the way you show all posibilities of which would and wouldn't work, you are amazing and help loads building up own logic ! I wish you would have invested more time into this.

    • @ArjunKhara
      @ArjunKhara  Рік тому

      Thank you very much for your kind comments. Made my day! I'll be putting up more videos soon now that my course of study is over. Cheers!

  • @ijoa
    @ijoa 6 років тому +22

    "...and CSS you next time" i just had to give you a like for that alone

  • @steevoni1
    @steevoni1 3 роки тому +3

    Clear, simple and all that is possible because of your awesome step by step explanation thank you for this tutorial and the hard work you put into editing this video for your viewers.

    • @ArjunKhara
      @ArjunKhara  3 роки тому +1

      Thank you for your very kind words; made my day :D. Glad you found the tutorial useful!

    • @steevoni1
      @steevoni1 3 роки тому

      @@ArjunKhara Yes thank you very much, your tutorial was very helpfu🤓l, I wish you further success; and more subscribers in the near future, and with the way you handle things I believe that it is possible. 😀

    • @steevoni1
      @steevoni1 3 роки тому +1

      @@ArjunKhara Yes thank you very much, your tutorial was very helpfu🤓l, I wish you further success; and more subscribers in the near future, and with the way you handle things I believe that it is possible. 😀

    • @ArjunKhara
      @ArjunKhara  3 роки тому

      @@steevoni1 Thank you so much! :)))

  • @thedarkbrickstudio2452
    @thedarkbrickstudio2452 2 місяці тому

    Thank you for the explanations. Really makes the tutorial easy to understand and follow.

  • @TheDanthelion
    @TheDanthelion Рік тому

    great tutorial, after looking at lots of different resources I still felt a bit stumped, but after watching this video I understand how to get the desired flip effect, and also understand how I could create other unique 3d effects using this process

  • @sayurikamble825
    @sayurikamble825 3 роки тому +1

    Had been banging my head onto every YT tutorial to create a flip card.... And this is the Best and Easiest so far .... LiferSaver ..... Thanks Man for this .... Keep Going!!!

  • @olansean9868
    @olansean9868 6 років тому +13

    you are such a good tutor, you are talented

    • @ArjunKhara
      @ArjunKhara  6 років тому

      Haha thanks very much! This totally made my day :)

  • @PRINCEDAKSHWEB_WIZARD
    @PRINCEDAKSHWEB_WIZARD 8 місяців тому +1

    Thank you sir for explaining this is very easy way..❤❤❤❤

  • @abrar8133
    @abrar8133 4 роки тому +1

    I finally understood this flipping card code! thank you

  • @827023685
    @827023685 6 років тому +8

    great tutorial. really loved the sandwich example, it cleared the one doubt i had. Make more videos, please

  • @jnova2766
    @jnova2766 2 роки тому

    I'm 5 years late but this is really good tutorial! thank you

  • @bretts7740
    @bretts7740 4 роки тому +1

    This is a fantastic tutorial. After watching several tuts of flipping cards your explanation put it all together for me. I really appreciate it!

    • @ArjunKhara
      @ArjunKhara  4 роки тому

      Thanks for your very nice comment :) glad you found the tutorial useful.

  • @Google.clouds
    @Google.clouds 6 місяців тому

    Too much information in 6 mins .. clear and too the point....✨

  • @bambubombon
    @bambubombon 4 роки тому +1

    This is my wish for an instructive css tutorial come true!! thank you!!

  • @willyish
    @willyish 7 місяців тому +1

    Very very impressive. minimum css used. Its so useful.

  • @firstbloodfangy6933
    @firstbloodfangy6933 11 місяців тому

    Great tutorial Arjun, thank you for sharing!

  • @83greene
    @83greene 6 років тому +4

    Brilliant video! and thank you for taking your time to really explain step by step what each code means!

    • @ArjunKhara
      @ArjunKhara  6 років тому

      Thanks very much - this is such a nice comment :)

  • @arthurvinicius7981
    @arthurvinicius7981 4 роки тому +2

    Thank you so much, your explanation about the css flip card was perfect!

  • @abouyousuf00
    @abouyousuf00 Рік тому +1

    Very clear and straightforward regards

  • @jaydenmoon1165
    @jaydenmoon1165 3 роки тому

    I know this is an older video - but thank you - this was a wonderful explanation

  • @WildlifeExplorer05
    @WildlifeExplorer05 Рік тому

    U help me alot i am worried since last few days also watch some other video also but your code is like small and powerfull thank you so so much sir

  • @GG-zj7oi
    @GG-zj7oi 3 роки тому

    Best card flip video I've ever seen!

    • @ArjunKhara
      @ArjunKhara  3 роки тому +1

      Thank you for your very kind comment. Made my day :)

    • @GG-zj7oi
      @GG-zj7oi 3 роки тому +2

      And this video saved my day ;)

  • @BalpreetDhillon
    @BalpreetDhillon Рік тому +1

    very good simple explanation!

  • @DrHappybone
    @DrHappybone 4 роки тому

    Just subbed because your explanation was so on point! Thanks for not wasting time with fluff and explaining everything with great examples :)

    • @ArjunKhara
      @ArjunKhara  4 роки тому +1

      Thank you for your kind words. Made my day! Glad you liked the tutorial :)

  • @aleksajovanovic5142
    @aleksajovanovic5142 4 роки тому +1

    Everything explained, understable. Great video!

  • @cypreanadie7424
    @cypreanadie7424 4 роки тому

    This was was professionally simplified for me... Much thanks

  • @adil_mansoori
    @adil_mansoori 4 роки тому +2

    Were were you the whole time you are explaining beautifully hope i should found you earlier
    Keep uploading such amazing content

  • @GANGSTASOUND
    @GANGSTASOUND 3 роки тому +1

    Thanks for the video. Great help.

  • @almerinobuce7878
    @almerinobuce7878 2 роки тому +1

    Great Tutorial, it helped so much...

  • @saikun0293
    @saikun0293 Рік тому +1

    perfect explanation, an informative video. Thank you for explaining everything step by step

  • @abhishekde1792
    @abhishekde1792 5 років тому +1

    It is working.....very good explanation & coding.

  • @jawadshah8043
    @jawadshah8043 3 роки тому

    Excellent way of explaination. Love from Pakistan : )

  • @gonzalochristobal
    @gonzalochristobal 6 років тому +16

    Great video! Also you can add the perspective property to make it look even more real, if someone likes:
    .maincontainer: { perspective: 1000px ... rest of the code ...}
    As the name of the property says, it gives perspective to the element

    • @ArjunKhara
      @ArjunKhara  6 років тому +1

      Gonzalo Rodriguez - excellent suggestion. I’ll mention this comment in the next related video. Thanks mate :)

    • @mahdibouchenaf7215
      @mahdibouchenaf7215 5 років тому

      thanks

    • @RSTao77432
      @RSTao77432 5 років тому

      perspective or perspective origin? or both

  • @janetracy8732
    @janetracy8732 5 років тому +1

    Finally you made me understand this flip card effect.... Thanks ☺

    • @ArjunKhara
      @ArjunKhara  5 років тому

      No worries, glad it helped :)

  • @satchito
    @satchito 5 років тому +2

    Oh man! This is amazingly simple! Thank you so much

    • @ArjunKhara
      @ArjunKhara  5 років тому

      No worries, glad you found it useful :)

  • @gokilamadhu6355
    @gokilamadhu6355 4 роки тому +1

    Really well explained, thanks so much 😊😊😊😊

  • @justinegoroszenko3506
    @justinegoroszenko3506 4 роки тому +3

    An amazing lesson, thank you! you have a new subscriber.

  • @peeyushkumar4702
    @peeyushkumar4702 2 роки тому

    Really thanks alot. Indians are really great at coding. Found it useful even after 2 years. Just required one help what to do I require to create multiple flash card one after other vertically aligned on same page of html. Please reply.

  • @le9292
    @le9292 3 роки тому +1

    amazing explanation. 👏👏

  • @khimleshgajuddhur6892
    @khimleshgajuddhur6892 Рік тому

    Hello sir,
    thank you very much for this video.
    very clear explanation, direct to the point and very short video.
    I'm using this effect for product cards arranged in a grid format, just like at the end of the video, there's an example
    I am having difficulties in doing this, could you please help me?
    thank you

  • @karincentenaro356
    @karincentenaro356 2 роки тому +1

    Thanks, your code really works , now i will do by myself, creating contents for English clases as a seconde Language, and other games,

    • @ArjunKhara
      @ArjunKhara  2 роки тому

      No worries, glad you found it useful. Please let me know if you have any further questions :) Cheers!

    • @karincentenaro356
      @karincentenaro356 2 роки тому

      @@ArjunKhara oh, thanks, yes, i have another question,..I'd like to create about 5 or more cards in one page, what i must do?

    • @ArjunKhara
      @ArjunKhara  2 роки тому +1

      @@karincentenaro356 That would be similar to the demo in the video. An easy way would be to create a div with either flex or grid as the display; this div would be a container. Then, within this container div create five internal divs, one to hold each of the cards. Finally, in each of these five internal divs simply copy-paste the entire flip card code. Give it a shot a see how it goes. Cheers!

  • @aaijalni
    @aaijalni 6 років тому +1

    this is what I need...
    thanks for your clear and concise explanation :)

  • @venkatnaidu4nimmala
    @venkatnaidu4nimmala 3 роки тому +1

    you have a style , great video

  • @janetdsouza3526
    @janetdsouza3526 5 років тому +1

    You are a amazing tutor. Please do upload more videos like these.
    Janet, Singapore

  • @sophiabairou
    @sophiabairou 3 роки тому +2

    Thank you for the great tutorial! How could i achieve the flip effect not by hovering on the card but by clicking on it?

    • @ArjunKhara
      @ArjunKhara  3 роки тому +1

      Hi Sophia, here's how the complete code for flipping on click. It requires a bit of Javascript.

      CSS Card Flip
      body{
      background: #3C5377;
      }
      /* THE MAINCONTAINER HOLDS EVERYTHING */
      .maincontainer{
      position: absolute;
      width: 250px;
      height: 320px;
      background: none;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      }
      /* THE CARD HOLDS THE FRONT AND BACK FACES */
      #thecard{
      position: relative;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 10px;
      transform-style: preserve-3d;
      transition: all 0.8s ease;
      }
      /* THIS USED TO BE THE PSUEDO CLASS CONTROLS THAT FLIP ON MOUSEOVER AND MOUSEOUT IN CSS */
      /* BUT NOW THIS CLASS IS BEING CALLED IN JAVASCRIPT WHEN THE CARD IS CLICKED */
      .flipper{
      transform: rotateY(180deg);
      }
      /* THE FRONT FACE OF THE CARD, WHICH SHOWS BY DEFAULT */
      .thefront{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 10px;
      backface-visibility: hidden;
      overflow: hidden;
      background: #ffc728;
      color: #000;
      }
      /* THE BACK FACE OF THE CARD, WHICH SHOWS ON MOUSEOVER */
      .theback{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 10px;
      backface-visibility: hidden;
      overflow: hidden;
      background: #fafafa;
      color: #333;
      text-align: center;
      transform: rotateY(180deg);
      }
      /*This block (starts here) is merely styling for the flip card, and is NOT an essential part of the flip code */
      .thefront h1, .theback h1{
      font-family: 'zilla slab', sans-serif;
      padding: 30px;
      font-weight: bold;
      font-size: 24px;
      text-align: center;
      }
      .thefront p, .theback p{
      font-family: 'zilla slab', sans-serif;
      padding: 30px;
      font-weight: normal;
      font-size: 12px;
      text-align: center;
      }
      /*This block (ends here) is merely styling for the flip card, and is NOT an essential part of the flip code */


      Front of CardThis is the front of the card. It contains important information. Please see overleaf for more details.
      Back of CardYour use of this site is subject to the terms and conditions governing this and all transactions.
      Submit

      function myFlipFunction() {
      var myElement = document.getElementById("thecard");
      myElement.classList.toggle("flipper");
      }

  • @andromedaanne9251
    @andromedaanne9251 6 років тому +2

    wow! great explanation! you also explained the 'why's' keep it up !

  • @mohammedelhoussni
    @mohammedelhoussni 2 роки тому +1

    Thank you soo much is very helpful and good explained 🥰🥰

    • @ArjunKhara
      @ArjunKhara  2 роки тому +1

      Thanks very much! Glad you found it useful :)

  • @williammichael5554
    @williammichael5554 Рік тому

    It was simple and easy tutorial thank u for making such a fun to learn video.

  • @Slimboyfat1979
    @Slimboyfat1979 Рік тому +1

    WOw I love your style

  • @wenchinyu3759
    @wenchinyu3759 3 роки тому +1

    Thank you! Your tutorial is really clear and helpful!

  • @gibernaujk
    @gibernaujk 6 років тому +1

    Thank you for that great lesson!!! I tried the code and it worked. Before your tutorial I tried to learn the CSS 3D flip card effect with Treehouse. Their lessons were completely useless. I couldn't understand anything.
    Your lesson was top notch! Once again thank you!!!!!

  • @soumyaranjanpradhan1325
    @soumyaranjanpradhan1325 4 роки тому

    Sir, nice explanation with amazing tutorial !!

  • @harshithvellala2589
    @harshithvellala2589 4 роки тому +1

    This is amazing and can get that card at center..

  • @carinwood1206
    @carinwood1206 3 роки тому +1

    Thank you! Really good tutorial. Easy to follow and good explanation!

  • @mahbuburrahman9326
    @mahbuburrahman9326 5 років тому

    Couldn't stop me liking this video ❤

  • @destradar1
    @destradar1 8 місяців тому +1

    Thanks friend. Interesting!

  • @Coder-Journey
    @Coder-Journey 3 роки тому +1

    You're the best, thank you !

  • @AdityaSawant-bk7dd
    @AdityaSawant-bk7dd 4 роки тому

    thank you sir its really helps me.
    I want that card responsive for mobile screen what changes is required?

  • @ScofieldSykes
    @ScofieldSykes 4 роки тому +1

    Great tutorial, you're awesome!

  • @filmyfreak5413
    @filmyfreak5413 4 роки тому

    Awesome explanation....

  • @streetcomando650
    @streetcomando650 2 роки тому +1

    Thank you great tutorial

  • @carolinerozali8030
    @carolinerozali8030 6 років тому +1

    This was lovely and thoroughly explained. :)

  • @ammnvx8799
    @ammnvx8799 3 роки тому

    WOW HAT OFF you explain so nicely thank you so much

  • @phodaOG
    @phodaOG 4 роки тому +2

    I dont know if it is explained in coments BUT if you hover over you get flickering, problem is the card is flipping so it breaks hover state, to fix you must fix hover state so its like this:
    from:
    thecard:hover {transform: rotateY(180deg);}
    to:
    .maincontainer:hover > thecard{transform: rotateY(180deg);}

    • @ArjunKhara
      @ArjunKhara  4 роки тому +1

      Cheers Ivan, that's a great fix. Thanks for the solution :)

  • @ekbalzayan4722
    @ekbalzayan4722 6 років тому +1

    Thank you for that great lesson

  • @evaninadgn
    @evaninadgn 6 місяців тому +1

    Great video thanks!

  • @yeowzh
    @yeowzh 4 роки тому

    Good job man, keep up the clear explanations!

  • @maidulislam138
    @maidulislam138 6 років тому +1

    Nice video. Learnt a lot.
    If i want to open two image like a door what will be the coding, please share..

  • @moonsdonut5188
    @moonsdonut5188 5 років тому +1

    man i was stuck on this thanks you helped

  • @paff8360
    @paff8360 2 роки тому +1

    thankyou for this tutorial, it's save my day ~~

  • @rscrj
    @rscrj 6 років тому +1

    Very good this explanation. Best Regards

  • @WoodlandChill
    @WoodlandChill Рік тому

    Excellent video, I followed the tutorial and almost everything works perfectly, but I have an issue while hovering over the card it starts to flicker abruptly and it is kinda hard to flip the cards, could you help me please?

  • @ArjunKhara
    @ArjunKhara  6 років тому +3

    If you would like to achieve the same flip effect using a click or tap, you can use simple Javascript. Here is the same code snippet for the full tutorial, with the Javascript code appended at the end of this code snippet. Enjoy!

    CSS Card Flip
    body{
    background: #3C5377;
    }
    /* THE MAINCONTAINER HOLDS EVERYTHING */
    .maincontainer{
    position: absolute;
    width: 250px;
    height: 320px;
    background: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    }
    /* THE CARD HOLDS THE FRONT AND BACK FACES */
    #thecard{
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    transform-style: preserve-3d;
    transition: all 0.8s ease;
    }
    /* THIS USED TO BE THE PSUEDO CLASS CONTROLS THAT FLIP ON MOUSEOVER AND MOUSEOUT IN CSS */
    /* BUT NOW THIS CLASS IS BEING CALLED IN JAVASCRIPT WHEN THE CARD IS CLICKED */
    .flipper{
    transform: rotateY(180deg);
    }
    /* THE FRONT FACE OF THE CARD, WHICH SHOWS BY DEFAULT */
    .thefront{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    backface-visibility: hidden;
    overflow: hidden;
    background: #ffc728;
    color: #000;
    }
    /* THE BACK FACE OF THE CARD, WHICH SHOWS ON MOUSEOVER */
    .theback{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    backface-visibility: hidden;
    overflow: hidden;
    background: #fafafa;
    color: #333;
    text-align: center;
    transform: rotateY(180deg);
    }
    /*This block (starts here) is merely styling for the flip card, and is NOT an essential part of the flip code */
    .thefront h1, .theback h1{
    font-family: 'zilla slab', sans-serif;
    padding: 30px;
    font-weight: bold;
    font-size: 24px;
    text-align: center;
    }
    .thefront p, .theback p{
    font-family: 'zilla slab', sans-serif;
    padding: 30px;
    font-weight: normal;
    font-size: 12px;
    text-align: center;
    }
    /*This block (ends here) is merely styling for the flip card, and is NOT an essential part of the flip code */


    Front of CardThis is the front of the card. It contains important information. Please see overleaf for more details.
    Back of CardYour use of this site is subject to the terms and conditions governing this and all transactions.
    Submit

    function myFlipFunction() {
    var myElement = document.getElementById("thecard");
    myElement.classList.toggle("flipper");
    }

  • @ManishSharma-fi2vr
    @ManishSharma-fi2vr 4 роки тому +1

    Please make a video on slice box

  • @codeeasy7673
    @codeeasy7673 5 років тому +2

    Just Awesome. this video help me to solve my problem. thanks for this one.

  • @MultiStarproductions
    @MultiStarproductions 6 років тому +1

    Fantastic tutorial Thank you One question how would you code the front to contain an image

    • @ArjunKhara
      @ArjunKhara  6 років тому

      Hi David, if you'd like an image for the front of the card, you can simply swap out the current background (which is #ffc728) to an image URL. I have copied and pasted the entire code below, and marked where the image URL goes. Also note you need to have the background-size: cover; property-value pair if you want the image to fill the background. Remember that large image file sizes do affect loading and animation speeds. You can see at www.qc.sg/workshops/ that I've used images for all of the flip cards. (You need to be on desktop mode to see these, as I've disabled the div on mobile devices for faster loading).

      CSS Card Flip
      body{
      background: #3C5377;
      }
      /* THE MAINCONTAINER HOLDS EVERYTHING */
      .maincontainer{
      position: absolute;
      width: 250px;
      height: 320px;
      background: none;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      }
      /* THE CARD HOLDS THE FRONT AND BACK FACES */
      .thecard{
      position: relative;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 10px;
      transform-style: preserve-3d;
      transition: all 0.8s ease;
      }
      /* THE PSUEDO CLASS CONTROLS THE FLIP ON MOUSEOVER AND MOUSEOUT */
      .thecard:hover{
      transform: rotateY(180deg);
      perspective: 1000px;
      }
      /* THE FRONT FACE OF THE CARD, WHICH SHOWS BY DEFAULT */
      .thefront{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 10px;
      backface-visibility: hidden;
      overflow: hidden;
      /* IMAGE FOR THE FRONT OF THE CARD */
      background: url('upload.wikimedia.org/wikipedia/commons/6/65/Thorn_Tree_Sossusvlei_Namib_Desert_Namibia_Luca_Galuzzi_2004.JPG');
      background-size: cover;
      color: #000;
      }
      /* THE BACK FACE OF THE CARD, WHICH SHOWS ON MOUSEOVER */
      .theback{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 10px;
      backface-visibility: hidden;
      overflow: hidden;
      background: #fafafa;
      color: #333;
      text-align: center;
      transform: rotateY(180deg);
      }
      /*This block (starts here) is merely styling for the flip card, and is NOT an essential part of the flip code */
      .thefront h1, .theback h1{
      font-family: 'zilla slab', sans-serif;
      padding: 30px;
      font-weight: bold;
      font-size: 24px;
      text-align: center;
      }
      .thefront p, .theback p{
      font-family: 'zilla slab', sans-serif;
      padding: 30px;
      font-weight: normal;
      font-size: 12px;
      text-align: center;
      }
      /*This block (ends here) is merely styling for the flip card, and is NOT an essential part of the flip code */


      Front of CardThis is the front of the card. It contains important information. Please see overleaf for more details.
      Back of CardYour use of this site is subject to the terms and conditions governing this and all transactions.
      Submit

    • @MultiStarproductions
      @MultiStarproductions 6 років тому +1

      Arjun Thank you so much for your help Much appreciated I really enjoyed watching your tutorial easy to follow a brilliant tutor . Perhaps you would consider making a video on turning this card flip into a coverflow so two images could be shown as it flips around Thanks once again Regards David

  • @lukelawrence3016
    @lukelawrence3016 5 років тому +1

    Cool video. How do I make it so that instead of flipping while hover, make it only flip on a single click?

    • @ArjunKhara
      @ArjunKhara  5 років тому +2

      Hi Luke, you will need JavaScript for that. Here's the code:

      CSS Card Flip
      body{
      background: #3C5377;
      }
      /* THE MAINCONTAINER HOLDS EVERYTHING */
      .maincontainer{
      position: absolute;
      width: 250px;
      height: 320px;
      background: none;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      }
      /* THE CARD HOLDS THE FRONT AND BACK FACES */
      #thecard{
      position: relative;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 10px;
      transform-style: preserve-3d;
      transition: all 0.8s ease;
      }
      /* THIS USED TO BE THE PSUEDO CLASS CONTROLS THAT FLIP ON MOUSEOVER AND MOUSEOUT IN CSS */
      /* BUT NOW THIS CLASS IS BEING CALLED IN JAVASCRIPT WHEN THE CARD IS CLICKED */
      .flipper{
      transform: rotateY(180deg);
      }
      /* THE FRONT FACE OF THE CARD, WHICH SHOWS BY DEFAULT */
      .thefront{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 10px;
      backface-visibility: hidden;
      overflow: hidden;
      background: #ffc728;
      color: #000;
      }
      /* THE BACK FACE OF THE CARD, WHICH SHOWS ON MOUSEOVER */
      .theback{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 10px;
      backface-visibility: hidden;
      overflow: hidden;
      background: #fafafa;
      color: #333;
      text-align: center;
      transform: rotateY(180deg);
      }
      /*This block (starts here) is merely styling for the flip card, and is NOT an essential part of the flip code */
      .thefront h1, .theback h1{
      font-family: 'zilla slab', sans-serif;
      padding: 30px;
      font-weight: bold;
      font-size: 24px;
      text-align: center;
      }
      .thefront p, .theback p{
      font-family: 'zilla slab', sans-serif;
      padding: 30px;
      font-weight: normal;
      font-size: 12px;
      text-align: center;
      }
      /*This block (ends here) is merely styling for the flip card, and is NOT an essential part of the flip code */


      Front of CardThis is the front of the card. It contains important information. Please see overleaf for more details.
      Back of CardYour use of this site is subject to the terms and conditions governing this and all transactions.
      Submit

      function myFlipFunction() {
      var myElement = document.getElementById("thecard");
      myElement.classList.toggle("flipper");
      }

  • @anjanajoshi2256
    @anjanajoshi2256 2 місяці тому

    How can I achieve this with a stack of say 4 cards? The front card has buttons & I want it to flip and display the back card as per the user choice (selected button).

  • @sunerashaikh4838
    @sunerashaikh4838 4 роки тому

    Superb. Love it .Thanks

  • @kuyaaibangaming9841
    @kuyaaibangaming9841 4 роки тому +1

    I was just searching for a ready made flash card and went to this haha

  • @balakrishnanyukesh1646
    @balakrishnanyukesh1646 4 роки тому

    Thank you Sir.Amazing Work💯.Im learning a lot from you🙏

  • @asachemicals2983
    @asachemicals2983 3 роки тому +1

    I found many ways to but this is crazy

  • @kishanpati336
    @kishanpati336 6 років тому +1

    Briliant tutorial and well explained :)

  • @preksha888
    @preksha888 4 роки тому

    Very useful, thank you very much, Sir!

  • @dinizulkefli3124
    @dinizulkefli3124 3 роки тому

    what is the coding to put more flip card in a row? when i try to copy all the div class=card to make more flip card, they become overlap

  • @jupiterjs031
    @jupiterjs031 6 років тому +1

    Very nice tutorial
    Thanks

  • @josephputnam7586
    @josephputnam7586 3 роки тому

    Does not having the closing tag for the div .maincontainer and .thecard allow the front and back of the card to sit in the same space as the .maincontainer? Or could someone explain this part of it better for me please.