Css 3个相邻的div

Css 3个相邻的div,css,html,Css,Html,我很难将3个div相邻对齐。我以前从未遇到过这个问题,但现在我正在制作一个模板,其中背景对网页的每个元素都有100%的宽度(永不结束) 我想要水平对齐3个div的元素对我不起作用。我可以让两个div相邻,但是当我尝试对齐第三个div时,第三个div会对齐,但是整个元素不知怎么搞砸了 非常感谢你的帮助 这是完整的代码。我使用了其他网站元素来简化代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "htt

我很难将3个div相邻对齐。我以前从未遇到过这个问题,但现在我正在制作一个模板,其中背景对网页的每个元素都有100%的宽度(永不结束)

我想要水平对齐3个div的元素对我不起作用。我可以让两个div相邻,但是当我尝试对齐第三个div时,第三个div会对齐,但是整个元素不知怎么搞砸了

非常感谢你的帮助

这是完整的代码。我使用了其他网站元素来简化代码:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test Website</title>

<style type="text/css">
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-weight: inherit;
    font-style: inherit;
    font-size: 100%;
    vertical-align: baseline;
}
/* remember to define focus styles! */
:focus {
    outline: 0;
}
body {
    line-height: 1;
    color: black;
    background: white;
}
ol, ul {
    list-style: none;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
    border-collapse: separate;
    border-spacing: 0;
}
caption, th, td {
    text-align: left;
    font-weight: normal;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: "";
}
blockquote, q {
    quotes: "" "";
}

strong {
    font-weight:bold;color:#0289ce;
}

em {
    font-style:oblique;
}

p {
    margin:15px 0;
}

.aligncenter, div.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.alignleft {
    float: left;
}
.alignright {
    float: right;
}

h1 {font-size:180%;}
h2 {font-size:150%;}
h3 {font-size:125%;}
h4 {font-size:100%;}
h5 {font-size:90%;}
h6 {font-size:80%;}

a:link {color:#0289ce;}
a:hover {color:#f64274;}

/*End RESET - Begin Full Width CSS*/
    body {
        background:#FFFFBF;
        color:#2D1F16;
        font:13px Helvetica,  Arial,  sans-serif
    }

    .wrap {
    position:relative;
    margin:0 auto;
    width:900px;
    background-color: #EC3515;
    }
.wrapHeader {
    position:relative;
    margin:0 auto;
    width:900px;
    background-color: #9FF;
}

.wrapSlider {
    position:relative;
    width:900px;
    margin-right: auto;
    margin-left: auto;
    top: 67px;
    right: 32px;
}
.wrapPackages {
    position:relative;
    width:900px;
    margin-right: auto;
    margin-left: auto;
}
.multipleDivs {
    height: auto;
    width: 100%;
    background-color: #CFF;
    clear: both;
    position: relative;
}
.wrapInfo {
    position:relative;
    width:900px;
    margin-right: auto;
    margin-left: auto;
    background-color: #A6FFFF;
    height: auto;
    clear: both;
}
#infoContent1 {
    background-color: #666;
    height: auto;
    width: 300px;
    float: left;
    position: relative;
}
#infoContent2 {
    background-color: #999;
    height: auto;
    width: 300px;
    float: left;
    position: relative;
}
#infoContent3 {
    background-color: #CCC;
    height: auto;
    width: 300px;
}


.wrapContent {
    position:relative;
    width:100%;
    margin-top: 0;
    margin-right: auto;
    margin-bottom: 0;
    margin-left: auto;
    }




    #header, #footer {
        width:100%;
        float:left;
        padding:15px 0;
    }

    #header {
    background-color: #FFF;
    }

    #header .logo {
    float:left;
    width:400px;
    }

    #header p {
        float:right;
        width:400px;
        margin:0;
    }

    #content {
    padding:15px 0;
    clear:both;
    background-color: #F9C;
    }


 .imageSlider {
    height: 570px;
    width: 100%;
    color: #FFF;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url(../images/bgSlider2.jpg);
}
.package {
    height: auto;
    width: 100%;
    background-color: #CCC;
    background-repeat: no-repeat;
    background-position: center center;
    margin-top: 0px;
    margin-right: auto;
    margin-bottom: 0px;
    margin-left: auto;
}





    #footer {
    background:#EC3515;
    text-align:center;
    }

    #footer a {
        color:#fff;
    }
</style>

</head>

<body>

<div id="header">
    <div class="wrapHeader">
        <div class="logo">
            <a href="#"><img src="images/#.png" width="250" height="62" /></a>
         </div>
      <p>Sample text</p>
    </div>

</div>

<div class="wrapContent">
    <div id="content">



<div class="multipleDivs">
    <div class="wrapInfo">  
           <div id="infoContent1">
           <p>Div 1</p>
           <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
      </div>    

<div id="infoContent2">
           <p>Div 2</p>
           <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
      </div>

      <div id="infoContent3">
           <p>Div 3</p>
           <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
      </div>    

    </div>
</div>    






<div class="package">  
    <div class="wrapPackages">
      <img src="images/sampleImage.jpg" width="900" height="475" border="0" /></div>
</div>

    <p>&nbsp;</p>
    <p>&nbsp;</p>   

    </div>
</div>

<div id="footer">
<div class="wrap">
            <p>&copy; 2013 - <a href="http://fillertext.com">Sample Text</a></p>
    </div>
</div>

</body>
</html>

