In the previous tutorial Create cards we have created a system card. in this tutorial we will make variation card with horizontal type. The first thing we have to do is create elements of cards.
Element HTML:
<div class="container">
<div class="columns">
<div class="column cards">
<img src="assets/example-img.png">
<div class="title">Title Cards</div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
</div>
</div>
.cards
background: white
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04)
border-radius: 3px
.title
font-size: 20px
font-weight: bold
margin: 10px 0px
img
width: 100%
for more details, you can see in my tutorial Create cards.
We will combine the class "cards" and class = "horizontal", so that the horizontal class is more specific and only in use when combined with class cards.
SASS Cards Horizontal:
.cards
background: white
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04)
border-radius: 3px
&.horizontal
display: flex
img
width: 100%
Use the horizontal cards:
<div class="columns">
<div class="column cards horizontal">
<img src="assets/example-img.png" class="avatar">
<div class="title">Title Cards</div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
</div>
Result:
Open a command prompt on your project and run gulp. Open http://localhost:8080/ in your browser to see the results.
We have seen the results, but we have to style the existing content in horizontal cards to look neater and elegant.
Styling Image:
We will create a class to set inside horizontal cards. I will create class = "avatar"
SASS:
.avatar
width: 100px
height: 100px
border-radius: 50%
width: 100px,height: 100px.The result:
Now we need to fix the title and the paragraph in the cards. because we use display: flex, the contents of our content cards to be parallel to the side. to remove the effect we wrap our content cards in .
Why use div to remove display flex?
Because flex displays have properties similar to inline-block, so we need to use , because by default div has block properties(display:block) , So if we wrap content cards with div, automatically content contents are not affected with flex effect
Example:
<div class="column cards horizontal">
<img src="assets/example-img.png" class="avatar">
<div>// Start div wrapper
<div class="title">Title Cards</div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>// End div wrapper
</div>
The result:
I hope you can Trying to replace the CSS property to make it look nicer and beautiful. I use simple CSS. because the purpose of this tutorial would like to explain how the concept to make element cards