Css Tricks - How to align 4 div's - css

I have 4 divs in my HTML, I'd love to stay the same this appearance: (Each color a div, totaling 4 (not counting the background color))
For the current scenario:
I have the following jsFiddle: HERE
My big problem is when I add another item <li> in my <ul>, the result is that I have the following:
Css with the way they are one overlaps the other :'( (crying)
body {
background-image:url('http://subtlepatterns.com/patterns/shattered.png');
margin:0;
}
.chatBody {
position:absolute;
bottom:0;
height:200px;
width:100%;
background-color:#3c454f;
border-top: 10px solid #7ac943;
}
#navlist li {
display: inline;
list-style-type: none;
width:300px;
}
.avatarUser {
height:80px;
width:80px;
background-color:yellow;
float:left;
margin-right:20px;
margin-bottom:20px;
}
li > .frdImage {
position: relative;
/*margin-top:-25px;*/
top:50%;
float:left;
margin-left:5px;
border-radius: 6px;
border: solid 2px #aaa;
height:80px;
width:80px;
background-color:yellow;
margin-right:10px;
margin-bottom:20px;
}
li > span.frdName {
position:absolute;
float:left;
margin-top:10px;
font-weight: bold;
font-family:'Verdana', cursive;
font-size: 15px;
color: white;
margin-right:200px;
}
.active{
width:300px;
}
.frdStatusIndicator{
float:left;
margin-top:40px;
height:15px;
width:15px;
background-color: #7ac943;
border-radius: 10px;
}
.frdStatusName{
float:left;
margin-top:40px;
border-radius: 10px;
font-family:'Verdana', cursive;
font-size: 15px;
color: white;
line-height:15px;
padding-left:5px;
}
Could someone kindly help me with this? Since already very grateful for the time you guys!

How about this for html
<div class="chatBody">
<div id="navlist">
<div class="tile active">
<div class="frdImage"></div>
<div class="stuff">
<div class="frdName">Igor Gomes</div>
<div class="frdStatusIndicator online"></div>
<div class="frdStatusName">Online</div>
</div>
</div>
<div class="tile active">
<div class="frdImage"></div>
<div class="stuff">
<div class="frdName">Igor Gomes the second</div>
<div class="frdStatusIndicator idle"></div>
<div class="frdStatusName">Idle</div>
</div>
</div>
<div class="tile active">
<div class="frdImage"></div>
<div class="stuff">
<div class="frdName">Igor Gomes the third</div>
<div class="frdStatusIndicator online"></div>
<div class="frdStatusName">Online</div>
</div>
</div>
<div class="tile active">
<div class="frdImage"></div>
<div class="stuff">
<div class="frdName">Igor Gomes the fourth</div>
<div class="frdStatusIndicator offline"></div>
<div class="frdStatusName">Offline</div>
</div>
</div>
<div class="tile active">
<div class="frdImage"></div>
<div class="stuff">
<div class="frdName">Igor Gomes the fifth</div>
<div class="frdStatusIndicator idle"></div>
<div class="frdStatusName">Idle</div>
</div>
</div>
</div>
</div>
and this for css:
body {
background-color: #3c454f;
}
#navlist > div.tile {
display: inline-block;
width:300px;
border: solid 1px red;
position: relative;
}
.avatarUser {
height:80px;
width:80px;
background-color:yellow;
float:left;
margin-right:20px;
margin-bottom:20px;
}
div.tile > .frdImage {
border-radius: 6px;
border: solid 2px #aaa;
height:80px;
width:80px;
background-color:yellow;
display: inline-block;
}
div.tile > div.stuff > div.frdName {
position:relative;
display: inline-block;
right: 0px;
margin-top:10px;
font-weight: bold;
font-family:'Verdana', cursive;
font-size: 15px;
color: white;
width: 200px;
}
.active{
width:300px;
}
div.tile > div.stuff {
position: relative;
top: -2em;
width: 208px;
/* border: solid 1px green; */
display: inline-block;
}
.frdStatusIndicator{
position: relative;
height:15px;
width:15px;
background-color: #7ac943;
border-radius: 10px;
display: inline-block;
}
.frdStatusName{
position: relative;
border-radius: 10px;
font-family:'Verdana', cursive;
font-size: 15px;
color: white;
line-height:15px;
padding-left:5px;
display: inline-block;
}
.offline {
background-color: #FF0000;
}
.online {
background-color: #00FF00;
}
.idle {
background-color: #FFFF00;
}
I suppose I have to do a jsfiddle for this ... http://jsfiddle.net/bbutler/TMgs5/1/

