将文本居中放置任何屏幕尺寸

时间:2014-10-20 09:40:13

标签: css twitter-bootstrap

有人可以帮助我使用javascript或css中心我的文字吗? 我正在使用bootstrap。

这是我的HTML代码

<header id="home">
    <div class="container">
      <div class="row banner" style="margin-top: 0px;">
        <div class="banner-text">
          <h1 class="responsive-headline wow zoomIn animated" style="font-size: 72px; visibility: visible; animation-name: zoomIn;">I'm <span>Alyssa Reyes</span></h1>
          <h3 class="wow fadeInUp animated" style="visibility: visible; animation-name: fadeInUp;">I'm a passionate <span>Web Designer</span> and <span>Developer</span> creating modern and responsive design for <span>Web</span> and <span>Mobile</span>. <br> Let's start and learn more <a href="#about" class="smoothscroll">about me</a>.</h3>
          <hr>
        </div>
      </div>
    </div>
</header>

由于

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以使用text-align属性

 <h1>Alyssa Reyes</h1>


 css

 h1{
    text-align:center;
   }

Demo of your page

如果您想垂直居中,可以使用

 .banner-text {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: -50%;
    transform: translate(-50%, -50%) }

demo