# A simple responsive web site layout

I created this simple responsive layout for my web apps and website projects. I'd like to ask if you see any flaws or bad practices in this code? A working demo can be seen here http://codepen.io/anon/pen/QdavpZ/ Thank you in advance, for any efforts.

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Responsive Layout Example</title>
<body>
<style>
margin: 0;
color: white;
font-size: 1.6rem;
line-height: 3rem;
}

margin: 0;
overflow: hidden;
background-color: #333;
color: white;
position: fixed; /* Set the navbar to fixed position */
top: 0; /* Position the navbar at the top of the page */
width: 100%; /* Full width */
z-index: 999;
}

display: inline-block;
float: left;
text-decoration: none;
margin: 0;
}

list-style-type: none;
margin: 0;
overflow: hidden;
}

/* Style the links inside the list items */
display: inline-block;
text-align: center;
text-decoration: none;
transition: 0.3s;
font-size: 17px;
}

/* Float the list items side by side */
float: left;
margin: 0;
}

position: relative;
}

float: none;
display: inline;
text-align: left;
}

display: block;
text-align: left;
}

.main {
margin-top: 8rem;
}

.content {
margin-top: 3rem;
}

.sidebar {
height: 75vh;
}

@media screen and (min-width: 680px) {
float: right;
}
}

/* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens */
@media screen and (max-width: 680px) {

float:none;
width:100%;
text-align: center;
}

.sidebar {
height: auto;
text-align: center;
}

.main {
margin-top: 2rem;
}

.content {
margin-top: auto;
}

position: relative;
}

position: relative;
}

float: none;
display: inline;
}

display: block;
text-align: center;
}

display: block;
text-align: center;
}
}

</style>
<h1>Title</h1>
</ul>
<div class="container main">
<div class="row">
<div class="column sidebar">
</ul>
</div>
<div class="column column-75 content">
<h2>Title 2</h2>
<p>
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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
</p>

</div>
</div>
</div>
<footer class="container">
<div class="row">
<p>
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. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.
</p>
</div>
</footer>

</body>
</html>

• Don't have time to write up a full review, but thumbs up for making use of the header/footer tags! The amount of code I still see which is just div soup blows my mind. The only thing I'm not a fan of is how your navigation links are all contained within one li - it'd make more sense to have a list item for each link. – Joe Clay Jan 30 '17 at 10:59
• Ah sorry, that was my mistake. updating it. thank you for comment. – Midori Kocak Jan 30 '17 at 11:08
• Easy mistake to make :) At this point your HTML looks pretty much how I'd opt to code it - my CSS is a bit rusty though, so I'll let someone else weigh in on whether changes could be made there. – Joe Clay Jan 30 '17 at 11:21
• < 415 px, it becomes unreadable. – Cody Gray Jan 30 '17 at 14:48
• Should I add a min-width to body? – Midori Kocak Jan 30 '17 at 18:33

Although the code looks good, it's a good coding practice to separate out the CSS and HTML code. Like for example maintain your file structure as follows

• index.html
• CSS

• someFileName.css

In your index.html file put all your HTML code mentioned above. Put your code between the <style> tags in a .css file. Similarly you could put your JavaScript/.Net files in another folder (in case you use them). Use the below code between your <head> tags.

<link rel="stylesheet" type="text/css" href="CSS/someFileName.css">

Reason : In complex/large websites, the code becomes too messy with CSS styling here and there. Maintaining the site becomes a difficult task. It's therefore a good practice to separate them out. Try debugging some of your favourite sites and check their structures.(open the website and press F12 if you're using Chrome/Firefox. In the Sources tab you'll see the structure to the left. Also go to the Elements tab and check the code. You'll not notice any CSS/JS code within the HTML code. Check out some simple sites like this)

Also check out the codepen.

• Thank you for your comment. I am sure that it will be good for readers. I printed the code here like this, because I also was willing to have my CSS code reviewed too. It was for presentation purposes here actually. I totally agree with your comment. – Midori Kocak Jan 30 '17 at 13:38
• @MidoriKocak We do not have any problems with people posting their HTML, CSS and Javascript in the same question with separate code blocks for each aspect. In fact, we even have special code snippets for such posts that show an example. – Nzall Jan 30 '17 at 14:33