以CSS为中心的文本

以CSS为中心的文本,css,Css,黄色条为宽度:100%标题 我希望实现主文本始终居中,无论边文本的长度如何 文本之间的边距为100px 图片: 提前谢谢 编辑:迄今为止的HTML和CSS: HTML: 如果我能理解的话,那可能就是你想要的 CSS .left{ float:left; background:yellow; } .right{ float:right; background:green; } .middle{ display:inline-block; *disp

黄色条为
宽度:100%
标题

我希望实现主文本始终居中,无论边文本的长度如何

文本之间的边距为100px

图片:

提前谢谢

编辑:迄今为止的HTML和CSS:

HTML:


如果我能理解的话,那可能就是你想要的

CSS

.left{
    float:left;
    background:yellow;
}
.right{
    float:right;
    background:green;
}
.middle{
    display:inline-block;
    *display:inline/*For IE7*/
    *zoom:1;
    vertical-align:top;
    background:red;
    margin:0 100px;
}
.parent{
    text-align:center;
}
.parent div{
    text-align:left;
}
.one{
width:90%;
    margin:0 auto;
    overflow:hidden;
    background:green;
    text-align:center;
}

.left{
    float:left;
    background:yellow;
    width:20%;

}

.center{
    margin:0 auto;
    background:pink;
    width:50%;




}

.right{
    float:right;
    background:red;
    width:20%;

}
HTML

<div class="parent">
 <p class="left">L side Text</p>
 <p class="middle">Center side Text</p>
 <p class="right">R side Text</p>
</div>
<div class="one">
    <div class="left">Left</div>
    <div class="right">right</div>
    <div class="center">center</div>
</div>

左侧文本

中间侧文字

R侧文本

检查这个

已更新

这就是你想要的吗


选中此项

嗨,您可以像这样使用浮动

CSS

.left{
    float:left;
    background:yellow;
}
.right{
    float:right;
    background:green;
}
.middle{
    display:inline-block;
    *display:inline/*For IE7*/
    *zoom:1;
    vertical-align:top;
    background:red;
    margin:0 100px;
}
.parent{
    text-align:center;
}
.parent div{
    text-align:left;
}
.one{
width:90%;
    margin:0 auto;
    overflow:hidden;
    background:green;
    text-align:center;
}

.left{
    float:left;
    background:yellow;
    width:20%;

}

.center{
    margin:0 auto;
    background:pink;
    width:50%;




}

.right{
    float:right;
    background:red;
    width:20%;

}
HTML

<div class="parent">
 <p class="left">L side Text</p>
 <p class="middle">Center side Text</p>
 <p class="right">R side Text</p>
</div>
<div class="one">
    <div class="left">Left</div>
    <div class="right">right</div>
    <div class="center">center</div>
</div>

左边
正确的
居中
现场演示

请发布您的HTML和CSS@Curt补充。这并没有什么特别的。是的,但正如我在这里看到的,居中文本会移动,这取决于边文本的长度。