开发者

Set text alignment in div tag

I have a div tag in which there is an image in left corner and in the middle of the div tag I want to write title of my web application. But I am not able to set text alignment in middle of the div tag. I tried text-align,valign properties with various values but could not set it. Can you please guide me how to to this.

CSS for my div tag is as below

    #head
    {
    background-color: #EEE685;
    overflow: auto;
    width: 100%;
    text-indent:10;开发者_运维知识库
    text-align:justify; 
     }


You have to use text-align: center;, see this fiddle: http://jsfiddle.net/alp82/e3hgu/


Applying CSS text-align:center to a block element centers its contents.


<div>
    <img alt="" src="images/accessbg.jpg" align="left"></img>
    <h2 align="center">Test</h2>
</div>

The above code will work for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