CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 5th, 2012, 06:07 PM
keshk keshk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 36 keshk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 56 m 39 sec
Reputation Power: 1
How to stop background image from repeating and stay centered?

Hi,

I am making a very simple landing page. I just want to make a background by width 970px and height 720px. (Seems a recommended size when I looked around). It is a rounded square so it will not cover entire background and uncovered parts will be white.

But when I put in the codes, the image repeats and the sides plus bottoms has repeated image of that background image (the rounded square). Alignment also doesn't seem center. When I input no repeat, the image totally disappears giving me a white background. Can help point out what I am doing wrong? Thank you.

Code:
body { 
background-image:url(images/bg_body.png); 
background-repeat:repeat-none; 
background-color:#e4e4e4; 
background-attachment:fixed; 
background-position:top; 
}

Reply With Quote
  #2  
Old December 6th, 2012, 04:10 AM
simplypixie simplypixie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 104 simplypixie User rank is Sergeant (500 - 2000 Reputation Level)simplypixie User rank is Sergeant (500 - 2000 Reputation Level)simplypixie User rank is Sergeant (500 - 2000 Reputation Level)simplypixie User rank is Sergeant (500 - 2000 Reputation Level)simplypixie User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 18 h 33 m 57 sec
Reputation Power: 11
You don't need all those separate background elements, just use
Code:
body {
  background: url(images/bg_body.png) no-repeat fixed center top #e4e4e4;
}


Also, if it is just a rounded corner box then you can do all you need in CSS3 without having to use an image (though doesn't work in IE8 and below) by using a background color and border-radius, for example (change the px value to your requirements)
Code:
body {
  background: #e4e4e4;
  -moz-border-radius: 10px; /* Firefox */
  -webkit-border-radius: 10px; /* Safari, Chrome */
  border-radius: 10px; /* CSS3 */
}

Last edited by simplypixie : December 6th, 2012 at 05:23 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > How to stop background image from repeating and stay centered?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap