如何将文本向上和向右移动一点? [英] How to move the text a bit up and to the right?
本文介绍了如何将文本向上和向右移动一点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
应该如何:http://prntscr.com/59nrxz
我的 HTML:
<a href="{{ path('static_page', {template:'home'}) }}" title="返回首页"><img alt="logo" src="static/img/Risne-Logo.png"></img><span class="logo_left">RISNE</span><span class="logo_right">STARS</span></a>
我的 CSS:
.logo_left, .logo_right {字体系列:Droid Sans";字体大小:34px;顶部:-20px;}.logo_right {颜色:#FECD0F;}.logo_left {颜色:#234371;}
我不在乎字体或任何东西,我只需要让文本移动到正确的位置.
解决方案
根据您的需要,一个简单的 position:relative
就可以解决问题.
.logo{位置:相对;顶部:-20px;/* 这会将它向上移动 20px */左:20px;/* 这会将它向右移动 20px */}
假设您将两个 span
放在具有 logo
类的 div
(或标题)中.
How it should be: http://prntscr.com/59nrxz
How it is: http://prntscr.com/59nsfg
My 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:
.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.
解决方案
Depending on what you want, a simple position: relative
could do the trick.
.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
.
这篇关于如何将文本向上和向右移动一点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文