简体   繁体   English

如何在中间制作文字

[英]how to make text in the center

hello i am make like this example which i get from www.xxxxxx.com 你好,我是这个例子,我从www.xxxxxx.com获得

http://s1172.photobucket.com/albums/r568/novikoraharja/?action=view&current=justanimage.png http://s1172.photobucket.com/albums/r568/novikoraharja/?action=view&current=justanimage.png

i wanted too learn that so can you help me? 我也想知道,所以你能帮我吗?

<div class="panjang">
    <ul>

        <li class="bungkus">

            <div class="kiri"><img src="http://i1172.photobucket.com/albums/r568/novikoraharja/3.jpg"/> </div>
            <div class="kanan">Very loooooong </div>
        </li>

        <li class="bungkus">
            <div class="kiri"><img src="http://i1172.photobucket.com/albums/r568/novikoraharja/3.jpg"/></div>
            <div class="kanan">Very loooooong text sooo lonngg </div>
        </li>

    </ul>
</div>

here the style 这里的风格

.panjang{width:400px;height;100px;}

.bungkus{width:200px; height:50px; background:yellow;}
.bungkus img { width:60px; height:40px; margin:5px 10px;}

.kiri { float:left; background:red; width:80px; height:50px; }
.kanan{vertical-align:middle; background:cyan; float:left;width:120px;height:50px;font-size:12px;vertical-align:middle;
}

here my works http://jsfiddle.net/76E4w/11/ 这是我的作品http://jsfiddle.net/76E4w/11/

i already add line-align:middle; 我已经添加line-align:middle; or line weight but not work; 或线宽,但不起作用;

See working jsFiddle here: 在这里查看工作的jsFiddle:

Add display: table; 添加display: table; to .bungkus . .bungkus

Remove float: left; 移除float: left; from .kanan . 来自.kanan

Add display: table-cell; 添加display: table-cell; to .kanan . .kanan

When you find a web site doing it as you like, the easiest thing is to run firefox with firebug and to look which css applies. 当您找到一个自己喜欢的网站时,最简单的方法是使用firebug运行firefox ,并查看哪个CSS适用。

centering could be done in different ways. 对中可以以不同的方式完成。 one is 一个是

text-align: center

An other approach is to set right/left margin to auto 另一种方法是将左右边距设置为自动

margin: 0 auto;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM