Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.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
Css 两个文本重叠并水平对齐_Css - Fatal编程技术网

Css 两个文本重叠并水平对齐

Css 两个文本重叠并水平对齐,css,Css,我想在css中叠加两个文本 我写道: HTML: 但我想让这两个文本水平居中。(类似但重叠) 我该怎么做?尝试添加以下内容: #w1 { padding-left: 100px; } 希望这就是你想要的: 首先,通过设置left:50%使其居中。 然后,设置一个宽度,例如width:400px 跨度现在有一个偏移量,让我们修正左边的边距:-200px(使用一半宽度) 然后,最后,将span:文本对齐:居中如果这是一种方法,那么您可以添加#w1{left:40px;}好,但我需要将宽度设置为

我想在css中叠加两个文本

我写道:

HTML:

但我想让这两个文本水平居中。(类似但重叠)

我该怎么做?

尝试添加以下内容:

#w1 { 
padding-left: 100px;
}

希望这就是你想要的:

首先,通过设置
left:50%使其居中。
然后,设置一个宽度,例如
width:400px
跨度现在有一个偏移量,让我们修正左边的
边距:-200px(使用一半宽度)

然后,最后,将span:
文本对齐:居中

如果这是一种方法,那么您可以添加#w1{left:40px;}好,但我需要将
宽度设置为最大的宽度(我没有)。
#container
{
    position:relative;
}
#w1,#w2
{
    position:absolute;
    top:0px;
    left:0px;    
}
#w1 { 
padding-left: 100px;
}