Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.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 如何在一个div内对齐2个div?_Html_Css_Header - Fatal编程技术网

Html 如何在一个div内对齐2个div?

Html 如何在一个div内对齐2个div?,html,css,header,Html,Css,Header,我有这个问题: 这是一个标题 0 比萨饼车 如果你转到那个页面,你会看到右边的div实际上是在标题下对齐的 如何将右div设置在标题内?Afloat始终浮在下一个元素的上方。因此,将标题购物车放在购物车标题之前 Obs:我没有修小提琴,你必须做一些严重的调整。除其他事项外,您没有引用ID… 使用“显示:块内联”可防止块使用100%宽度。在购物车上使用浮子,并设置收割台的高度,以便购物车能够适应。拼写检查高度,CSS中有一个高度被忽略,不需要 #header-parent { pad

我有这个问题:


这是一个标题
0
比萨饼车
如果你转到那个页面,你会看到右边的div实际上是在标题下对齐的


如何将右div设置在标题内?

A
float
始终浮在下一个元素的上方。因此,将
标题购物车
放在
购物车标题
之前

Obs:我没有修小提琴,你必须做一些严重的调整。除其他事项外,您没有引用ID…

使用“显示:块内联”可防止块使用100%宽度。在购物车上使用浮子,并设置收割台的高度,以便购物车能够适应。拼写检查高度,CSS中有一个高度被忽略,不需要

#header-parent {
    padding-top:5px;
    padding-bottom:5px;
    border-bottom: 1px solid White;
    background: #45484d; /* Old browsers */
    background: -moz-linear-gradient(top, #45484d 43%, #000000 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(43%,#45484d), color-stop(100%,#000000)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #45484d 43%,#000000 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #45484d 43%,#000000 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top, #45484d 43%,#000000 100%); /* IE10+ */
    background: linear-gradient(to bottom, #45484d 43%,#000000 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#45484d', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
}

#header {
    position: relative;
    margin-left: auto;
    margin-right: auto;
    cursor: pointer;
    height: 36px; /* same as cart */
}

 #header-child{
    padding:5px 0 5px 0;
    display:inline-block;
}
#header-title {
    display:inline-block;
}
#header-title img{
    width: 25px;
    heigth: 25px;
    margin-right:5px;
    vertical-align: middle;
}

 #header-cart{
    display: inline-block;
    text-align:center;
    background-color:red;
    float:right;
    color:white;
    font-size: 15px;
}

 #header-cart img{
    width: 30px;
    heigth: 30px;
}

 #header-cart #cart-icon{
    float:left;
}
 #header-cart #cart-title{
    float:left;
}

 #header-cart #header-title{
    display: inline-block;
     background-color:blue;
}

#header-title span{

    color: white;
    font-family: Georgia, Times, "Times New Roman", serif;
    font-size:20px;
    margin-top: 0;
    margin-bottom: 0;
    vertical-align: middle;
}
#header-parent {
    padding-top:5px;
    padding-bottom:5px;
    border-bottom: 1px solid White;
    background: #45484d; /* Old browsers */
    background: -moz-linear-gradient(top, #45484d 43%, #000000 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(43%,#45484d), color-stop(100%,#000000)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #45484d 43%,#000000 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #45484d 43%,#000000 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top, #45484d 43%,#000000 100%); /* IE10+ */
    background: linear-gradient(to bottom, #45484d 43%,#000000 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#45484d', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
}

#header {
    position: relative;
    margin-left: auto;
    margin-right: auto;
    cursor: pointer;
    height: 36px; /* same as cart */
}

 #header-child{
    padding:5px 0 5px 0;
    display:inline-block;
}
#header-title {
    display:inline-block;
}
#header-title img{
    width: 25px;
    heigth: 25px;
    margin-right:5px;
    vertical-align: middle;
}

 #header-cart{
    display: inline-block;
    text-align:center;
    background-color:red;
    float:right;
    color:white;
    font-size: 15px;
}

 #header-cart img{
    width: 30px;
    heigth: 30px;
}

 #header-cart #cart-icon{
    float:left;
}
 #header-cart #cart-title{
    float:left;
}

 #header-cart #header-title{
    display: inline-block;
     background-color:blue;
}

#header-title span{

    color: white;
    font-family: Georgia, Times, "Times New Roman", serif;
    font-size:20px;
    margin-top: 0;
    margin-bottom: 0;
    vertical-align: middle;
}