Can't get background to show

This is a discussion on "Can't get background to show" within the Starting Out section. This forum, and the thread "Can't get background to show are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Starting Out

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 14th, 2007, 09:07
Up'n'Coming Member
Join Date: Jul 2007
Location: Glasgow
Age: 15
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Can't get background to show

Hi, I'm trying to get my background to show on my page and not repeat and be centered but I doesn't work. I've tried this but it doesn't work
Code: Select all
{ 
background-image: url(images/background.jpg);
background-repeat: no-repeat;
background-position: center
}
.Sorry if this is the wrong section.
Reply With Quote

  #2 (permalink)  
Old Aug 14th, 2007, 09:34
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

Is the file in the specified place and is it correctly named?

Pete.
Reply With Quote
  #3 (permalink)  
Old Aug 14th, 2007, 09:36
Up'n'Coming Member
Join Date: Jul 2007
Location: Glasgow
Age: 15
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

Yes it is. Also can you put the the background in an external style sheet.
Reply With Quote
  #4 (permalink)  
Old Aug 14th, 2007, 09:46
SuperMember

SuperMember
Join Date: Jun 2007
Location: uk
Posts: 459
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

could be a typo

HTML: Select all
{ 
background-image: url(images/background.jpg);
background-repeat: no-repeat;
background-position: center
}
you are missing ; after center
Reply With Quote
  #5 (permalink)  
Old Aug 14th, 2007, 09:49
Up'n'Coming Member
Join Date: Jul 2007
Location: Glasgow
Age: 15
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

I'm just wondering where do you put the code.
Reply With Quote
  #6 (permalink)  
Old Aug 14th, 2007, 09:51
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

Is this actually being applied to anything. Before the opening curly bracket you need to select the element.

like

Code: Select all
div#image_div {
...
}
Pete.
Reply With Quote
  #7 (permalink)  
Old Aug 14th, 2007, 09:52
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

It can go in an external style sheet that is called in the head of your html document.

Pete.
Reply With Quote
  #8 (permalink)  
Old Aug 14th, 2007, 09:52
SuperMember

SuperMember
Join Date: Jun 2007
Location: uk
Posts: 459
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

You can put it in an external style sheet or on any page you wish to have that background
Reply With Quote
  #9 (permalink)  
Old Aug 14th, 2007, 09:52
1840dsgn's Avatar
SuperMember

SuperMember
Join Date: Jun 2007
Location: Canterbury
Age: 19
Posts: 720
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

erm...you haven't declared it as a style for anything!
*
Try this in your external stylesheet.
*
Code: Select all
 
 body {
***** background-image: url(images/background.jpg) no-repeat center center;
 }
*
Also I know its stupid...but is it correctly linked to the html document?
*
@dab42pat - you can actually not close your last style declaration with a ; and it will still work...not good practice in my opinion though.
*
mike
Reply With Quote
  #10 (permalink)  
Old Aug 14th, 2007, 09:57
Up'n'Coming Member
Join Date: Jul 2007
Location: Glasgow
Age: 15
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

Yes it is linked to my style sheet
Code: Select all
<link rel="stylesheet" type="text/css"
href="mystyle.css"/>
is in the head of my html page.
Reply With Quote
  #11 (permalink)  
Old Aug 14th, 2007, 10:39
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

Could you post your full code please. css and html.

Pete.
Reply With Quote
  #12 (permalink)  
Old Aug 14th, 2007, 10:43
Up'n'Coming Member
Join Date: Jul 2007
Location: Glasgow
Age: 15
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

Yea sure Html
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
<html>
<head>
<link rel="stylesheet" type="text/css"
href="mystyle.css"/>
</head>

    <center><h3>Welcome</h3></center>

<center><p>
Welcome to DetaBeta here you can
<br /> find out more about me also you can
<br /> view my photos and animation, I hope
<br /> enjoy your looking at my website.</p></center>

<center><p>  
I created this website so that
<br /> others could see my work and
<br /> web skills and I hope to improve
<br /> my website as a go along. Well I
<br /> hope you enjoy the layout of my
<br /> website.,</p></center>


 
</body>
</html>
and css
Code: Select all
<head>

