Aligning text to center of last div

100 views Asked by At

I am new due css & Html design. I am facing an issue in aligning text to center of a last div.

enter image description here

I have created js fiddle :http://jsfiddle.net/80sems56/

Please help aligning last div text "Stress" to center of last image.

Code is like:

<div>
                        <div id="imgWeight" class="floatLeft">
                            <img alt="Body Weight" class="icon110" src="../../images/OnTrack/bmi_icon_100.png"/>
                            <div class="textaligncenter">Body Weight</div>
                        </div>
                        <div id="imgBloodPressure" class="margin5 floatLeft">
                            <img alt="Blood Pressure" class="icon110" src="../../images/OnTrack/health_manager_icon_100.png"/>
                            <div class="textaligncenter">Blood Pressure</div>
                        </div>
                        <div id="imgStress" class="floatleft">
                            <img alt="Stress" class="icon110" src="../../images/OnTrack/stress_icon_100.png"/>
                            <div class="textaligncenter">Stress</div>
                        </div>
                    </div>

css

.

padding20px{
    padding:20px;
}

.margin20px{
    margin:20px;
}

.imgSteps{
    padding:20px;
    position:absolute;
}

.bckColor{
    background-color: @secondary;
    color:@white;
}

.fontfamily {
    font-family: "Avenir Next Light";
}

h3{
    color:grey;
}

.margin5 {
    margin-left: 5%;
    margin-right: 5%;
}

.margin15 {
    margin-left: 15%;
}

.margin6{
    margin-left: 6%;
}

.margin10 {
    margin-left: 10%;
}
 .margin50{
     margin-left:50%;
 }

.absPosition{
    position: absolute;
}

.floatLeft{
    float:left;
}

.shadow {
    box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.4);
}

.opacity{
    opacity: 0.3;
  filter: alpha(opacity=30);
}

#dvNavigationArea ul li {
    display: inline;
    padding-right:20px;
    width:100px;
    position:relative;

}

.underline{
    content:'';
    height: 0;    
    left:0;
    bottom:0px;
    border-bottom: 4px solid #53ADB3; 

}


/*for css chart control*/
.container {
  width: 100px;
  margin: 20px;
  background: #fff;
  padding: 20px;
  float: left;
}

.horizontal .progress-bar {
  height: 45px;
  width: 100%;
  padding: 12px 0;
}

.horizontal .progress-track {
  width: 100%;
  height: 20px;
  background: #ebebeb;
}

.horizontal .progress-fill {
  background: #666;
  height: 20px;
  width: 50%;
  color: #fff;
  text-align: center;
  font-size: 12px;
  line-height: 20px;
}

.fontColor{
    color:#53ADB3;
}

.fontsizexlarge{
    font-size: x-large;
}

.fontsizexxlarge{
    font-size: xx-large;
}

.fontsize22{
    font-size: larger;
}

.fontsize10{
    font-size: large;
}

.icon110
{
    background-color:@secondary;
    -moz-border-radius:50%;
    -webkit-border-radius:50%;
    border-radius: 50%;
    width:@col-size;height:@col-size;
}

.textaligncenter{
    text-align:center;    
}

.minwidth
{

}
4

There are 4 answers

0
Sachin On BEST ANSWER

You did the typo while assigning the class for the last div. Use floatLeft instead of floatleft (the letter l is culprit)

Js Fiddle

0
Shrinivas Pai On

Your last div class name should be floatLeft instead of flaotleft.

<div id="imgStress" class="floatLeft">

Fiddle

0
Ram kumar On

* add this code * .floatleft{ float: left; text-align: center;} http://jsfiddle.net/80sems56/3/

0
Gerico On

Your HTML has a mistake in. Your missing a capital 'L' on the floatLeft class.

Updated Fiddle

<div>
    <div id="imgWeight" class="floatLeft">
        <img alt="Body Weight" class="icon110" src="../../images/OnTrack/bmi_icon_100.png"/>
        <div class="textaligncenter">Body Weight</div>
    </div>
    <div id="imgBloodPressure" class="margin5 floatLeft">
        <img alt="Blood Pressure" class="icon110" src="../../images/OnTrack/health_manager_icon_100.png"/>
        <div class="textaligncenter">Blood Pressure</div>
    </div>
    <div id="imgStress" class="floatLeft">
        <img alt="Stress" class="icon110" src="../../images/OnTrack/stress_icon_100.png"/>
        <div class="textaligncenter">Stress</div>
    </div>
</div>