Answer the question
In order to leave comments, you need to log in
How to show something to the left of an element in CSS without shifting the element itself?
I tried this code. The last H1 element is shifted to the right, but I would like to see them all aligned.
jsfiddle.net/HQLfr/
<div id=container>
<h1>one</h1>
<h1>two</h1>
<h1 class="special">three</h1>
</div>
#container {
margin-left: 100px;
}
.special:before {
content: '[x]';
position: relative;
left: -30px;
}
Answer the question
In order to leave comments, you need to log in
#container {
margin-left: 100px;
}
.special {
position: relative;
}
.special:before {
content: '[x]';
position: absolute;
left: -30px;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question