Information about cookies on this page

Our website uses cookies to ensure the functionality of the website, to collect and analyze information about the performance and usage of the website. Privacy Policy

  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in
  
  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in

A Card from Scratch

Time to put the whole lesson together. Between Oscar's and Bella's cards, we've added a card for Daisy, a cuddly white cat, but without a single class: you'll style it yourself. Make it look like Oscar's card. You can look at his classes when you need to, but first try to remember what each part needs.

Daisy's card is built just like Oscar's: the div with the id daisy is the card, and inside it are the picture and another div with the texts and the button. The checks look at the result, not at particular classes, so you can choose your own sizes and shades.

A reminder of what makes a card a card: a background and a frame that set it apart from the page (bg-white, border, rounded-*, shadow-*), a picture cut to shape (w-full, aspect-* or h-*, object-cover) and rounded with the card (overflow-hidden), and texts with enough space around them (p-*, mt-*).

The page is getting long: scroll down in the preview to see Daisy's card.

Instructions

  1. 1

    Give Daisy's card a white background and the same maximum width as Oscar's card, center it, and give it a margin at the top so that it doesn't touch Oscar's card (mx-auto mt-6 max-w-sm bg-white).

  2. 2

    Give the card a light border, rounded corners and a shadow, and make sure that the picture gets rounded with it.

  3. 3

    Make the picture fill the width of the card and give it a shape, for example the same as Oscar's, without distorting it.

  4. 4

    Give the div with the texts padding, and style the texts like Oscar's: a big bold name, a smaller gray line with the age, and a margin above the description. (A colored line next to the description is up to you.)

  5. 5

    Finally, the button: as wide as the texts of the card, orange with white text, with rounded corners and some space above it.

Back

9/10

  1. 1. Borders
  2. 2. Border on One Side
  3. 3. Rounded Corners
  4. 4. Shadows
  5. 5. Images
  6. 6. Aspect Ratio
  7. 7. Rounded Corners on Pictures
  8. 8. Opacity
  9. 9. A Card from Scratch
  10. 10. Summary
Next

Try it yourself

Do this exercise right here in your browser. No account needed.