div 中的字体如何用CSS控制居下

html-css011

div 中的字体如何用CSS控制居下,第1张

div 中的字体如何用CSS控制居下的方法:

1、用margin-top 或者padding-top 设置。

代码:

<div class="text"></div>

.text {width:??pxheight:??pxmargin-top:10px} //这里用margin或padding 都行。

2、设置行高,line-height 属性

如:line-height:30px 数字越大行高越高 行与行的距离越大。

代码:

<div class="text"></div>

.text {width:??pxheight:??pxline-height:??px}

你需要用到background-position这个属性,用以规定背景图片的位置。让图片居中偏下的代码为:

background-positon:center bottom 或 background-positon:bottom

全部的位置代码如下:

background-position: left 代表背景图横向(X轴)靠左,纵向(Y轴)居中。(9点钟位置)

background-position: right 代表背景图横向(X轴)靠右,纵向(Y轴)居中。(3点钟位置)

background-position: top 代表背景图横向(X轴)居中,纵向(Y轴)靠上。(12点钟位置)

background-position: bottom 代表背景图横向(X轴)居中,纵向(Y轴)靠下。(6点钟位置)

background-position: center 代表背景图横向(X轴)居中,纵向(Y轴)居中。(绝对居中)

background-position: left top 代表背景图横向(X轴)靠左,纵向(Y轴)靠上。(10点钟位置)

background-position: left bottom 代表背景图横向(X轴)靠左,纵向(Y轴)靠下。(7点钟位置)

background-position: right top 代表背景图横向(X轴)靠右,纵向(Y轴)靠上。(1点钟位置)

background-position: right bottom 代表背景图横向(X轴)靠右,纵向(Y轴)靠下。(5点钟位置)