</head>

<body>
{ 
background-image: url(images/background.png);
background-repeat: no-repeat;
background-position: center
}


<style type="text/css">
h1 {color: #888888;font-family: futura;font-size: 36;}
h2 {color: #888888;font-family: futura;font-size: 24;}
h3 {color: #888888;font-family: futura;font-size: 20;}
p {color: #ffffff;font-family: futura;font-size: 14;}

</style>

</body>
Reply With Quote
  #13 (permalink)  
Old Aug 14th, 2007, 10:46
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

Code: Select all
body { 
background-image: url(images/background.jpg);
background-repeat: no-repeat;
background-position: center
}


h1 {
color: #888888;
font-family: futura;
font-size: 36;
}

h2 {
color: #888888;
font-family: futura;
font-size: 24;
}

h3 {
color: #888888;
font-family: futura;
font-size: 20;
}

p {
color: #ffffff;
font-family: futura;
font-size: 14;
}
Change your css to this.

Pete.
Reply With Quote
  #14 (permalink)  
Old Aug 14th, 2007, 10:47
1840dsgn's Avatar
SuperMember

SuperMember
Join Date: Jun 2007
Location: Canterbury
Age: 19
Posts: 720
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

ok...your CSS is wrong. CSS documents aren't layed out liike html documents, you don't need head and body tags.
*
Code: Select all
 
 selector {
 *** attribute1: styles;
 *** attribute2: styles;
 etc etc
 }
Is the genertal layout.
*
So yours will be:
*
Code: Select all
 
 body{ 
background-image: url(images/background.jpg);
background-repeat: no-repeat;
background-position: center
}

h1 {color: #888888;font-family: futura;font-size: 36;}
h2 {color: #888888;font-family: futura;font-size: 24;}
h3 {color: #888888;font-family: futura;font-size: 20;}
p {color: #ffffff;font-family: futura;font-size: 14;}
*
Also...you can shorthand the background by puttiong it all in one attribute so:
*
Code: Select all
 
 body{ 
background-image: url(images/background.jpg);
background-repeat: no-repeat;
background-position: center
}
*
becomes
*
Code: Select all
 
 body{ background: url(images/background.jpg) no-repeat center;}
*
mike
Reply With Quote
  #15 (permalink)  
Old Aug 14th, 2007, 10:53
Up'n'Coming Member
Join Date: Jul 2007
Location: Glasgow
Age: 15
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

Thanks Pete that worked great. I'm just wondering how do you set page width and height

Last edited by casho; Aug 14th, 2007 at 10:57.
Reply With Quote
  #16 (permalink)  
Old Aug 14th, 2007, 10:57
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

A quick note. The font you've used may not be on every users computer so you should have a few web-safe back-ups just in case. Things like time new roman, Helvetica, Verdana, Arial, Georgia, and finally a sans-serif one. It's just good practice and helps you to maintain some control over what users see but you can't cover every eventuality.

Pete.
Reply With Quote
  #17 (permalink)  
Old Aug 14th, 2007, 11:14
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

Quote:
Originally Posted by casho View Post
Thanks Pete
And Mike!

Pete.
Reply With Quote
  #18 (permalink)  
Old Aug 14th, 2007, 11:17
Up'n'Coming Member
Join Date: Jul 2007
Location: Glasgow
Age: 15
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can't get background to show

Oh yea thanks Pete and mike.
Reply With Quote
Reply

Tags
background, css, html

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Background image won't show up casho Web Page Design 7 Mar 5th, 2008 09:04
Can't Get Table Background to show when "E-Mailing" Page chriss Web Page Design 5 May 8th, 2007 14:10
Cant Get CSS background images to show up mschroeder Web Page Design 3 Jan 18th, 2007 13:33
favicon doesn't show berjoe Graphics and 3D 20 Nov 13th, 2006 14:32
Background and Resolution compatibility, My background gets cut off Funion Web Page Design 1 Dec 4th, 2005 04:42


All times are GMT. The time now is 18:48.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43