Hey there, I'm looking for a little help. It's been quite some time since I last built a website from scratch and I want to keep things simple this time around. I've used breakpoints before, but I'm curious if Flexbox could be a better option(?). I'm struggling a bit to grasp the concept and apply it to my current code.
My layout consists of two rows at the top for the header and navigation links, followed by two columns below for the main content, and then another row for the footer.
I have included all the content between the body tags in my HTML page (which is still a work in progress) along with the CSS provided below. At the moment, everything is defined in pixels. Any feedback on what I'm doing right or wrong (like using too many containers, etc.) and guidance on how I can utilize Flexbox would be greatly appreciated.
body {
background-color: #C4C4C4;
font-family: 'Roboto', serif;
/*font-size: 48px;*/
line-height: 25px;
}
#page-container {
margin: 0 auto;
width: 793px;
}
header {
background: url("../images/big-banner.jpg");
background-size: 793px 285px;
background-repeat: no-repeat;
height: 285px;
/*height: 285px;*/
}
header h1 {
padding: 70px 0 0 20px;
color: #FFFFFF;
font-size: 2.8em;
}
header p {
padding: 25px 0 0 20px;
color: #FFFFFF;
font-size: 1.4em;
}
h2 {
font-size: 1.4em;
font-weight: bold;
padding-bottom: 20px;
}
h3 {
font-size: 1em;
font-weight: bold;
padding-bottom: 20px;
}
p {
line-height: 1.7;
padding-bottom: 30px;
}
ul {
padding-left: 20px;
}
li {
list-style-type: disc;
line-height: 2em;
padding-left: 5px;
}
nav ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #605A52;
}
nav li {
float: left;
list-style-type: none;
padding: 0;
}
nav li a {
display: block;
color: #FFFFFF;
text-align: center;
font-size: 1em;
padding: 8px 15px 8px 15px;
text-decoration: none;
}
nav li a:hover {
color: #000000;
background-color: #FFFFFF;
}
strong {
font-weight: bold;
}
small {
font-size: 0.9em;
}
section {
}
article {
}
.contact-box {
height: 200px;
width: 200px;
background-color: #FFFFFF;
padding: 15px;
-webkit-box-shadow: -1px 3px 4px 0px rgba(102,102,102,0.73);
-moz-box-shadow: -1px 3px 4px 0px rgba(102,102,102,0.73);
box-shadow: -1px 3px 4px 0px rgba(102,102,102,0.73);
}
summary {
}
.content-container {
width: 793px;
width: 100%;
height: 100%;
display: flex;
}
/* left col */
.left-col {
padding: 40px 20px 60px 60px;
width: 450px;
float: left;
}
/* wull-width left col for contact page */
.full {
width: 100%;
padding-right: 40px;
}
/* right col */
.right-col {
background-color:#FFFFFF;
width: 243px;
float: left;
align-items: stretch;
height: 100%;
padding: 40px 20px 10px 20px;
margin: 10px 0 0 0;
}
.zebra-1, .zebra-2 {
text-align: justify;
margin: 10px 0 10px 0;
}
.zebra-1 {
background-color: #EDEDED;
}
.zebra-2 {
background-color: #FFFFFF;
}
.list-left, .list-right {
text-align: left;
float: left;
width: 43%;
padding-right: 5px;
}
footer {
clear:both;
background-color: #605A52;
padding-left: 10px;
color:#FFFFFF;
}
footer p {
padding: 10px;
}
<div id="page-container">
<header>
<h1>Main title here</h1>
<p>Sub title</p>
</header>
<nav role="navigation">
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 1</a></li>
</ul>
</nav>
<div class="content-container zebra-1">
<section class="left-col" role="main">
<h2>Welcome</h2>
<p>Lorem ipsum</p>
<p>Lorem ipsum</p>
</section>
<div class="right-col zebra-1" role="complementary">
<aside><div class="contact-box">Contact info here</div></aside>
</div>
</div>
<div class="content-container zebra-2">
<section class="left-col" role="main">
<h2>Another header</h2>
<p>Lorem ipsum</p>
</section>
<div class="right-col zebra-2" role="complementary">
<p>More stuff here</p>
</div>
</div>
<footer>
<p>
<small>Copyright info</small>
</p>
</footer>
</div>