Let's build the above challenge with CSS variables
.
Setup
Let's start with a semantic blockquote element
Card Info
- Style the container in center of the screen with responsive width
box-sizing
to includepadding
in itswidth
- Left side slightly indented
- Creating nice box for quote card
Card Content
- Para content
- Cite author name
CSS Variable
- Adding
CSS variable
for colors & shadow with fallback CSS Variable
makes it easier to create variants with different themesCSS Variable
gets inherited and can be easily overridden
Quote wording
Makes the quote wordings larger and limits its width
Cite wording
Makes the cite wordings slimer & a little transparent
Before quote
- Choosing
โ
as a decoration character - Makes it a nicer & larger font
- Color blend with background
Before quote positioning
position
the quote theabsolute
to break the normal flowposition
the cardrelative
so that quote starts from the card- Adjust
position
slightly to the top-left
After quote positioning
- Choosing
โ
as a decoration character to close the quote - Same as before quote but larger and positioned to the bottom-right
Common CSS
- Take common
CSS
& comma separate it Distribute
the difference to:before
&:after
(position
&size
)
Responsiveness โจ
Makes the quote smaller on phone screens
Blue card
Make another quote card to customize it later
Add blue-card
class to customize it
Blue variant ๐
Use CSS variable
to create a blue variant, the variable will override the value that we have used in the .quote-card
Red card
Make another quote card with red-card
to theme it red
Red variant โค๏ธ
Use CSS variable
to create a red variant, the variable will override the value that we have used in the .quote-card
Yellow card
Make another quote card with yellow-card
to theme it yellow
Yellow variant ๐
Use CSS variable
to create a yellow variant, the variable will override the value that we have used in the .quote-card
Setup
Let's start with a semantic blockquote element
Card Info
- Style the container in center of the screen with responsive width
box-sizing
to includepadding
in itswidth
- Left side slightly indented
- Creating nice box for quote card
Card Content
- Para content
- Cite author name
CSS Variable
- Adding
CSS variable
for colors & shadow with fallback CSS Variable
makes it easier to create variants with different themesCSS Variable
gets inherited and can be easily overridden
Quote wording
Makes the quote wordings larger and limits its width
Cite wording
Makes the cite wordings slimer & a little transparent
Before quote
- Choosing
โ
as a decoration character - Makes it a nicer & larger font
- Color blend with background
Before quote positioning
position
the quote theabsolute
to break the normal flowposition
the cardrelative
so that quote starts from the card- Adjust
position
slightly to the top-left
After quote positioning
- Choosing
โ
as a decoration character to close the quote - Same as before quote but larger and positioned to the bottom-right
Common CSS
- Take common
CSS
& comma separate it Distribute
the difference to:before
&:after
(position
&size
)
Responsiveness โจ
Makes the quote smaller on phone screens
Blue card
Make another quote card to customize it later
Add blue-card
class to customize it
Blue variant ๐
Use CSS variable
to create a blue variant, the variable will override the value that we have used in the .quote-card
Red card
Make another quote card with red-card
to theme it red
Red variant โค๏ธ
Use CSS variable
to create a red variant, the variable will override the value that we have used in the .quote-card
Yellow card
Make another quote card with yellow-card
to theme it yellow
Yellow variant ๐
Use CSS variable
to create a yellow variant, the variable will override the value that we have used in the .quote-card