测试网站
html、正文、div、span、小程序、对象、iframe、,
h1、h2、h3、h4、h5、h6、p、块报价、预,
a、 缩写,首字母缩写,地址,大,引用,代码,
del、dfn、em、字体、img、ins、kbd、q、s、samp、,
小、走向、强、次、辅助、tt、var、,
dl,dt,dd,ol,ul,li,
字段集、表单、标签、图例、,
表格、标题、正文、tfoot、THAD、tr、th、td{
保证金:0;
填充:0;
边界:0;
大纲:0;
字体大小:继承;
字体风格:继承;
字体大小:100%;
垂直对齐:基线;
}
/*记住定义焦点样式*/
:焦点{
大纲:0;
}
身体{
线高:1;
颜色:黑色;
背景:白色;
}
ol,ul{
列表样式:无;
}
/*表仍然需要在标记中使用“cellspacing=”0“*/
桌子{
边界塌陷:分离;
边界间距:0;
}
标题,th,td{
文本对齐:左对齐;
字体大小:正常;
}
blockquote:before,blockquote:after,
问:之前,问:之后{
内容:“;
}
区块报价,q{
引号:“;
}
强壮的{
字体大小:粗体;颜色:#0289ce;
}
em{
字体风格:斜体;
}
p{
利润率:15px0;
}
.aligncenter,div.aligncenter{
显示:块;
左边距:自动;
右边距:自动;
}
.左对齐{
浮动:左;
}
.对{
浮动:对;
}
h1{字体大小:180%;}
h2{字体大小:150%;}
h3{字体大小:125%;}
h4{字体大小:100%;}
h5{字体大小:90%;}
h6{字体大小:80%;}
答:链接{color:0289ce;}
a:悬停{颜色:#f64274;}
/*结束重置-开始全宽CSS*/
身体{
背景:#FFFFBF;
颜色:#2D1F16;
字体:13px Helvetica,Arial,无衬线
}
.包裹{
位置:相对位置;
保证金:0自动;
宽度:900px;
背景色:#EC3515;
}
wrapHeader先生{
位置:相对位置;
保证金:0自动;
宽度:900px;
背景色:#9FF;
}
.wrapSlider{
位置:相对位置;
宽度:900px;
右边距:自动;
左边距:自动;
顶部:67px;
右:32px;
}
.包装{
位置:相对位置;
宽度:900px;
右边距:自动;
左边距:自动;
}
.多媒体{
高度:自动;
宽度:100%;
背景色:#CFF;
明确:两者皆有;
位置:相对位置;
}
wrapInfo先生{
位置:相对位置;
宽度:900px;
右边距:自动;
左边距:自动;
背景色:#A6FFFF;
高度:自动;
明确:两者皆有;
}
#信息内容1{
背景色:#666;
高度:自动;
宽度:300px;
浮动:左;
位置:相对位置;
}
#信息内容2{
背景色:#999;
高度:自动;
宽度:300px;
浮动:左;
位置:相对位置;
}
#信息内容3{
背景色:#CCC;
高度:自动;
宽度:300px;
}
.包装内容{
位置:相对位置;
宽度:100%;
边际上限:0;
右边距:自动;
页边距底部:0;
左边距:自动;
}
#页眉,#页脚{
宽度:100%;
浮动:左;
填充:15px0;
}
#标题{
背景色:#FFF;
}
#标题。标志{
浮动:左;
宽度:400px;
}
#标题p{
浮动:对;
宽度:400px;
保证金:0;
}
#内容{
填充:15px0;
明确:两者皆有;
背景色:#F9C;
}
.图像滑块{
高度:570px;
宽度:100%;
颜色:#FFF;
背景重复:无重复;
背景位置:中心;
背景图片:url(../images/bgSlider2.jpg);
}
.包裹{
高度:自动;
宽度:100%;
背景色:#CCC;
背景重复:无重复;
背景位置:中心;
边际上限:0px;
右边距:自动;
边缘底部:0px;
左边距:自动;
}
#页脚{
背景:#EC3515;
文本对齐:居中;
}
#页脚a{
颜色:#fff;
}
示例文本

第一组

知识产权是一种权利,是一种精英的权利,是劳动和财富的暂时性权利。但是,在最低限度上,我们需要一个实验室来进行日常工作。两人或两人在一个无教区的房间里互相指责。除偶尔因疏忽而死亡外,不得因疏忽而导致动物死亡

第2组

知识产权是一种权利,是一种精英的权利,是劳动和财富的暂时性权利。但是,在最低限度上,我们需要一个实验室来进行日常工作。两人或两人在一个无教区的房间里互相指责。除偶尔因疏忽而死亡外,不得因疏忽而导致动物死亡

第3组

知识产权是一种权利,是一种精英的权利,是劳动和财富的暂时性权利。但是,在最低限度上,我们需要一个实验室来进行日常工作。两人或两人在一个无教区的房间里互相指责。除偶尔因疏忽而死亡外,不得因疏忽而导致动物死亡

&抄袭;2013年-

<
div {
float:left;
}
.aligncenter, div.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
 }
.alignleft {
float: left;
}
.alignright {
float: right;
}
<div class="floaters">1</div>
<div class="floaters">2</div>
<div class="floaters">3</div>
.floaters {
float:left;
}
 <div class="floaters">1</div> <div class="floaters">2</div> <div
 class="floaters">3</div>
.floaters {
float:left;
}