Currently in the process of building a website and facing an issue with the banner placement under the navigation bar. Originally, both divs were perfectly positioned as desired but encountered a problem where upon resizing the browser window, the right div shifted below the left div. Both divs were floated using float:left and float:right.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title> Welcome </title>
<link rel="stylesheet" type="text/css" href="Style1.css">
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="topHeader">
<div id="logo">
<img src="Images/HeaderLogo.png" alt="Logo for Matt Meadows">
</div>
</div> <!--End of topHeader -->
</div> <!--End of Header -->
<nav>
<div id="nav-links">
<ul>
<li>Home</li>
<li>Portfolio</li>
<li>About</li>
<li>Contact</li>
</ul>
</div>
</nav>
<div id="contentHeaderContainer">
<div id="contentHeader">
<img src="Images/HomePageContentHeader.png">
<div id="headerText">
<h1 id="welcome">WELCOME</h1>
<p class="Text1">The Way Website Development should be...</p>
<p class="Text2">UNIQUE</p>
<p class="Text5">CONCISE</p>
<p class="Text3">VIBRANT</p>
<p class="Text4">PROFESSIONAL</p>
<p class="Text6">SIMPLE</p>
</div> <!--End of headerText -->
</div> <!--End of contentHeader -->
</div> <!--End of contentHeaderContainer -->
</div> <!--End of wrapper -->
</body>
</html>
CSS:
body, html
{
margin:0;
height:100%;
width:100%;
}
#wrapper
{
margin-left: auto;
margin-right: auto;
}
#topHeader
{
width: 100%;
height:75px;
background: rgb(36,36,36); /* Old browsers */
background: -moz-linear-gradient(top, rgba(36,36,36,1) 0%, rgba(52,52,52,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(36,36,36,1)), color-stop(100%,rgba(52,52,52,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(36,36,36,1) 0%,rgba(52,52,52,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(36,36,36,1) 0%,rgba(52,52,52,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(36,36,36,1) 0%,rgba(52,52,52,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(36,36,36,1) 0%,rgba(52,52,52,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#242424', endColorstr='#343434',GradientType=0 ); /* IE6-9 */
}
#logo
{
margin-left: 50px;
padding-top: 10px;
}
nav
{
float:left;
width: 100%;
height: 45px;
background: url('Images/NavBG.png');
-webkit-box-shadow: 0px 7px 15px rgba(20, 20, 20, 0.5);
-moz-box-shadow: 0px 7px 15px rgba(20, 20, 20, 0.5);
box-shadow: 0px 7px 15px rgba(20, 20, 20, 0.5);
}
#nav-links
{
margin: 0 auto;
}
ul
{
margin:0 auto;
padding:0;
list-style:none;
width: 700px;
}
li
{
display:inline;
float:left;
padding: 10px 55px 10px 55px;
font-size: 20px;
font-family: Arial, Helvetica, sans-serif;
color: #CCCCCC;
-webkit-transition: background 0.5s ease;
-moz-transition: background 0.5s ease;
-o-transition: background 0.5s ease;
transition: background 0.5s ease;
}
li:hover
{
background: #4d4c4c;
color: #FFF;
}
#contentHeaderContainer
{
height: 450px;
margin-left: auto;
margin-right: auto;
background: rgb(36,36,36); /* Old browsers */
background: -moz-linear-gradient(top, rgba(36,36,36,1) 0%, rgba(52,52,52,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(36,36,36,1)), color-stop(100%,rgba(52,52,52,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(36,36,36,1) 0%,rgba(52,52,52,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(36,36,36,1) 0%,rgba(52,52,52,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(36,36,36,1) 0%,rgba(52,52,52,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(36,36,36,1) 0%,rgba(52,52,52,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#242424', endColorstr='#343434',GradientType=0 ); /* IE6-9 */
-webkit-box-shadow: 0px 7px 15px rgba(20, 20, 20, 0.5);
-moz-box-shadow: 0px 7px 15px rgba(20, 20, 20, 0.5);
box-shadow: 0px 7px 15px rgba(20, 20, 20, 0.5);
}
#contentHeader img
{
float:left;
margin-top: 50px;
}
#headerText
{
float:right;
width: 700px;
height: 300px;
}
#welcome
{
font-family: "Myriad Pro", Myriad, "Liberation Sans", "Nimbus Sans L", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #cccccc
}
p
{
font-family: "Myriad Pro", Myriad, "Liberation Sans", "Nimbus Sans L", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.Text1
{
color: #999999;
font-size: 20px;
font-weight: bold;
}
.Text2
{
color:#8d9999;
font-size: 22px;
font-weight: bold;
margin-left: 100px;
margin-top: 50px;
}
.Text3
{
color:#8d9999;
font-size: 22px;
font-weight: bold;
margin-left: 350px;
margin-top: 50px;
}
.Text4
{
color:#8d9999;
font-size: 22px;
font-weight: bold;
margin-left: 100px;
margin-top: 50px;
}
.Text5
{
float:right;
color:#8d9999;
font-size: 22px;
font-weight: bold;
margin-top:-50px;
}
.Text6
{
float:right;
color:#8d9999;
font-size: 22px;
font-weight: bold;
margin-top:-50px;
}
EDIT: http://jsfiddle.net/w6qxU/
Need assistance to keep both child divs within #contentHeaderContainer fixed in position even during window resizing to maintain static content while the window border moves accordingly.