Jump to content

Problem with background image as a header

Recommended Posts

I'm trying to extend my background-image across the entire webpage to act as a header. Image it as the blue header that facebook has at the top of their page. For some reason there is white space to the left of the background image, but the right extends all the way to the end of the web browser. I want to extend the background image all the way to the right side of the browser as well. Can you help with my code?



<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="style.css"></head><body>   <div id="container">    	<div class="stuff"> <img src="black.png" id="black"></body></html>


#container {	white-space: nowrap;	position: relative;}.stuff {	min-width: 100%;}



Edited by davej
Link to post
Share on other sites

Your code looks very sad and confused. Start over. See...







<!DOCTYPE html><html><head><meta charset="utf-8"><title>tab</title><style>#banner{background-image:url("mybannerimage.png");background-repeat:no-repeat;background-position:center center;background-size:100% 80px;height:80px;text-align:center;}</style></head><body><div id="banner"><h1>My Banner!</h1></div><h3>Title</h3><p>Test paragraph 1</p><p>Test paragraph 2</p></body></html>
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...