Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need the three sections to be aligned horizontally, next to each other in desktop mode. Everything works fine until I set a margin around these section to space them out evenly. That is when the section that should be on the right collapses underneath the first section on the left.
Below are the html and the stylesheet. Thank you for your help.







<title>Assignment Solution for Module 2


Our Menu





      Chicken      


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.




      Beef      


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.




      Sushi      


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.








* {
box-sizing: border-box;
}

div {
margin: auto;
}

h1 {
text-align: center;
font-family: "Segoe UI","Trebuchet MS";
font-size: 28px;
color: black;
margin-top: 15px;
}

section {
background-color: #b3b0a1;
border: 1px solid black;
padding: 5px;
margin: 5px;
}

h2 {
text-align: right;
font-size: 20px;
font-family: "Segoe UI","Trebuchet MS";
background-color: #b3b0a1;
margin-top: 0px;
}

#chicken {
color: black;
background-color: #e396a4;
border: 1px solid black;
}

#beef {
color: white;
background-color: tomato;
border: 1px solid black;
}

#sushi {
color: black;
background-color: #e3d696;
border: 1px solid black;
}

p {
color: black;
text-align: left;
font-size: 16px;
font-family: "Segoe UI","Trebuchet MS";
}

.row {
width: 90%;
margin-top: 50px;
}

@media (min-width: 1200px) {
.col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {
float: left;
}

.col-lg-1 {
width: 8.33%;
}
.col-lg-2 {
width: 16.66%;
}
.col-lg-3 {
width: 25%;
}
.col-lg-4 {
width: 33.33%;
}
.col-lg-5 {
width: 41.66%;
}
.col-lg-6 {
width: 50%;
}
.col-lg-7 {
width: 58.33%;
}
.col-lg-8 {
width: 66.66%;
}
.col-lg-9 {
width: 74.99%;
}
.col-lg-10 {
width: 83.33%;
}
.col-lg-11 {
width: 91.66%;
}
.col-lg-12 {
width: 100%;
}
}

@media (min-width: 992px) and (max-width: 1199px) {
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
float: left;
}
.col-md-1 {
width: 8.33%;
}
.col-md-2 {
width: 16.66%;
}
.col-md-3 {
width: 25%;
}
.col-md-4 {
width: 33.33%;
}
.col-md-5 {
width: 41.66%;
}
.col-md-6 {
width: 50%;
}
.col-md-7 {
width: 58.33%;
}
.col-md-8 {
width: 66.66%;
}
.col-md-9 {
width: 74.99%;
}
.col-md-10 {
width: 83.33%;
}
.col-md-11 {
width: 91.66%;
}
.col-md-12 {
width: 100%;
}
}

@media (min-width: 768px) and (max-width: 991px) {
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
float: left;
}
.col-sm-1 {
width: 8.33%;
}
.col-sm-2 {
width: 16.66%;
}
.col-sm-3 {
width: 25%;
}
.col-sm-4 {
width: 33.33%;
}
.col-sm-5 {
width: 41.66%;
}
.col-sm-6 {
width: 50%;
}
.col-sm-7 {
width: 58.33%;
}
.col-sm-8 {
width: 66.66%;
}
.col-sm-9 {
width: 74.99%;
}
.col-sm-10 {
width: 83.33%;
}
.col-sm-11 {
width: 91.66%;
}
.col-sm-12 {
width: 100%;
}
}

@media (max-width: 767px) {
.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {
float: left;
border: 1px solid black;
}
.col-xs-1 {
width: 8.33%;
}
.col-xs-2 {
width: 16.66%;
}
.col-xs-3 {
width: 25%;
}
.col-xs-4 {
width: 33.33%;
}
.col-xs-5 {
width: 41.66%;
}
.col-xs-6 {
width: 50%;
}
.col-xs-7 {
width: 58.33%;
}
.col-xs-8 {
width: 66.66%;
}
.col-xs-9 {
width: 74.99%;
}
.col-xs-10 {
width: 83.33%;
}
.col-xs-11 {
width: 91.66%;
}
.col-xs-12 {
width: 100%;
}
}

What I have tried:

I have tried float: left but nothing has happened
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900