I am working to create the page mentioned here : https://github.com/jhu-ep-coursera/fullstack-course4/blob/master/assignments/assignment2/Assignment-2.md
going step-by-step to get a good understanding. While I have done the breakpoints part, I am not able to create the right margins between the divs id = section in my code. Can somebody highlight what's wrong here and how can I fix it? Here is the html code. :
* {
box-sizing: border-box;
font-family: "Times New Roman", Times, serif;
}
h1 {
text-align: center;
}
p {
font-family: Arial, Helvetica, sans-serif;
/** center the paragraph within its container**/
width: 90%;
margin-right: auto;
margin-left: auto;
/***/
color: white;
padding: 1em;
}
.container {
width: 100%;
}
#section {
position: relative;
border: 1px black solid;
background-color: gray;
height: 200px;
}
/** for desktop display ***/
@media (min-width: 992px) {
.mob,
.tab,
.desktop {
float: left;
}
.desktop {
width: 33%;
}
}
/*** for tablet display ***/
@media (min-width: 768px) and (max-width: 991px) {
.mob,
.tab,
.desktop {
float: left;
}
.tab {
width: 50%;
}
}
/*** for mobile display ***/
@media (max-width: 767px) {
.mob,
.tab,
.desktop {
float: left;
}
.desktop {
width: 100%;
}
}
<!DOCTYPE html>
<html>
<head>
<title>Module 2 Solution</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel ="stylesheet" href="css/index.css">
</head>
<body>
<h1>Our Menu</h1>
<div class = "container">
<div id = "section" class = "mob tab desktop">
<p>lorem ipsum dolor sit amet, consectetur
adipisicing 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.</p></div>
<div id = "section" class = "mob tab desktop">
<p>lorem ipsum dolor sit amet, consectetur
adipisicing 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.</p></div>
<div id = "section" class = "mob tab desktop">
<p>lorem ipsum dolor sit amet, consectetur
adipisicing 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.</p></div>
</div>
</body>
</html>
you can try changing the pattern in to:
after that you can add a span to the style.css file, and change width in @media desktop to 30 %
thank you hope it helps