Try setting width to this div in the list i.e for eg:100px and try it wont overlap
<div style="display:inline; float:left;width:100px">
Thanks
AB

Just make your window bigger in JSFiddle.
Just check out the jsfiddle below. You were pretty much on the right track.
http://jsfiddle.net/TYZ64/4/
#navitem li
{
display:inline-block;
}
I just changed that part.

Related

Cafepress Custom CSS

I'm editing custom css in my Cafepress store. I'm trying to get the store to display differently on mobile and desktop. Cafepress allows me to add to the head tag contents. The media queries at the bottom are what I've added:
<style>
body
{
background-color:#ffffff;
}
#cpWrapper{
padding:0;
background-image:url('http://i3.cpcache.com/image/110358274_400x400.png');
border-bottom: 1px solid #e14c3b;
width:100%;
max-width:1000px;
margin:auto;
}
#shopContainer{
width:96%;
max-width:960;
background-color:#ffffff;
margin:0px auto;
}
#shopBorder{
border:0;
background-color:#e14c3b;
border-top:0;
}
#shopWrapper{
width:94%;
max-width:940;
background-color:#ffffff;
border:0;
padding:20px;
}
#shopHeader{
background-color:#ffffff;
}
.bodyText a{
text-decoration:none;
}
.center
{
margin:auto;
width:50%;
}
.smallsidebartext a{
font-size: 12px;
text-decoration:none;
}
#sidebarContent {
padding: 85px 5px 5px;
position: relative;
}
#sidebarContent table {
width:auto;
}
#sidebarContentTD {
min-width:200px;
}
#shopCollection{
font-family:Georgia,"Times New Roman",Times,serif;
font-size:15px;
font-weight:bold;
font-color:#e14c3b;
left: 7px;
position: absolute;
top: 40px;
}
.promoBox{
margin-top:40px;
}
.sidebarbg {
background-color:#ffffff;
border-right: 1px dashed #e14c3b;
}
#shopName{
font-family:Georgia,Times,serif;
font-size:48px;
color:#e14c3b;
padding:10px 10px;
}
#colorBar{
height:16px;
}
#topNav{
background-color:#ffffff;
font-family:"times New Roman",Times,serif;
font-size:16px;
font-weight:bold;
color:#e14c3b;
text-align:center;
width:96%;
max-width:960px;
margin:auto auto 25px;
border-top: 1px solid #e14c3b;
border-bottom: 1px solid #e14c3b;
padding:0;
}
#topNav ul, #topNav ul li{
margin:0;
padding:0;
list-style:none;
float:left;
}
#topNav ul{
width:96%;
max-width:960px;
}
#topNav ul li a{
display:block;
padding:15px 10px;
line-height:100%;
color:#e14c3b;
text-decoration:none;
}
#searchFormContainer{
width:206px;
float:right;
left: -16px;
position: absolute;
top: 0;
}
#submitSearch{
float:right;
}
#searchTerm{
float:left;
width:125px;
height:16px;
padding:3px;
}
#media (max-width: 849px) {
.showOnDesktop {
display: none;
}}
#media (min-width: 849px) {
.showOnMobile {
display: none;
}}
</style>
Next it allows me to enter code for the header, which I've done as so:
<div class="showOnDesktop">
<div id="shopContainer">
<div id="shopHeader">
<div id="shopName"><a href="https://spaymart.org" rel="nofollow">
<img src="https://spaymart.org/wp-content/uploads/2017/10/Shop-Banner.png">
</a>
</div>
</div>
<div id="topNav">
<ul>
<li>Home</li>
<li><a href="http://www.cafepress.com/<cpstore:id>/s__t-
shirts-clothing">Shirts & Clothing</a></li>
<li>Everything Else
</li>
</ul>
</div>
<div id="shopWrapper">
<div class="showOnMobile">
<div id="shopContainer">
<div id="shopHeader">
<div id="shopName"><a href="https://spaymart.org" rel="nofollow">
<img src="https://spaymart.org/wp-content/uploads/2017/10/Shop-Banner-
MOBILE.png"></a>
</div>
</div>
<div id="topNav">
<ul>
<li>Home</li>
<li><a href="http://www.cafepress.com/<cpstore:id>/s__t-
shirts-clothing">Shirts & Clothing</a></li>
<li>Everything Else
</li>
</ul>
</div>
<div id="shopWrapper">
Finally, it allows me to add the footer code, which I've done like so:
</div><!-- closing shop wrapper -->
</div><!-- closing shop container -->
</div><!-- closing shop class --!>
<div class="clear"> </div>
The current output can be viewed here: http://www.cafepress.com/spaymart
The shop container, along with header and navigation, are displaying. Content/items contained within the shop wrapper are not.
Thank you in advance for any help you might be able to provide.
There are many problems in code, but the main reason is your mobile banner is nested inside of your desktop banner. When screen size is less than 849px, whole desktop container (with all nested elements) disappears.
Here you can grab a clean and workind code: CodePen for cafepress.com
<div class="showOnDesktop">
<div id="shopContainer">
<div id="shopHeader">
<div id="shopName">
<img src="https://spaymart.org/wp-content/uploads/2017/10/Shop-Banner.png">
</div>
</div>
<div id="topNav">
<ul>
<li>Home</li>
<li>Shirts & Clothing</li>
<li>Everything Else</li>
</ul>
</div>
<div id="shopWrapper"></div>
</div>
</div>
<div class="showOnMobile">
<div id="shopContainer">
<div id="shopHeader">
<div id="shopName">
<img src="https://spaymart.org/wp-content/uploads/2017/10/Shop-Banner-MOBILE.png">
</div>
</div>
<div id="topNav">
<ul>
<li>Home</li>
<li>Shirts & Clothing</li>
<li>Everything Else</li>
</ul>
</div>
</div>
</div>
<div id="shopWrapper"></div>
And CSS:
body {
background-color:#ffffff;
}
#cpWrapper {
padding:0;
background-image:url('http://i3.cpcache.com/image/110358274_400x400.png');
border-bottom: 1px solid #e14c3b;
width:100%;
max-width:1000px;
margin:auto;
}
#shopContainer {
width:96%;
max-width:960;
background-color:#ffffff;
margin:0px auto;
}
#shopBorder {
border:0;
background-color:#e14c3b;
border-top:0;
}
#shopWrapper {
width:94%;
max-width:940;
background-color:#ffffff;
border:0;
padding:20px;
}
#shopHeader {
background-color:#ffffff;
}
.bodyText a {
text-decoration:none;
}
.center {
margin:auto;
width:50%;
}
.smallsidebartext a {
font-size: 12px;
text-decoration:none;
}
#sidebarContent {
padding: 85px 5px 5px 5px; // add last padding 5px
position: relative;
}
#sidebarContent table {
width: auto;
}
#sidebarContentTD {
min-width:200px;
}
#shopCollection {
font-family:Georgia,"Times New Roman",Times,serif;
font-size:15px;
font-weight:bold;
font-color:#e14c3b;
left: 7px;
position: absolute;
top: 40px;
}
.promoBox {
margin-top:40px;
}
.sidebarbg {
background-color:#ffffff;
border-right: 1px dashed #e14c3b;
}
#shopName {
font-family:Georgia,Times,serif;
font-size:48px;
color:#e14c3b;
padding:10px 10px;
}
#colorBar {
height:16px;
}
#topNav {
background-color:#ffffff;
font-family:"times New Roman",Times,serif;
font-size:16px;
font-weight:bold;
color:#e14c3b;
text-align:center;
width:96%;
max-width:960px;
margin:auto auto 25px;
border-top: 1px solid #e14c3b;
border-bottom: 1px solid #e14c3b;
padding:0;
}
#topNav ul, #topNav ul li {
margin:0;
padding:0;
list-style:none;
float:left;
}
#topNav ul {
width:96%;
max-width:960px;
}
#topNav ul li a {
display:block;
padding:15px 10px;
line-height:100%;
color:#e14c3b;
text-decoration:none;
}
#searchFormContainer {
width:206px;
float:right;
left: -16px;
position: absolute;
top: 0;
}
#submitSearch {
float:right;
}
#searchTerm {
float:left;
width:125px;
height:16px;
padding:3px;
}
#media screen and (max-width: 849px) {
.showOnDesktop {
display: none;
}
}
#media screen and (min-width: 850px) {
.showOnMobile {
display: none;
}
}

