As all the time, thanks lots for studying!
Asymmetrical Designs
If you wish to construct sections with asymmetrical designs, try these tutorials.
On this fast tutorial, you’ll study two methods to separate a web page part’s background into two colours.
Think about the next layouts constructed with Bootstrap:
Right here, now we have three sections:
What we would like is, relying on the format, to paint half of the background of the second part.
The quickest methodology of making a break up coloration background is thru a linear gradient. The next type is sufficient; all we want is to set the right coloration stops (by default, linear gradients run from high to backside) relying on the format:
1 |
/*CUSTOM VARIABLES HERE*/.section-second { background: linear-gradient(var(--bg) 50%, clear 50%);} |
Right here’s how our first format will look with this system:
And right here’s the second:
One other manner of dividing a piece’s background coloration into two colours is by specifying a pseudo-element and setting its top equal to the part’s half top. Then, relying on the place we need to place it, we put its top as both high: 0
or backside: 0
.
Beneath are the types we’ll want after making the most of the CSS nesting:
1 |
/*CUSTOM VARIABLES HERE*/.section-second { place: relative; &::earlier than { content material: ""; place: absolute; high: 0; /*backside: 0;*/ left: 0; proper: 0; top: 50%; z-index: -1; background: var(--bg); }} |
Right here’s how our first format will look with this system:
And right here’s the second:
On this quick tutorial, we mentioned two simple methods to separate vertically a web page part’s background into two colours. Clearly, the idea stays the identical if you have to modify the background horizontally.
Final however not least, all of the demos of this tutorial have been added to a CodePen Collection. Make sure to test it out and provides it some love!
As all the time, thanks lots for studying!
If you wish to construct sections with asymmetrical designs, try these tutorials.
Trending Merchandise
[product_category category=”trending” per_page=”8″ columns=”2″ orderby=”date” order=”desc”].