Css 我需要在页面中间对齐的文本,还有中间页面中的文本。 >,我想让我的文本在页面中间对齐,我还想要一个单独的div,中间有页面底部的文本。

Css 我需要在页面中间对齐的文本,还有中间页面中的文本。 >,我想让我的文本在页面中间对齐,我还想要一个单独的div,中间有页面底部的文本。,css,html,Css,Html,这是我的CSS代码 #header { text-align:center; color:white; font-family:'Capture'; font-size:34px; margin: auto; width: 800px;} #slogan { text-align:center } @font-face { font-family:'Capture'; src:url(/fonts/Capture_it.ttf); } .info-container {

这是我的CSS代码

#header { text-align:center; color:white; font-family:'Capture'; font-size:34px; margin: auto; width: 800px;}
    #slogan { text-align:center }

    @font-face { font-family:'Capture'; src:url(/fonts/Capture_it.ttf); }
    .info-container { width: 840px; border: 1px solid #d8d5c6: padding: 4px; margin: 40px auto 0; }

    .inner-border { background-color: #fcfbf9; border: 1px solid #d8d5c6; padding: 10px 20px; }

    .coming-soon-visitor strong, .coming-soon-owner strong { font-weight: bold; color: #000; }

    .coming-soon-owner { float: left; font-size: 14px; color: #6d6a5b; font-weight: normal; width: 400px; border-right: 1px solid #d9d6c5; padding: 10px 0; margin-bottom: 10px; }

    .coming-soon-visitor { float: left; font-size: 14px; color: #6d6a5b; font-weight: normal; padding-left: 20px; padding: 10px 0 10px 20px; margin-bottom: 10px; }
此处显示您的文本
还有你的css

<div id="my-div">Your text here</div>

#my-div{ text-align: center }
此处显示您的文本
#我的div{text align:center}
如果你的意思是“我希望我的DIV居中”,那么你可能希望:

<div id="my-div">Your text here</div>

#my-div{ width: 800px; margin: 0 auto; text-align: center }
此处显示您的文本
#我的div{宽度:800px;边距:0自动;文本对齐:中心}

除此之外,您的问题可能过于模糊,无法给出您想要的答案。请查看下面的代码是否有帮助:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>align</title>
<style type="text/css">
body {
    margin: 0px;
    padding: 0px;
}
#text_center {
    text-align: center;
    width: 200px;
    position:absolute;
    left:50%;
    top:50%;
    margin-left:-100px;
    margin-top:-20px;
}
#text_bottom {
    text-align: center;
    width: 200px;
    position:absolute;
    left:50%;
    bottom:1%;
    margin-left:-100px;
}
</style>
</head>
<body>
    <div id="text_center">Text 1</div>
    <div id="text_bottom">Text 2</div>
</body>
</html>

排列
身体{
边际:0px;
填充:0px;
}
#文本中心{
文本对齐:居中;
宽度:200px;
位置:绝对位置;
左:50%;
最高:50%;
左边距:-100px;
利润上限:-20px;
}
#文本底部{
文本对齐:居中;
宽度:200px;
位置:绝对位置;
左:50%;
底部:1%;
左边距:-100px;
}
文本1
文本2

您有什么问题?我不喜欢为自己测试每一个代码,请在你的帖子中提供更多信息。这也很简单,从你所说的,请尝试为自己研究更多。一个开始的好地方:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>align</title>
<style type="text/css">
body {
    margin: 0px;
    padding: 0px;
}
#text_center {
    text-align: center;
    width: 200px;
    position:absolute;
    left:50%;
    top:50%;
    margin-left:-100px;
    margin-top:-20px;
}
#text_bottom {
    text-align: center;
    width: 200px;
    position:absolute;
    left:50%;
    bottom:1%;
    margin-left:-100px;
}
</style>
</head>
<body>
    <div id="text_center">Text 1</div>
    <div id="text_bottom">Text 2</div>
</body>
</html>