reflex84 Posted May 13, 2009 Share Posted May 13, 2009 Hi,If I have a background and I want to centre it in the middle of the page?Have a look at this website:http://www.davidg.ro/portfolio/See how the "twirlly" graphics stays "wrapped" around the actual page of data, when you re-size the browser window.How can I do this? Is there a simple CSS html code? ... Or is it a bit more complicated?Thanks Guys.Dale. Link to comment Share on other sites More sharing options...
Ingolme Posted May 13, 2009 Share Posted May 13, 2009 I haven't checked the code, but judging by your page's behaviour, it looks like your background image is contained within a wrapper <div> with 100% width. You should put the background image on the <body> element instead.Most people don't realise it, but wrapper <div>s usually aren't necessary, because the <body> element itself is a container that can be styled. Link to comment Share on other sites More sharing options...
reflex84 Posted May 13, 2009 Author Share Posted May 13, 2009 I haven't checked the code, but judging by your page's behaviour, it looks like your background image is contained within a wrapper <div> with 100% width. You should put the background image on the <body> element instead.Most people don't realise it, but wrapper <div>s usually aren't necessary, because the <body> element itself is a container that can be styled.Hi, Ok ... I'm really terrible at CSS and HTML coding (I battle to understand - something I need to work on!!!)For example, My website www.Mad-About-dance.org.za ... click on that link and see my background settings:body { background-image: url(bk.jpg); margin-top: 0px; background-attachment: fixed; background-repeat: repeat-x;} You say I must add a div wrapper? I've never dealt with Divs before (note I am more of a graphic designer than web / html design)Thanks for your help Ingolme!dale. Link to comment Share on other sites More sharing options...
Ingolme Posted May 13, 2009 Share Posted May 13, 2009 Hi, Ok ... I'm really terrible at CSS and HTML coding (I battle to understand - something I need to work on!!!)For example, My website www.Mad-About-dance.org.za ... click on that link and see my background settings:body { background-image: url(bk.jpg); margin-top: 0px; background-attachment: fixed; background-repeat: repeat-x;} You say I must add a div wrapper? I've never dealt with Divs before (note I am more of a graphic designer than web / html design)Thanks for your help Ingolme!dale. No, don't add a <div> wrapper. I was just under the impression that the background image on the site was in a wrapper <div>because of the fact that it doesn't cover the entire page when the window is resized.Try this:html,body {margin: 0;padding: 0;background-image: url(file.jpg); /* Put the filename here */background-position: top center;background-repeat: no-repeat;} Link to comment Share on other sites More sharing options...
reflex84 Posted May 13, 2009 Author Share Posted May 13, 2009 Hi,I've tried it out - and it works 100% - thanks!!!d Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.