Adding a text at the bottom of an image with a dark border

I am trying to add a dark colored border at the end of an image and write a text on it. I have attached the screen shot of how I want it to be.
Does anybody knows how to work this out?
I'm guessing something like this?
You should read up on position CSS for elements. Position absolute and relative
Fiddle for you
<div class="container">
<img src="http://placehold.it/200x150" alt="" />
<span>Here's your text</span>
</div>
* {
box-sizing: border-box;
}
.container {
position: relative;
}
.container span {
position: absolute;
bottom: 0px;
background-color: red;
width: 200px;
display: block;
padding: 10px 15px;
text-align: center;
text-transform: uppercase;
color: #fff;
}
Check this. I updated this fiddle for you! http://jsfiddle.net/EgLKV/5712/
#container
{
height:400px;
width:400px;
position:relative;
}
#image
{
position:absolute;
left:0;
top:0;
}
#text
{
z-index:100;
position:absolute;
color:white;
font-size:24px;
font-weight:bold;
text-align:center;
top:350px;
width: 400px;
background: #0686c9;
}
http://jsbin.com/tanesehivu/5/
CODE
.box{
width:200px;
height:150px;
background:grey;
float:left;
margin:10px;
display:block;
border:1px solid #999;
}
.box img{
width:200px;
height:150px;
border:1px solid #999;
}
.box span {
width:200px;
height:30px;
background:grey;
display:block;
text-align:center;
font-size:40px;
position:absolute;
top:140px;
line-height:35px;
color:#fff;
font-size:30px;
}
<div class="box">
<img src ="http://www.debrecensun.hu/media/2014/01/13-parties-for-wednesday-15-january/party.jpg"/>
<span>TITLE</span>
</div>
<div class="box">
<img src ="http://www.tnpsc.com/downloads2011/StreetRaceCars.jpg"/>
<span>TITLE</span>
</div>

