Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 使文本在所有屏幕大小下都保持在页面的中间/中间? 我试图让我的页眉停留在页面的中间,不管我的窗口大小是多少。_Html_Css_Twitter Bootstrap - Fatal编程技术网

Html 使文本在所有屏幕大小下都保持在页面的中间/中间? 我试图让我的页眉停留在页面的中间,不管我的窗口大小是多少。

Html 使文本在所有屏幕大小下都保持在页面的中间/中间? 我试图让我的页眉停留在页面的中间,不管我的窗口大小是多少。,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我试过使用引导程序 <div class="row"> <div class="col-lg-4 col-lg-offset-4"> <h1 class=" section-title ">StackOverflow</h1> </div> </div> 然后,一旦我缩小我的窗口,我的标题继续回到左边。 我怎样才能阻止它?最好的方法是什么 -如果你需要的话 您应该替换与:。此外,对于死点:

我试过使用引导程序

<div class="row">
    <div class="col-lg-4 col-lg-offset-4">
        <h1 class=" section-title ">StackOverflow</h1>
    </div>
</div>
然后,一旦我缩小我的窗口,我的标题继续回到左边。 我怎样才能阻止它?最好的方法是什么


-如果你需要的话

您应该替换
。此外,对于死点:

html,正文{高度:100%;宽度:100%;}
h1{文本对齐:居中;显示:内联块;垂直对齐:中间;}
.center{位置:绝对;顶部:0;左侧:0;右侧:0;左侧:0;文本对齐:中心;边框:1px实心#ccc;高度:100%;宽度:100%;垂直对齐:中间;}

居中的

如果您只需要将文本居中

h1{
文本对齐:居中;
边框:1px纯红;
}

Hello
页边距:0自动用于以指定宽度居中块元素。对于文本,应使用
文本对齐:居中
.section-title {
    margin-left:auto;
    margin-right;auto;
}