A basic design I'm aiming for with minimal use of html tags
Utilizing only <img>
, <h1>
, and <p>
tags without any additional elements
Implementing flexbox with column layout and wrap feature
The primary column displays a single image
The secondary column houses the title and content
The parent container has fixed width and height dimensions
This may cause text to overflow beyond its boundaries
To address this, only specify width for <p>
element
Is there a way to automatically break text without setting a specific width?
HTML
*{
margin: 0;
padding: 0;
}
.out{
width: 600px;
height: 200px;
border: 1px solid #ccc;
padding: 20px;
margin: 50px auto;
font-family: Verdana;
display: flex;
flex-direction: column;
flex-wrap: wrap;
}
img{
/* margin-bottom: 20px; */
margin-right: 20px;
}
p{
line-height: 1.6;
overflow-wrap: break-word;
}
<div class="out">
<img src="https://picsum.photos/id/230/200/200" alt="">
<h1>This is Title</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta iure iusto cupiditate sequi aperiam, nostrum optio ipsam dicta modi officiis eligendi vel. Dignissimos delectus exercitationem nemo. Enim id sed corrupti!</p>
</div>