Display Issues With My Div Box Design

I'm trying to display a nice box layout for my home page where I can add pictures or words to each box. I approached this idea with div's. All was going well until I tried to insert text into one of the middle div's (boxes). I'd love a hand because when I do that it screws up my whole orientation.
Here is my HTML:
<!DOCTYPE html>
<html lang:en>
<head>
<title>MitoGraphics | Branding and Promotions</title>
<link rel="stylesheet" href="main.css">
<link href='http://fonts.googleapis.com/css?family=Noto+Sans|Comfortaa:400,300,700' rel='stylesheet' type='text/css'>
</head>
<body>
<div>
<section id="navbar">
<ul>
<li>The Loop</li>
<li>Working With Mito</li>
<li>Promotional Solutions</li>
<li>Branding Elements</li>
</ul>
</section>
</div>
<div id="box_one"></div>
<div id="box_two"></div>
<div id="box_three"></div>
<div id="box_four"></div>
<div id="box_five"></div>
<div id="box_six"></div>
<div id="box_seven">
<P>Branding Elements</P>
<div id="box_eight"></div>
<div id="box_nine"></div>
<div id="box_ten"></div>
<div id="box_eleven"></div>
<div id="box_twelve"></div>
<div id="box_thirteen"></div>
<div id="box_fourteen"></div>
<div id="box_fifteen"></div>
<div></div>
<footer></footer>
</body>
</html>
Here is my CSS:
/****************************
NAVBAR
****************************/
#navbar {
background-color: black;
height:40px;
width:1454px;
margin-left: -30px;
margin-top: -16px;
border-bottom: 1px solid #ff0000;
}
#navbar ul {
text-decoration: none;
list-style: none;
}
#navbar ul li {
display:inline-block;
float:right;
color:white;
padding-right: 190px;
padding-top: 10px;
font-family: 'Comfortaa', cursive;
font-weight: 10;
}
#navbar ul a li:hover {
color:#000;
text-shadow: 0.1em 0.1em #fff;
font-size: 1.1em;
margin-top:-1px;
}
/****************************
HOME PAGE LAYOUT
****************************/
#box_one {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
margin-left: -8px;
max-width: 100%
}
#box_two {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
margin-left: -5px;
max-width: 100%
}
#box_three {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
display:inline-block;
margin-left: -5px;
max-width: 100%
}
#box_four {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
display:inline-block;
margin-left: -5px;
max-width: 100%
}
#box_five {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
display:inline-block;
margin-left: -5px;
max-width: 100%
}
#box_six {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
margin-left: -8px;
max-width: 100%;
}
#box_seven {
height:285px;
width:285px;
border: 1px solid black;
background-color: #6666cc;
display:inline-block;
margin-left: -5px;
max-width: 100%
}
.elementbox {
}
#box_eight {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
margin-left: -5px;
max-width: 100%
}
#box_nine {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
margin-left: -5px;
max-width: 100%
}
#box_ten {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
margin-left: -5px;
max-width: 100%
}
#box_eleven {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
max-width: 100%;
margin-left: -8px;
}
#box_twelve {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
max-width: 100%;
margin-left: -5px;
}
#box_thirteen {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
max-width: 100%;
margin-left: -5px;
}
#box_fourteen {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
max-width: 100%;
margin-left: -5px;
}
#box_fifteen {
height:285px;
width:285px;
border: 1px solid black;
background-color: white;
display:inline-block;
margin-left: -5px;
max-width: 100%
}
Why not try some responsive CSS.
Heres an example http://jsfiddle.net/bluey/72pN4/
Obviously styling would need to be added to each section, but the desired layout should be what you require, and be more stable on more devices.
Example HTML
<div>
Header
</div>
<div class="section group">
<div class="col span_1_of_2">
This is column 1
</div>
<div class="col span_1_of_2">
This is column 2
</div>
</div>
<div class="section group">
<div class="col span_1_of_2">
This is column 1
</div>
<div class="col span_1_of_2">
This is column 2
</div>
</div>
<div class="section group">
<div class="col span_1_of_2">
This is column 1
</div>
<div class="col span_1_of_2">
This is column 2
</div>
</div>
<div>
footer
</div>
Example CSS
.span_2_of_2 {
width: 100%;
}
.span_1_of_2 {
width: 49.2%;
}
/* GO FULL WIDTH AT LESS THAN 480 PIXELS */
#media only screen and (max-width: 480px) {
.span_2_of_2 {
width: 100%;
}
.span_1_of_2 {
width: 100%;
}
}
.section {
clear: both;
padding: 0px;
margin: 0px;
}
/* COLUMN SETUP */
.col {
display: block;
float:left;
margin: 1% 0 1% 1.6%;
}
.col:first-child { margin-left: 0; }
/* GROUPING */
.group:before,
.group:after {
content:"";
display:table;
}
.group:after {
clear:both;
}
.group {
zoom:1; /* For IE 6/7 */
}
For more info and more CSS for various grid capabilities visit: http://www.responsivegridsystem.com/
Add vertical-align: top to your inline-elements and it should be fixed. You should also consider using a class on all of your 'boxes' so that you only have to declare the width, height, background, border, and display one time. See this reduced test case codepen http://codepen.io/the_ruther4d/pen/e1703f2d34dc7ece9cccaa8e4d360c51/

