首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CSS未按预期分开

CSS未按预期分开
EN

Stack Overflow用户
提问于 2016-08-04 15:48:36
回答 1查看 61关注 0票数 0

我一直在建立一个网站,一切都像预期的那样,直到我突然无法在同一条线上显示任何东西,即使类似的代码以前在这个网站上工作过。该网站还显示不同的图像,即使它是相同的图像和div。我正在用HTML和CSS构建Drupal。我的HTML代码是

代码语言:javascript
复制
<div class="foodblock col-m-3 col-3"><a href="kale-grain-bowls/spicy-avocado-lime"><div class="spicy-avocado-lime">SPICY AVOCADO & LIME</div></a>
<div class="textblock"></div></div>
<div class="foodblock col-m-3 col-3"><a href="kale-grain-bowls/toasted-almond-ginger"><div class ="toasted-almond-ginger">TOASTED ALMOND & GINGER</div></a>
<div class="textblock"></div></div>
<div class="foodblock col-m-3 col-3"><a href="kale-grain-bowls/local-apple-bacon"><div class="local-apple-bacon-bowl">LOCAL APPLE & BACON BOWL</div></a>
<div class="textblock"></div></div>
<div class="foodblock col-m-3 col-3"><a href="kale-grain-bowls/power-bowl"><div class="power-bowl">POWER BOWL</div></a><div class="textblock"></div></div>

我的css是:

代码语言:javascript
复制
.foodblock{
    float: left;
    clear: both;
    margin: 15px;
    height: 300px;
}
.textblock{
    float: left;
}
.spicy-avocado-lime{
    height: 200px;
    background-image: url('../images-source/communitybottom.png');
    float: left;
}
.toasted-almond-ginger{
    height: 200px;
    background-image: url('../images-source/communitybottom.png');
    float: left;
}
.local-apple-bacon-bowl{
    height: 200px;
    background-image: url('../images-source/communitybottom.png');
    float: left;
}
.power-bowl{
    height: 200px;
    background-image: url('../images-source/communitybottom.png');
    float: left;
}/*for mobile phones: */
    [class*="col-"]{
        width:100%;
    }

@media only screen and (min-width: 600px) {
    /* For tablets: */
    .col-m-1 {width: 8%;}
    .col-m-2 {width: 16%;}
    .col-m-2-5 {width: 21.55%;}
    .col-m-3 {width: 24%;}
    .col-m-4 {width: 32.5%;}
    .col-m-5 {width: 40%;}
    .col-m-6 {width: 48%;}
    .col-m-7 {width: 56%;}
    .col-m-8 {width: 65.7%;}
    .col-m-9 {width: 72%;}
    .col-m-10 {width: 80%;}
    .col-m-11 {width: 88%;}
    .col-m-12 {width: 96%;}
}
@media only screen and (min-width: 768px){
    /*for mobile desktop: */
    .col-1 {width: 8%;}
    .col-2-5 {width: 21.55%;}
    .col-2 {width: 16%;}
    .col-3 {width: 24%;}
    .col-4 {width: 32.5%;}
    .col-5 {width: 40%;}
    .col-6 {width: 48%;}
    .col-7 {width: 56%;}
    .col-8 {width: 65.7%;}
    .col-9 {width: 72%;}
    .col-10 {width: 80%;}
    .col-11 {width: 88%;}
    .col-12 {width: 96%;}
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-08-04 16:39:37

从您的css中的.foodblock选择器移除:两者;属性。这将显示你的结肠内联。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38771980

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档