Solved

make a header responsive

Posted on 2015-02-10
5
93 Views
Last Modified: 2015-02-10
Hi, the boss is going to want something like the header here on our new responsive site.
magickitchen.com

The question is, how do I make a header that looks good on all screen sizes? I've uploaded the header here as well.header
0
Comment
Question by:mel200
  • 2
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
James Bilous earned 250 total points
ID: 40600869
If the header is a static image it'll be a bit tricky. If so - you could make the image the background of a DIV and set its size to 100%.

#header_area {
    background: url('my_header_image.com');
    background-repeat:no-repeat;
    background-position: top center;
    background-size: 100%;
    max-width: 100%;
    height: auto;
}

Open in new window

1
 

Author Comment

by:mel200
ID: 40601144
Ok, thanks... what width would you recommend I make it?
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 250 total points
ID: 40601204
If you use media queries you can just set the image width based on the width of the device. If you set width and not height the height will be calculated to maintain the aspect ration.  However for some small mobile devices you might want to consider not using an image that big with text included because it may not look good an very small screens.  You could go with an alternate that mainly features just the logo and some text.

Cd&
0
 
LVL 8

Expert Comment

by:James Bilous
ID: 40601229
Thats really your call and depends on the size of the browser you want to support. Making it large will keep it from pixelating when it gets too big but will take longer to load so you may want to play with it a bit.

If you want to keep from having the banner get too big you can surround the div with the header background image in another div with a max-width. For example:

#mydiv {
   max-width: 1024px
}

<div id="mydiv">
   <div id="header_area"> </div>
</div>

Open in new window

0
 

Author Closing Comment

by:mel200
ID: 40601318
Thanks, all!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to dynamically set the form action using jQuery.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question