DIV partition with CSS

I got a problem with my DIV partition. I want this:
But i found no solution. Can anybody help me?
With this solution, the all container are on the left and not centered.
#logo-text{
margin: 0 auto;
width: 600px;
float: left;
}
#image{
float: right;
}
Although you have not given any examples of what you have tried, i'd like to give you this example:
http://jsfiddle.net/LRffh/
<div id="container">
<div id="lineLeft">
<div id="boxOne">box one</div>
<div id="boxTwo">box two</div>
</div>
<div id="lineRight">
<div id="image">image</div>
</div>
<div class="clear"></div>
</div>
CSS
#container {
width: 1000px;
min-height: 1px;
background: red;
padding: 20px;
}
#lineLeft, #lineRight {
float: left;
width: 450px;
padding: 20px;
background: grey;
}
#lineLeft {
margin-right: 20px;
}
#boxOne, #boxTwo, #image {
background: white;
width: 100%;
min-height: 1px;
}
#lineLeft div, #lineRight div {
margin-bottom: 10px;
}
.clear {
clear: both;
}
HTML:
<div class='continer'>
<div class='logo'></div>
<div class='image'></div>
<div class='text'></div>
</div>
CSS:
.continer {
width:500px;
padding:10px;
background:red;
height:400px;
}
.logo {
width:200px;
padding:10px;
background:#ddd;
height:150px;
float:left;
margin:10px;
}
.text {
width:200px;
padding:10px;
background:#ddd;
height:150px;
float:left;
margin:10px;
}
.image {
width:200px;
padding:10px;
background:#ddd;
height:340px;
float:right;
margin:10px;
}
fiddle
<style>
#wrapper
{
margin:0px auto;
padding:0px;
width:1000px;
}
#side
{
margin:0px ;
padding:0px;
width:350px;
height:500px;
float:left;
}
#first
{
margin:0px ;
padding:0px;
width:350px;
height:300px;
background-color:red;
}
#Second
{
margin:0px ;
padding:0px;
width:350px;
height:300px;
background-color:blue;
}
#content
{
margin:0px ;
padding:0px;
width:650px;
height:600px;
float:right;
background-color:green;
}
</style>
<div id="wrapper">
<div id="side">
<div id="first"></div>
<div id="Second"></div>
</div>
<div id="content">
</div>
</div>
hope this helps
http://jsfiddle.net/LSsMc/48/
Here's another take on the problem
HTML
<div class='table'>
<div class='cell'>
<div class='table'>
<div class='row'>
<div class='cell'></div>
</div>
<div class='row'>
<div class='cell'></div>
</div>
</div>
</div>
<div class='cell'></div>
</div>
CSS
html, body{
width:100%;
height:100%;
padding:0;
margin:0;
}
body{
position:fixed;
}
.table{
display:table;
width:100%;
height:100%;
}
.cell{
display:table-cell;
border:1px solid grey;
width:50%;
}
.row{
display:table-row;
border:1px solid grey;
}
You need to create a container class for example who contains all the childs elements, to center the content.
html part :
<div class="container">
<div id="left">
<div id="logo-text"></div>
<div id="text"></div>
</div>
<div id="right">
<div id="image"></div>
</div>
css part :
.container {
background-color: red;
max-width: 1000px;
margin-left: auto;
margin-right: auto;
overflow: hidden;
}
/* Left part */
#left {
float: left;
padding: 20px;
}
#logo-text {
background-color: darkgrey;
width: 300px;
height: 300px;
}
#text {
background-color: darkgrey;
width: 300px;
height: 300px;
}
/* Right part */
#right {
float: right;
padding: 20px;
}
#image {
padding: 20px;
background-color: darkgrey;
width: 300px;
height: 300px;
}
jsfiddle http://jsfiddle.net/LSZfH/1/

