用图像HTML定位文本

时间:2022-11-19 13:29:27

I have a small problem here. I have a Div and I would like the text to float either side in the centre.

我这里有一个小问题。我有一个Div,我希望文本在中心两侧浮动。

I include a screenshot of it presently and how I would like it to look does anyone have any idea if this is achievable or do I need to make it an actual image?

我现在包括它的截图以及我希望它看起来如果有人知道这是否可以实现或者我是否需要使其成为实际图像?

用图像HTML定位文本

JS Fiddle >> http://jsfiddle.net/DU4u4/

JS小提琴>> http://jsfiddle.net/DU4u4/

3 个解决方案

#1


2  

You can try with vertical-align: middle

您可以尝试使用vertical-align:middle

#2


2  

..........................................

Now used to line-height for this

现在用于行高

#3


1  

Hope, this is something you need...

希望,这是你需要的......

Check DEMO

HTML

<div id="socialConnect">
    <div class="fbConnect">Follow us on</div>
    <div class="twitterConnect">OR</div>
</div>

CSS

.fbConnect{
    background-image:url('http://www.seedaneed.com/images/fb_btn.png');
    background-repeat:no-repeat;
    background-position:right;
    height:32px;
    width:125px;
    float:left;
    padding-top:10px;
}

.twitterConnect{
    background-image:url('http://www.boson.com/images/twitter-button.jpg');
    background-repeat:no-repeat;
    background-position:right;
    height:32px;
    width:60px;    
    float:left;    
    padding-top:10px;
    padding-left:5px;
    text-align:left;
}

#1


2  

You can try with vertical-align: middle

您可以尝试使用vertical-align:middle

#2


2  

..........................................

Now used to line-height for this

现在用于行高

#3


1  

Hope, this is something you need...

希望,这是你需要的......

Check DEMO

HTML

<div id="socialConnect">
    <div class="fbConnect">Follow us on</div>
    <div class="twitterConnect">OR</div>
</div>

CSS

.fbConnect{
    background-image:url('http://www.seedaneed.com/images/fb_btn.png');
    background-repeat:no-repeat;
    background-position:right;
    height:32px;
    width:125px;
    float:left;
    padding-top:10px;
}

.twitterConnect{
    background-image:url('http://www.boson.com/images/twitter-button.jpg');
    background-repeat:no-repeat;
    background-position:right;
    height:32px;
    width:60px;    
    float:left;    
    padding-top:10px;
    padding-left:5px;
    text-align:left;
}