Html 如何将文本向上和向右移动一点?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27108563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to move the text a bit up and to the right?
提问by Mike Lammers
How it should be: http://prntscr.com/59nrxz
应该如何:http: //prntscr.com/59nrxz
How it is: http://prntscr.com/59nsfg
它是怎么回事:http: //prntscr.com/59nsfg
My HTML:
我的 HTML:
<div class="col-md-6 logo" id="header-logo">
<a href="{{ path('static_page', {template:'home'}) }}" title="Return Home">
<img alt="logo" src="static/img/Risne-Logo.png"></img>
<span class="logo_left">RISNE</span>
<span class="logo_right">STARS</span>
</a>
</div>
My CSS:
我的CSS:
.logo_left, .logo_right {
font-family: "Droid Sans";
font-size: 34px;
top: -20px;
}
.logo_right {
color: #FECD0F;
}
.logo_left {
color: #234371;
}
I don't care about font or anything, i just need to get the text to move to the right position.
我不在乎字体或任何东西,我只需要让文本移动到正确的位置。
回答by Drown
Depending on what you want, a simple position: relative
could do the trick.
根据您的需要,一个简单的方法position: relative
就可以解决问题。
.logo{
position: relative;
top: -20px; /* This will move it 20px up */
left: 20px; /* This will move it 20px to the right */
}
That'a assuming that you put both of your span
's in a div
(or heading) that has a class of logo
.
假设您将两个span
's 放在div
具有logo
.
回答by Vianney Roj
Try this it might do the trick :
试试这个它可能会成功:
.logo_left, .logo_right{
vertical-align : top;
margin-left : 10px;
}