2016-08-04 19 views
0

Ich habe eine Website erstellt, und alles hat wie erwartet funktioniert, bis ich plötzlich nichts auf der gleichen Zeile angezeigt bekommen konnte, obwohl ähnliche Code zuvor auf dieser Website gearbeitet hat. Die Seite zeigt Bilder auch anders an, obwohl es das gleiche Bild und div CSS ist. Ich baue auf Drupal mit HTML und CSS auf. Mein HTML-Code istCSS nicht wie erwartet

<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> 

Meine CSS ist:

.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%;} 
} 

Antwort

1

klar entfernen: both; Eigenschaft aus dem .foodblock-Selektor in Ihrem CSS. Dadurch werden Ihre Spalten inline angezeigt.

+0

Danke, ich dachte, ich hätte schon versucht, es zu entfernen, aber anscheinend nicht. Dies behebt das Problem, wenn es nicht inline angezeigt wird. Das Problem des Power-Bowl-Div-Bildes, das kleiner als alle anderen Bilder ist, existiert jedoch immer noch. –

+0

All Ihr Code sieht gut aus und alle Divs einschließlich Power-Bowl sind gleich. Ich denke, dass Sie das bereits wissen, wenn Sie eine kleinere Breite wie 20% Ihrer Col Divs setzen, werden sie inline sein. Jetzt habe ich nicht den vollständigen Link zu Ihren Bildern, sodass ich nicht sehen kann, ob Sie die Bilder möglicherweise in der gleichen Größe speichern müssen. Das Power-Bowl-Div erscheint nur kleiner, weil es zwei Wörter gibt und die anderen Divs mehr haben. Power-Bowl-Divs, Local-Bacon-Apple usw. Divs füllen die Größe von Col Divs. – Vcasso

+0

Meine Bilder sind inline dank Ihrer Lösung zum Entfernen klar. Das Div ist definitiv kleiner. Alle Bilder sind gleich, so dass sie die gleiche Größe haben sollten. Ich habe einen Link zu einem Bild meiner Website eingefügt. http://imgur.com/KSlPTEF. Die Wortzählung sollte dies jedoch nicht beeinflussen, da der col div die Breite no? –