为什么Inline-block没有做我期待的事情?

时间:2016-08-01 03:47:09

标签: html css

大约一周前,我所有的div都在同一条线上正确对齐。

我不知道我做了什么导致他们堆叠。 “fbox”设置为内联块,但它作为一个块。

我真的不想问这个问题,但是我因为对此感到沮丧而浪费时间。

<div class="fbox" id="breast">
        <span class="title">Breast Procedures</span>
        <ul>
            <li>Breast Augmentation</li>
            <li>Breast Lift</li>
            <li>Breast Reduction</li>
            <li>Gynecomastia Surgery</li>
            <li>Breast Implant</li>
            <li>Nipple Surgery</li>
            <li>Breast Asymmetry</li>
        </ul>
<a href="#"><span class="read">View Descriptions</span></a>
    </div>


    <div class="fbox" id="facial">
        <span class="title">Facial Procedures</span>
        <ul>
            <li>Brow Lift</li>
            <li>Face Lift</li>
            <li>Eyelid Lift</li>
            <li>Nose Surgery</li>
            <li>Facial Implant</li>
            <li>Neck Lift</li>
            <li>Earlobe Repair</li>
            <li>Ear Reshaping</li>
            <li>Chin Implant</li>
            <li>Chin Augmentation</li>
        </ul>
<a href="#"><span class="read">View Descriptions</span></a>
    </div>

<div class="padding">
    <div class="fbox" id="body">
        <span class="title">Body Procedures</span>
        <ul>
            <li>Tummy Tuck</li>
            <li>Liposuction</li>
            <li>Mommy Makeover</li>
            <li>Butt Lift</li>
            <li>Body Contouring</li>
            <li>Labiaplasty</li>
            <li>Brachioplasty</li>
            <li>Thigh Lift</li>
            <li>Upper Body Lift</li>
        </ul>
<a href="#"><span class="read">View Descriptions</span></a>
    </div>
</div>

    <div class="fbox" id="surgery">
        <span class="title">Non-Surgical Procedures</span>
        <ul>
            <li>Fat Injection</li>
            <li>Latisse</li>
            <li>Botox</li>
            <li>Dermabrasion</li>
            <li>Chemical Peels</li>
        </ul>
<a href="#"><span class="read">View Descriptions</span></a>
    </div>

CSS :(底部的主要代码.fbox,.read,.title)

.controls{
    display:none;
}            
.col span_6 {
text-color:black;
color:black;
}
.subheader{
text-color:black;
color:black;
}
.callbox{
    background-color:white;
    border-style:solid;
    border-width:1px;
    border-color:black;
    display:block;
    text-align:center;
    height:75px;
    width:1116.95px;
    line-height:75px;
    font-size:22px;
    font-weight:bold;
}

.toggle h3 a{
    color:black;
}
body .toggle > div {
        padding: 10px 14px;
    border-top: 0px;
    border:1px solid #D2691E;
    display: none;
    background-color: #fff!important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
/** .receptionist{
        border:1px solid #D2691E; 
        display:block;
        padding:5px;
        border-radius:5px;
}
**/
.menu-item{
    font-weight:600;
}
.hr{
    display: block;
    height: 1px;
    border: 1px solid #8CAAD2;
    margin: 1em 0;
    padding: 0; 
}
.settingsFront{
    height:10px;
}
.settingsMessage{
    height:150px;
}
.settingsMessageMain{
    height:200px;
}

/** Start here ! **/
.title{
    font-size:16px;
    margin:0 auto;
text-align:center;
font-weight:600;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color:white;
  background:white;
  font-family:Futura;
    -webkit-transition:  box-shadow 1s ease;
 -moz-transition:  box-shadow 1s ease;
 -o-transition:  box-shadow 1s ease;
 -ms-transition: box-shadow 1s ease;
 transition: box-shadow 1s ease;
-moz-box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
-webkit-box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
}
.main-content ul li{
    list-style-type:none;

}
.main-content ul{
    margin:0 auto;
}
.fbox{
width: 250px;
height: 300px;
background: rgb(250, 250, 250);
-moz-box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
-webkit-box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
display:inline-block;
vertical-align:top;
text-align:center;
margin:0 auto;
position:relative;

}

.read{
  width: 100%;

  left: 0;
  bottom: 0;
  background-color:white;
  background:white;
  font-size:22px;
  height:40px;
  line-height:40px;
  font-family:Futura;
    -webkit-transition:  box-shadow 1s ease;
 -moz-transition:  box-shadow 1s ease;
 -o-transition:  box-shadow 1s ease;
 -ms-transition: box-shadow 1s ease;
 transition: box-shadow 1s ease;
-moz-box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
-webkit-box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
}


.read a{

color:#7e99bd; 

}
.wpcf7-form-control-wrap{
    background:white;
    background-color:white;
}
@media (max-width:767px){
 .fbox{
 width: 200px;
height: 250px;
background: rgb(250, 250, 250);
-moz-box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
-webkit-box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
box-shadow:  0px 0px 5px 1px rgb(139, 139, 139);
display:inline-block;
font-size:12px;
 } 
}

Fiddle

3 个答案:

答案 0 :(得分:1)

你的第三个div.fbox被包装在一个带有.padding类的父div中,这导致了display:inline-box规则的中断。删除第三个div.fbox元素周围的div.padding元素,div标签将再次排列。

答案 1 :(得分:0)

@Travis fbox正在inline-block工作,如果您想了解更多信息,请访问this

答案 2 :(得分:0)

如果你想要所有三个方框<ion-item ng-repeat="orang in orangs track by $index"> {{orang.nama}} </ion-item> ,你需要同一个inline-block

中的所有三个方框