Html 将文本与css垂直对齐
在我的蓝色框中垂直居中文本的最佳方式是什么 标记:Html 将文本与css垂直对齐,html,css,Html,Css,在我的蓝色框中垂直居中文本的最佳方式是什么 标记: <div class="btn-blue"> <span class="icon"></span> Some awesome text here </div> 这是小提琴 谢谢。添加行高:50px到.btn蓝色类,然后 垂直对齐:中间对齐到图标类 当只需要一行文本时,我发现将行高设置为框的高度是垂直居中文本的最简单方法。添加行高:50px到.btn蓝色类,然后 垂直对齐:中间对齐到图
<div class="btn-blue">
<span class="icon"></span>
Some awesome text here
</div>
这是小提琴
谢谢。添加
行高:50px代码>到.btn蓝色类,然后
垂直对齐:中间对齐代码>到图标类
当只需要一行文本时,我发现将行高设置为框的高度是垂直居中文本的最简单方法。添加行高:50px代码>到.btn蓝色类,然后
垂直对齐:中间对齐代码>到图标类
当只需要一行文本时,我发现将行高设置为框的高度是文本垂直居中的最简单方法。有很多方法可以垂直对齐文本,您可以在此处查看:
我个人最喜欢使用CSS表(不是html表):
html:
<div id="parent">
<div id="child">Content here</div>
</div>
有很多方法可以垂直对齐文本,您可以在此处查看:
我个人最喜欢使用CSS表(不是html表):
html:
<div id="parent">
<div id="child">Content here</div>
</div>
这是将链接显示为带有图标的按钮的另一种方法。您可以使用精灵来改进此代码,而不是使用两个单独的图像:
a.mybutton {
padding: 3px 0px 3px 30px;
color: #c00;
}
a.mybutton:link,
a.mybutton:visited,
a.mybutton:active {
background: #fff url("https://dl.dropboxusercontent.com/u/59816767/assets/map-pin_off.png") left center no-repeat;
}
a.mybutton:hover { background: #fff url("https://dl.dropboxusercontent.com/u/59816767/assets/map-pin_on.png") left center no-repeat; }
以下是:这是另一种将链接显示为带有图标的按钮的方法。您可以使用精灵来改进此代码,而不是使用两个单独的图像:
a.mybutton {
padding: 3px 0px 3px 30px;
color: #c00;
}
a.mybutton:link,
a.mybutton:visited,
a.mybutton:active {
background: #fff url("https://dl.dropboxusercontent.com/u/59816767/assets/map-pin_off.png") left center no-repeat;
}
a.mybutton:hover { background: #fff url("https://dl.dropboxusercontent.com/u/59816767/assets/map-pin_on.png") left center no-repeat; }
以下是:这已经被问了很多次了……这已经被问了很多次了。。。