Таким образом я получил следующий дизайн макета героя, что я работаю:Выравнивание две диагональные изображения
Я дошел до создания двух изображений, как показано на изображении с описанием рядом с изображением и выравниванием изображений. Я также рассмотрел клип-путь, но, к сожалению, он не поддерживает IE. Поэтому я использовал опцию поворота поворота, чтобы повернуть divs с -15 градусов и повернуть изображения внутри div назад с 15 градусами. Однако проблема заключается в том, что при масштабировании с помощью браузера между двумя изображениями, которые должны оставаться выровненными, возникает разрыв. (Таблетка и мобильное устройство имеют другое состояние, но это еще одна история).
Я создал код: http://codepen.io/adamk22/pen/zBLBAL который имеет макет, включая css. Как сохранить два изображения в соответствии с масштабом браузера? Что я не принял во внимание?
HTML:
<nav> Test Nav </nav>
<div class="container">
<div class="hero-container-top">
<div class="hero-img-box-container">
<div class="hero-img-box-left">
<div class="hero-img-box">
<img class="hero-img" src="http://gyproc.dev/themes/custom/drywall/images/hero_img1.jpeg">
</div>
</div>
</div>
<div class="hero-text-box">
<div class="hero-text-box-cta">
<h1>Hello World</h1>
<h3>Phasellus tempus. Quisque ut nisi. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Morbi mollis tellus ac sapien.</h3>
</div>
</div>
</div>
<div class="hero-container-bottom">
<div class="hero-text-box">
<div class="hero-text-box-cta">
<h2> Hello world</h2>
<h3>Phasellus tempus. Quisque ut nisi. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Morbi mollis tellus ac sapien.</h3>
</div>
</div>
<div class="hero-img-box-container">
<div class="hero-img-box-right">
<div class="hero-img-box">
<img class="hero-img" src="http://gyproc.dev/themes/custom/drywall/images/hero_img2.jpeg">
</div>
</div>
</div>
</div>
</div>
CSS:
body {
background: white;
font-family: 'Helvetica', sans-serif;
display: flex;
flex-direction: row;
}
h1 {
font-size: 36px;
line-height: 46px;
font-weight: 100;
}
h2 {
font-size: 24px;
font-weight: 100;
}
h3 {
font-size: 16px;
line-height: 30px;
font-weight: 100;
}
nav {
flex: 0 0 235px;
background: #0569C8;
display: inline-block;
}
.container {
flex: 1 0 auto;
margin: 36px;
overflow: hidden;
background: white;
}
.hero-img-box-container {
width: 60%;
}
.hero-container-top {
display: flex;
flex-direction: row;
height: 767px;
background: white;
.hero-text-box {
width: 40%;
position: relative;
}
.hero-text-box-cta {
position: absolute;
top: 40%;
left: 40%;
transform: translateX(-50%) translateY(-50%);
}
}
.hero-container-bottom {
display: flex;
flex-direction: row;
position: relative;
top: -256px;
height: 751px;
.hero-text-box {
width: 40%;
position: relative;
}
.hero-text-box-cta {
position: absolute;
top: 60%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
}
.hero-img-box-left {
background: lightgrey;
display: inline-block;
height: 1023px;
width: 100%;
transform: rotate(15deg);
transform-origin: top;
position: relative;
top: -165px;
overflow: hidden;
.hero-img-box {
transform: rotate(-15deg);
display: inline-block;
}
.hero-img {
height: 765px;
width: auto;
position: relative;
top: 140px;
left: 10px;
}
}
.hero-img-box-right {
background: lightgrey;
display: inline-block;
height: 1000px;
width: 100%;
transform: rotate(15deg);
transform-origin: top;
position: relative;
overflow: hidden;
right: -21.8%;
top: 0;
.hero-img-box {
transform: rotate(-15deg);
display: inline-block;
}
.hero-img {
height: 628px;
width: auto;
position: relative;
top: 80px;
left: -130px;
}
}
Я ценю ваши усилия, но, возможно, вы должны попробовать попробовать SVG. – GolezTrol
@golezTrol не маскирует svg использовать клип-путь, который, в свою очередь, не поддерживается IE? – adamk22
Я бы использовал псевдоэлементы, чтобы решить эту проблему. не поворачивайте Divs, а вращайте их перед псевдоэлементами и отрегулируйте видимость с помощью свойства z-index –