2014-10-20 49 views
-4

有人可以帮助我使用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

+0

随着图像没有太多可以说,提供您的代码 – laaposto 2014-10-20 09:43:39

+2

我不知道很多关于引导,但只使用谷歌在这一个。 “中心文字垂直CSS”,看?如何实现的方法有很多。许多重复之一:http://stackoverflow.com/questions/8865458/how-to-align-text-vertically-center-in-div-with-css – 2014-10-20 09:44:02

+0

向我们展示您的HTML标记和您的CSS代码,我们将能够帮助你。 :) – consuela 2014-10-20 09:49:08

回答

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

+0

我认为OP是指实施垂直居中。从屏幕截图判断,水平居中显然已经实现。 – Terry 2014-10-20 09:57:40

+0

我以为alyssa想要对齐文本,如截图 – Justin 2014-10-20 10:28:30

+1

对于bootstrap中的水平对齐,您还可以使用类文本中心。 – Legin76 2014-10-20 11:15:09