I have two inline elements and I want to change the order of these elements without changing the HTML code. It's possible to do this with CSS only? I know how to change order with flex and grid etc. but these are only for block elements and I am curious if this can be done with inline elements also
*, *::after, *::before {
margin: 0;
padding: 0;
box-sizing: border-box;
}
div {
max-width: 300px;
border: 2px solid red;
margin: 2rem;
padding: 1rem;
}
.red {
color: red;
}
h1 {
}
h1:last-of-type {
margin-top: 3rem;
}
span {
border: 2px solid blue;
}
<div>
<h1>
<span>Lorem ipsum sit dolores</span>
<span class='red'>EKP itd.</span>
</h1>
<!-- I need this without changing html -->
<h1>
<span class='red'>EKP itd.</span>
<span>Lorem ipsum sit dolores</span>
</h1>
</div>