Hello all, I am currently working on centering my Navigation at screen sizes of 320 pixels or less. My goal is to have the logo centered at the top, followed by a centered navigation below, and then everything else aligned accordingly. However, I seem to be facing some difficulty in achieving this. Below is my HTML code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!DOCTYPE html> -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Jake Jones New Media Design</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="wrapper">
<div id="logo"><a href="index.html"><img src="logo.jpg" alt="logo"/></a></div>
<ul id="Menu">
<li>
<a href="index.html">Portfolio</a>
<ul>
<li><a href="index.html#web">Web</a></li>
<li><a href="index.html#campaign">Campaign</a></li>
<li><a href="index.html#print">Print</a></li>
<li><a href="index.html#motion">Motion</a></li>
<li><a href="index.html#photography">Photography</a></li>
<li><a href="index.html#vector">Vector</a></li>
</ul>
</li>
<li><a href="about.html">About</a></li>
</ul>
<div class="text">
<div class="imgContainer">
<img src="img/me.jpg" style="width: 100%"/>
</div>
<p>
Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, </p>
<div class="pdf">
<a href="resume.pdf">Resume</a> |
<a href="portfolio.pdf">Portfolio PDF</a>
</div>
<div class="contact">
(330)285-3158 <br/>
<a href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6e1a060b0401000b1d0d1c0b0f1a07180b2e09030f0702400d0103">[email protected]</a>"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86f2eee3ece9e8e3f5e5f4e3e7f2eff0e3c6e1ebe7efeaa8e5e9eb">[email protected]</a></a>
</div>
</div>
</div>
</body>
</html>
Below you can find my CSS code as well:
@charset "UTF-8";
body {
font-family: helvetica;
font-size:12px;
}
.wrapper {
margin: 0 auto;
max-width: 980px;
width: auto;
}
#logo {
float: left;
}
#Menu,
#Menu ul {
list-style: none;
}
#Menu {
float: right;
margin-top: 85px;
}
#Menu > li {
float: left;
}
#Menu li a {
display: block;
height: 2em;
line-height: 2em;
padding: 0 1.5em;
text-decoration: none;
}
#Menu ul {
position: absolute;
display: none;
z-index: 999;
}
#Menu ul li a {
width: 50px;
}
#Menu li:hover ul {
display: block;
}
/* Main menu
------------------------------------------*/
#Menu {
font-family: Arial;
font-size: 12px;
background: #ffffff;
}
#Menu > li > a {
color: #000000;
font-weight: bold;
font-size: 15px;
}
#Menu > li:hover > a {
background: #ffffff;
color: #7a0808;
}
/* Submenu
------------------------------------------*/
#Menu ul {
background: #ffffff;
padding: 0;
list-style-type: none;
width: 100px;
}
#Menu ul li a {
color: #000000;
font-size: 13px;
}
#Menu ul li:hover a {
color: #7a0808;
}
/* Content
------------------------------------------*/
.text {
clear: both;
}
p {
padding-top: 70px;
padding-left: 40px;
width: 275px;
}
.imgContainer {
margin-top: 70px;
float:right;
clear: both;
padding-right: 15px;
}
.pdf {
padding-left: 40px;
}
.pdf a:link {
color: black;
}
.pdf a:hover {
color: #7a0808;
}
.pdf a:visited {
color: #838383;
}
.contact {
line-height: 17px;
padding-top: 20px;
padding-left: 40px;
}
.contact a:link {
text-decoration: none;
color: black;
}
img {
max-width:100%
}
}
/* Responsive Styles */
@media screen and (max-width : 300px){
#logo {
width: 50%
}
#Menu a:link {
padding: 0px;
text-align: center;
float: left;
width: 100%;
}
}