0

trying to display four images in row. html code`

<section class ="selection-meals">
                         <ul class="meal-showcase">
                         <li>
                             <figure class="meal-photo">
                             <img src="resources/css/imgs/1.jpg" alt="meal1">
                             </figure>
                         </li>
                             <li>
                             <figure class="meal-photo">
                             <img src="resources/css/imgs/2.jpg" alt="meal2">
                             </figure>
                         </li>
                                 <li>
                             <figure class="meal-photo">
                             <img src="resources/css/imgs/3.jpg" alt="meal3">
                             </figure>
                         </li>
                                     <li>
                             <figure class="meal-photo">
                             <img src="resources/css/imgs/4.jpg" alt="meal4">
                             </figure>
                         </li>
                             </ul>

                        <ul class="meal-showcase">
                         <li>
                             <figure class="meal-photo">
                             <img src="resources/css/imgs/5.jpg" alt="meal5">
                             </figure>
                         </li>
                             <li>
                             <figure class="meal-photo">
                             <img src="resources/css/imgs/6.jpg" alt="meal6">
                             </figure>
                         </li>
                                 <li>
                             <figure class="meal-photo">
                             <img src="resources/css/imgs/7.jpg" alt="meal7">
                             </figure>
                         </li>
                                     <li>
                             <figure class="meal-photo">
                             <img src="resources/css/imgs/8.jpg" alt="meal8">
                             </figure>
                         </li>
                             </ul>
                     </section>`

CSS3 code

 meals-showcase{
    list-style: none;
    width:100%;
}

.meals-showcase li{
    display:block;
    float: left;
    width:25%;
}

.meal-photo{
    width:100%
    margin:0;
}

.meal-photo img{
    width 100%;
    height: auto;
}

also tried this

ul{
    white-space: nowrap;
}

ul,li{
    list-style:none;
    display: inline;
}

anyone got any suggestions?
thanks alot

3
Contributors
3
Replies
12
Views
2 Years
Discussion Span
Last Post by Khan2014
0

Basic CSS to display the list horizontally...

ul {
  list-style:none;
}

ul li {
  float:left;
}
1

It's caused by a typo. In your HTML you have meal-showcase and in your css meals-showcase.

And on a side note; if you float an inline element, it turns automatically into a block element, so declaring it is not needed.

Edited by gentlemedia

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.