I am preparing a new layout with slanted elements that should be responsive in any way.
What I currently have does look good on default desktop and mobile, but if the screen is larger, the layout is being ruined: e.g. on my 32" screen the text is starting outside the container elements, right before the slanted elements. That should not happen.
main {
font-family: Arial;
}
.content_nocolor {
padding: 60px 40px 40px 40px;
}
.content__slant1 {
position: relative;
padding: 40px 40px 120px 40px;
overflow: hidden;
filter: drop-shadow(0px 40px 0px #f2f2f2);
}
.content__slant1:before {
content: "";
display: block;
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
width: 100%;
height: 100%;
background: #004B4F;
-webkit-transform: skewY(-3deg);
-moz-transform: skewY(-3deg);
-ms-transform: skewY(-3deg);
-o-transform: skewY(-3deg);
transform: skewY(-3deg);
transform-origin: top left;
}
.content__slant1 h1, .content__slant1 p {
position: relative;
color: #ffffff;
}
.content__slant1 h1 a, .content__slant1 p a {
color: inherit;
}
.content__slant2 {
position: relative;
padding: 120px 40px 40px 40px;
overflow: hidden;
filter: drop-shadow(0px calc(-1*40px) 0px #f2f2f2);
}
.content__slant2:before {
content: "";
display: block;
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #F89300;
/* background-image: linear-gradient(#ff9d2f, #ff6126); */
-webkit-transform: skewY(-3deg);
-moz-transform: skewY(-3deg);
-ms-transform: skewY(-3deg);
-o-transform: skewY(-3deg);
transform: skewY(-3deg);
transform-origin: bottom right;
}
.content__slant2 h1, .content__slant2 h3, .content__slant2 p {
position: relative;
color: #000000;
}
.content__slant2 h1 a, .content__slant2 h3 a, .content__slant2 p a {
color: inherit;
}
.content__slant3 {
position: relative;
padding: 0 40px 140px 40px;
overflow: hidden;
filter: drop-shadow(0px 40px 0px #f2f2f2);
}
.content__slant3:before {
content: "";
display: block;
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #F89300;
/* background-image: linear-gradient(#ff9d2f, #ff6126); */
-webkit-transform: skewY(3deg);
-moz-transform: skewY(3deg);
-ms-transform: skewY(3deg);
-o-transform: skewY(3deg);
transform: skewY(3deg);
transform-origin: bottom right;
}
.content__slant3 h1, .content__slant3 h3, .content__slant3 p {
position: relative;
color: #000000;
}
.content__slant3 h1 a, .content__slant3 h3 a, .content__slant3 p a {
color: inherit;
}
<main class="content">
<div class="content__slant1">
<h1>Office ipsum</h1>
<p>That's great, but we need to add this 2000 line essay make it original, for can it handle a million in one go, yet it needs to be the same, but totally different this looks perfect. Just Photoshop out the dog, add a baby, and make the curtains blue we exceed the clients' expectations this is just a 5 minutes job.</p>
<p>
What you've given us is texty, we want sexy something summery; colourful make it look like Apple. Can you make it faster? the animation does not work, when i print the page or can you punch up the fun level on these icons give us a complimentary logo along with the website, nor thanks for taking the time to make the website, but i already made it in wix.
</p>
</div>
<div class="content_nocolor">
<p>There is too much white space why is a 15mb gif on the startpage a bad idea?!, yet you can get my logo from facebook. </p>
<p>
That's great, but we need to add this 2000 line essay it needs to be the same, but totally different so there are more projects lined up charge extra the next time.
</p>
</div>
<div class="content__slant2">
<h1>... continues ...</h1>
<p>
We try your eye, but can you change everything? submit your meaningless business jargon to be used on the site!, but that will be a conversation piece this red is too red can you pimp this powerpoint, need more geometry patterns I have an awesome idea for a startup, i need you to build it for me. The flier should feel like a warm handshake. The animation does not work, when i print the page you might wanna give it another shot, or can you turn it around in photoshop so we can see more of the front can you make the blue bluer? jazz it up a little, can you please send me the design specs again?
</p>
<p>
I know somebody who can do this for a reasonable cost. Anyway, you are the designer, you know what to do can you make the logo bigger yes bigger bigger still the logo is too big can you use a high definition screenshot, in an ideal world. Remember, everything is the same or better in an ideal world can you please send me the design specs again?
</p>
<h3>Thats not what i saw in my head at all!!</h3>
</div>
<div class="content__slant3">
<h1>... and so it ends.</h1>
</div>
</main>
4
Answers
did the trick
use media query => @media in css.
Use media query, use min width and max width.
answer made from earlier comment to make it visible to anyone:
it uses
clip-path
instead transform and value is taken from a CSSvar()
to update thepath
and thepadding
at the same time.Live exemple describing the idea :