how to add multiple images to a css header?

I am trying to add 2 images side by side in my header, following that I want my website title GARY MANN LLC and below that Residential Contractor, and then over on the right side of the header I want space to add social buttons/links. How can I divide the space up in the cleanest manner using just css and html heres what ive got to work with:
HTML:
<!DOCTYPE HTML>
<html lang="eng">
<head>
<meta charset="UTF-8" />
<title>GARY MANN LLC</title>
<link rel="stylesheet" href="styles/gmann.css" type="text/css" />
</head>
<body>
<header>
<center>GARY MANN LLC</center>
<center>Residential Contractor</center>
</header>
<nav>
<ul>
<li>Home</li>
<li>About Us
<ul>
<li>Our Crew</li>
<li>History</li>
<li>Vision</li>
</ul>
</li>
<li>Services
<ul>
<li>Carpentry</li>
<li>Waterproofing</li>
<li>Concrete</li>
<li>Masonry</li>
<li>Property Maintenance</li>
<li>Metal Construction</li>
<li>Interior Design</li>
<li>Demo & Salvage</li>
</ul>
</li>
<li>Portfolio
</li>
<li>Contact
<ul>
<li>Via Email</li>
<li>Web Form</li>
<li>Carrier Pigeon</li>
</ul>
</li>
</ul>
</nav>
<div id="wrapper">
<section id="content">
<!-- all the content in here -->
</section>
<section id="left_side">
</section>
</div> <!-- end wrapper -->
<footer>
<div id="footer_center">
<section id="social_links">
<h3>Connect With Us</h3>
</section>
<section id="site_map">
<h3>Site Map</h3>
</section>
</div>
<div id="copy">
<p>Copywright</p>
</div>
</footer>
</body>
</html>
CSS:
/* HEADER */
* {
margin:0;
padding:0;
}
header {
width:100%;
height:110px;
background-color:#FF6600;
border-bottom:2px solid black;
}
/* END OF HEADER */
/* START NAV MENU */
nav {
background-color:#333333;
height:40px;
width:100%;
float:left;
position: relative;
}
nav ul {
font-family: Sonoma, Arial;
font-size: 20px;
margin: 0;
padding: 0;
list-style: none;
text-align:center;
position: relative;
float: left;
clear: left;
left: 50%;
}
nav ul li {
float: left;
position: relative;
display: block;
right:50%;
}
nav li ul {
display: none;
}
nav ul li a {
display: block;
text-decoration: none;
background: #666666;
color: #ffffff;
padding: 5px 20px 3px 15px;
margin-left: 1px;
white-space: nowrap;
height:30px; /* Width and height of top-level nav items */
width:90px;
text-align:center;
border-right: 3px solid black;
border-left: 3px solid black;
border-top: 1px solid black;
}
nav ul li a:hover {
background: #999999;
}
nav li:hover ul {
display: block;
position: absolute;
height:30px;
}
nav li:hover li {
float: none;
font-size: 11px;
}
nav li:hover a {
background: #534635;
height:30px; /* Height of lower-level nav items is shorter than main level */
}
nav li:hover li a:hover {
background: #999999;
}
nav ul li ul li a {
text-align:left;
}
/* END NAV MENU */
/* WRAPPER */
#wrapper {
width:100%;
height:600px;
background-color:#CCCCCC;
margin-left:auto;
margin-right:auto;
border-left:1px solid black;
border-right:1px solid black;
}
#content {
width:85%;
height:100%;
float:right;
background-color:#999999;
}
#left_side {
width:15%;
height:100%;
float:left;
background-color:#333333
}
/* END WRAPPER */
/* FOOTER */
footer {
width:100%;
height:170px;
background-color:#e7e7e7;
border-top:1px solid black;
}
#footer_center {
width:900px;
height:145px;
margin-left:auto;
margin-right:auto;
border-bottom:1px dotted #333;
}
#social_links {
width:435px;
height:100%;
float:left;
border-right:1px dotted #333;
}
#site_map {
width:435px;
height:100%;
float:right;
border-left:1px dotted #333;
}
/* END FOOTER */
You can achieve this by making classes.
.header{
width:100%;
height:20%;
float:left;
text-align:center
}
.logo{
width:80%;
height:100%;
}
.upperlogo{
background:url('path of the upper logo') 0 0 no-repeat;
height:10%;
width:100%;
}
.lowerlogo{
background:url('path of the lower logo') 0 0 no-repeat;
height:10%;
width:100%;
}
.social-icons{
width:20%;
height:100%;
float:right;
}
In your HTML:
<header class="header">
<div class="logo">
<div class="upperlogo"></div>
<div class="lowerlogo"></div>
</div>
<div class="social-icon">
....
</div>
</div>
Adjust the height & width to suit your images. Loading images through CSS is always the better-elegant way.
You need to add 2 images, some texts, and social networking buttons.
<header>
<img id="img1" src="" />
<img id="img2" src="" />
<div id="text">
<span id="title">GARY MANN LLC</span>
<span id="description">Residential Contractor</span>
</div>
<div id="social">
</div>
</header>
CSS:
header {
width:100%;
height:110px;
background-color:#FF6600;
border-bottom:2px solid black;
}
#img1
{
float:left;
width:100px;
height:100px;
}
#img2
{
float:left;
width:100px;
height:100px;
margin-left:5px; //If you want some space between them
}
#text
{
float:left;
margin-left:10px;
}
#title
{
font-weight:20px;
float:left;
}
#description
{
font-weight:10px;
float:left;
clear:both;
}
#social
{
float:right;
}
Check this http://jsfiddle.net/5KRbh/
There are several ways. If you cannot change the html, try the :before selector.
header {
position:relative;
background: url(image.gif) no-repeat top left;
padding-left:200px;
}
header:before {
content:url(image.gif);
top: 0;
left: 100px;
position: absolute;
z-index: -1;
}

Resources