Organize your content and visuals within a shared container using Flexbox for optimal display:
.article-container {
display: flex;
flex-direction: row;
}
.article-container article {
flex: 1 0 75%;
order: 2;
}
.article-container .startseite-img {
flex: 1 0 25%;
order: 1;
}
With Flexbox, you can easily rearrange elements without changing the HTML structure. This is achieved through order: 1
.
The property flex: 1 0 75%
serves the following purposes:
- The first number signifies how an element should expand.
- The second number denotes how the element should shrink.
- The third value acts as the base when determining actual expansion and shrinking percentages.
Detailed guide with examples on working with Flexbox available here.
Example in Action:
Expand the code snippet to observe its functionality across the full page layout
.wrapper {
width: 100%;
}
.wrapper img-info {
width: 100%;
}
.img-info h2 {
width: 100%;
padding: 30px 30px 20px;
font-size: 50px;
color: #111;
line-height: 44px;
}
.img-info p {
padding: 0px 30px 20px;
font-size: 16px;
color: #111;
line-height: 24px;
}
.startseite-img {
width: 100%;
}
@media only screen and (min-width:768px) {
.wrapper {
width: 600px;
margin: 0 auto;
}
.img-info h2 {
width: 100%;
padding: 20px 0px 0px;
}
.img-info p {
padding: 20px 0px 0px;
}
.startseite-img {
padding-top: 30px;
}
}
@media only screen and (min-width:1000px) {
.wrapper {
width: 1000px;
}
.article-container {
display: flex;
flex-direction: row;
}
.article-container article {
flex: 1 0 75%;
order: 2;
}
.article-container .startseite-img {
flex: 1 0 25%;
order: 1;
}
.wrapper img-info {
width: 50%;
float: right;
}
.img-info h2 {
padding: 20px 0px 0px 30px;
}
.img-info p {
padding: 20px 0px 0px 30px;
}
}
<div class="wrapper">
<div class="article-container">
<article class="img-info">
<h2>Hi!</h2>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
<p> At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore
et dolore magna aliquyam erat, sed diam voluptua.</p>
</article>
<img class="startseite-img" src="16.9%20Placeholder.png">
</div>
</div>