d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Quick Css Help > Header Container
Add Reply New Topic New Poll
Member
Posts: 29,305
Joined: Nov 12 2005
Gold: 710.00
May 29 2014 02:44pm
I haven't done any web design stuff in a while. I'm trying to knock the rust off now while attempting to make a portfolio. I would like help with bringing the menu and logo areas closer together in the header area.



Basically, I need to know where I'm putting the div container in the html file and what properties I'm assigning to it in the stylesheet. I tried putting a headercontainer div before the header div and giving a width to that but it wasn't working.

HTML

Code
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Ruzzio Design</title>
</head>
<body>
<div id="header">
<div id="logo">
<img class="logo" src="images/logo.png">
</div>
<div id="menu">
<ul class="menu">
<li class="menu"><a href="#">About</a></li>
<li class="menu"><a href="#">Gallery</a></li>
<li class="menu"><a href="#">Services</a></li>
<li class="menu"><a href="#">Resources</a></li>
<li class="menu"><a href="#">Contact</a></li>
</ul>
</div>
</div>
</body>
</html>


CSS

Code
@font-face {
font-family: 'BEBAS';
src: url('fonts/BEBAS.TTF');
}

* {
margin: 0px;
padding: 0px;
}

html, body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
color: #ffffff;
background: #bbbbbb;
}

#header {
height: 65px;
width: 100%;
background-image: url('null');
background-repeat: repeat-x;
background: -webkit-linear-gradient(#555555, #353535); /* Safari */
background: -o-linear-gradient(#555555, #353535); /* Opera */
background: -moz-linear-gradient(#555555, #353535); /* Firefox */
background: linear-gradient(#555555, #353535); /* Standard */
box-shadow: 0px 1px 1px #131313;
}

.logo {
height: 65px;
width: 282px;
float: left;
}

#menu {
float: right;
}

ul.menu {
list-style: none;
height: 65px;
}

li.menu {
float: left;
height: 65px;
width: 88px;
display: inline;
border-left: 1px solid #353535;
font-size: 15px;
font-family: 'BEBAS';
text-align: center;
}

li.menu a {
display: block;
color: #888888;
text-decoration: none;
line-height: 65px;
background: -webkit-linear-gradient(#353535, #262626);
background: -o-linear-gradient(#353535, #262626);
background: -moz-linear-gradient(#353535, #262626);
background: linear-gradient(#353535, #262626);
}

li.menu a:hover {
color: #dddddd;
background: -webkit-linear-gradient(#00bce2, #007ebc);
background: -o-linear-gradient(#00bce2, #007ebc);
background: -moz-linear-gradient(#00bce2, #007ebc);
background: linear-gradient(#00bce2, #007ebc);
}
Member
Posts: 1,945
Joined: Apr 19 2007
Gold: 1,978.90
May 29 2014 03:34pm
Probably want another div, and then set that to have a max width so it floats in the middle with: margin: 0 auto; float: none; text-align: center;

Otherwise you're gonna need res specific css or % based padding on each side to push it in etc

@media screen and (max-width:1200px) {
css here
}

Code
</head>
<body>
<div id="header">
<NEW DIV HERE>
<div id="logo">
<img class="logo" src="images/logo.png">
</div>
<div id="menu">
<ul class="menu">
<li class="menu"><a href="#">About</a></li>
<li class="menu"><a href="#">Gallery</a></li>
<li class="menu"><a href="#">Services</a></li>
<li class="menu"><a href="#">Resources</a></li>
<li class="menu"><a href="#">Contact</a></li>
</ul>
</div>
<DIV END>
</div>
</body>
</html>


This post was edited by val4321 on May 29 2014 03:34pm
Member
Posts: 29,305
Joined: Nov 12 2005
Gold: 710.00
May 29 2014 03:46pm
Quote (val4321 @ May 29 2014 05:34pm)
Probably want another div, and then set that to have a max width so it floats in the middle with: margin: 0 auto; float: none; text-align: center;

Otherwise you're gonna need res specific css or % based padding on each side to push it in etc

@media screen and (max-width:1200px) {
css here
}

Code
</head>
<body>
  <div id="header">
                    <NEW DIV HERE>
  <div id="logo">
    <img class="logo" src="images/logo.png">
  </div>
  <div id="menu">
    <ul class="menu">
    <li class="menu"><a href="#">About</a></li>
    <li class="menu"><a href="#">Gallery</a></li>
    <li class="menu"><a href="#">Services</a></li>
    <li class="menu"><a href="#">Resources</a></li>
    <li class="menu"><a href="#">Contact</a></li>
    </ul>
  </div>
                    <DIV END>
  </div>
</body>
</html>


That works, thanks man. I figured I was putting them in the right place. I was using width instead of max-width.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll