我的文字位于div
的底部,但它需要位于div
的顶部。
我的CSS代码:
#pagetitle
{
float: left;
width: 472px;
height: 109px;
font-size: 80px;
font-family: 'CodePro';
padding: 0px;
margin: 0px;
}
html, body{
margin:0 !important;
padding:0 !important;
opacity: 0.99;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: #cfcfcf;
}
现场预览在link
试试这个:
#pagetitle
{
line-height: 23px; /* or so, it depends on your need*/
}
它似乎与你正在使用的字体系列(CodePro)有一些关系,如果你将字体系列更改为Helvetica,你会看到你期望的效果。您可以通过几种不同的方式调整文本的位置。
margin-top: -30px;
要么
line-height: 40px;
到#pagetitle,仅举几例。
它是字体的字体和大小。你可以给它一些负余量或一些线高。
#pagetitle {
margin-top: -30px;
}
将此添加到您的CSS:
#pagetitle
{
line-height: 10px;
}
如果它的问题是使用line-height属性。我一直觉得安全...
position:relative;
top:-20px;
在
#pagetitle
{
float: left;
width: 472px;
height: 109px;
font-size: 80px;
font-family: 'CodePro';
padding: 0px;
margin: 0px;
position:relative;
top:-20px;
}
和top:-20px
一起玩,以获得理想的结果。