Can't align text verticallty

Posted by Nismeh under CSS 3 on 9/23/2013 | Points: 10 | Views : 1164 | Status : [Member] | Replies : 5
"<div id ='divWarningHeading' style='background-image:url(Images/pnlHeader.JPG);margin-left:1%;height:23px;width:29%;text-align:center;color:black;font-family: tahoma,arial,verdana,sans-serif;font-weight:bold;font-size:11px;'>Alert Panel</div>"

I've used upper code. But I am not able to set my text at aligned level. Can any one suggest any other trick?

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It



Responses

Posted by: kgovindarao523-21772 on: 9/23/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,

Try in this way,

<div id='divWarningHeading' style='background-image: url(Images/loading.gif); background-repeat: no-repeat;
margin-left: 1%; height: 40px; width: 29%; text-align: center; color: black;
font-family: tahoma,arial,verdana,sans-serif; font-weight: bold; font-size: 11px;'>
<br />
<br />
Alert Panel</div>
</form>

Thank you.

Thank you,
Govind

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/23/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer
http://www.w3schools.com/cssref/pr_pos_vertical-align.asp
http://stackoverflow.com/questions/1881245/css-vertically-align-div-content
For "Text vertical align in a div" refer this link
http://stackoverflow.com/questions/9249359/text-vertical-align-in-a-div
span { display:inline-block; vertical-align:middle }



Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/23/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Simple trick to get rid of vertical alignment in DIV is as follows:
you could set the line-height of your text to be the same as the height of your div container and this is what you would get:
Refer the code from this link
http://bavotasan.com/2010/a-simple-css-trick-to-vertically-align-text/
div.container {

width: 100px;
height: 100px;
background: #666;
color: #fff;
text-align: center;
line-height: 100px; /* where the magic happens */
}


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: aswinialuri-19361 on: 9/24/2013 [Member] Starter | Points: 25

Up
0
Down
hi,
refer this link i hope it will help you
http://stackoverflow.com/questions/14028729/vertical-align-element-in-div

Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/24/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Have you resolved the above issue? If yes, "Mark it as answer" ; else post us back

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Nismeh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response