idris
idris

Reputation: 1049

Setting margin-left from div

So here's my issue. This is what I want to do

enter image description here

Which I did. The issue is the blue text doesn't align up correctly. Since I'm doing margin-left: 130 on the blue text it starts from the gray words. Not the start of the div. So here's what it looks like when I code it

enter image description here

So what I basically want to do is start the margin from the div. Not the text. Here's a demo http://jsfiddle.net/R2FVL/. Any help would be great

Upvotes: 0

Views: 41

Answers (2)

Guru3908048
Guru3908048

Reputation: 36

Wrap H2_3 and H2_7 with div

 <div id="Div_H2_3"><h2 id="H2_3">More Stuff</h2></div>
 <div id="Div_H2_7"><h2 id="H2_7">Even More Stuff</h2></div>

add blow style

#Div_H2_7,#Div_H2_3 {
    display: inline-block;
    width:35%
}

Refer http://jsfiddle.net/F7gG7/

Upvotes: 0

chovy
chovy

Reputation: 75666

Wrap the label and give that a fixed width.

<span class="label">Stuff</span>
<span class="stuff">Value Stuff</span>

.label {
    display: inline-block;
    width: 200px;
}

Upvotes: 1

Related Questions