Как правильно сверстать макет блока на flexbox?
Есть готовый блок, сверстал по макету. Однако я хочу перенести на flexbox, что бы проще было адаптировать. Как это сделать и можно ли не использовать отрицательный margin? Код и изображение прилагается.
Заранее благодарю.
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
width: 1170px;
}
.au-sheet{
min-height: 996px;
}
.about-us-container{
background-color: #ffffff;
position: relative;
}
.about-us-img{
text-align: left;
width: 555px;
height: 700px;
margin: 148px auto 0 0;
}
.about-us-section{
width: 650px;
min-height: 550px;
height: auto;
background-image: none;
box-shadow: 2px -2px 8px 0 rgb(128 128 128 / 45%);
margin: -625px 0 60px auto;
}
.about-us-section-elem{
padding: 0;
position: relative;
}
.about-us-num{
font-family: Poppins, sans-serif;
font-size: 17.0625rem;
font-weight: 700;
line-height: 0.9;
background-image: none;
margin: 0 auto 0 0;
display: table;
align-items: flex-start;
width: 417px;
color: #f6f6f6;
}
.about-us-h2{
font-size: 3.125rem;
font-weight: 700;
margin: -150px auto 0 82px;
color: #313131;
}
.about-us-text{
font-size: 1rem;
line-height: 1.6;
font-weight: 400; color: #616161;
margin: 48px 76px 0 82px;
}
<div class="about-us" id="about-us">
<div class="container au-sheet">
<img class="about-us-img" src="images/about-us-image.png">
<div class="about-us-section about-us-container" >
<div class="about-us-section-elem">
<p class="about-us-num">02</p>
<h2 class="about-us-h2">About Us</h2>
<p class="about-us-text">Analytics release series A financing launch party interaction design android angel investor. Vesting period social media sales conversion launch party rockstar incubator customer social proof graphical user interface technology supply chain. Non-disclosure agreement rockstar creative partner network launch party social proof paradigm shift long tail influencer <br>
<br>
<span style="font-size: 0.9375rem; "></span>Monetization validation success. Seed round channels product
management. Customer non-disclosure agreement strategy
android growth hacking ramen buyer.
</p>
</div>
</div>
</div>
</div>
Ответы (1 шт):
Автор решения: De.Minov
→ Ссылка
Вроде вы сделали, что хотели, но не понятно зачем такие большие отступы.
Не пиксель пёрфект, но смысл должен быть ясен.
.card {
display: flex;
flex-direction: row;
}
.card .image {
display: block;
max-width: 200px;
}
.card .image img {
display: block;
width: 100%;
height: 100%;
object-fit: contain;
margin: 0;
}
.card .info {
display: block;
width: calc(100% + 40px);
background: #fff;
margin-left: -40px;
padding: 4em 3em;
box-shadow: 0 0 5px 0 rgba(0,0,0,.35);
box-sizing: border-box;
position: relative;
z-index: 2;
}
.card .info::before {
content: '01';
font-size: 10em;
line-height: .75;
font-weight: bold;
color: #eee;
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
.card .info::after {
content: '';
display: block;
width: 100%;
height: 2px;
background: linear-gradient(to right, #fc5f43 25%, #35c796 25%, #35c796 50%, #b37df5 50%, #b37df5 75%, #feba60 75%);
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
.card .info h1 {
margin-top: 0;
}
.card .info h1,
.card .info p {
position: relative;
z-index: 1;
}
<div class="card">
<div class="image">
<img src="//i.imgur.com/RcfII4O.png">
</div>
<div class="info">
<h1>About Us.</h1>
<p>Analytics release series A financing launch party interaction<br>
design android angel investor. Vesting period social media sales<br>
conversion launch party rockstar incubator customer social<br>
proof graphical user interface technology supply chain. Non-dis-<br>
closure agreement rockstar creative partner network launch<br>
party social proof paradigm shift long tail influencer.</p>
<p>Monetization validation success. Seed round channels product<br>
management. Customer non-disclosure agreement strategy
android growth hacking ramen buyer.</p>
</div>
</div>
