iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-01-2006, 06:03 PM
WebProWorld Member
 
Join Date: Dec 2003
Location: Illinois
Posts: 32
incraftfun RepRank 0
Default CSS background properties

Hi. How can I get a background centered and still enter coordinates? I have a problem because I have a a layout that needs to be synchronized with the background, but when I enter "center" in the css property, it is off. How can I remedy this?

Thanks!

Alex

PS you can look at the layout at http://mrfreeipod.com/layout.html, but the top part is off because of that stupid banner.
Reply With Quote
  #2 (permalink)  
Old 10-02-2006, 11:01 AM
Moderator
WebProWorld Moderator
 
Join Date: Oct 2003
Location: Alberta, Canada
Posts: 879
weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6
Default

Centering is always a joy with CSS. Like everything else. It gets even more complicated when working with a generated layout using slices and spacer gifs within a complex layout table.

In its simplest form, CSS centering is very straight forward. Take for instance a paragraph that is half the width of the page, centered, with normal justification:

Code:
<div class="content">


Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin porta augue et sapien. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
</div>
First, give the content div a reference width, say, 100%, and center align its child elements. Then give the paragraph a relative width of 50%, and justify the text. Setting the right and left margins to auto evens them out, so the element becomes self-centering.

Code:
div.content{
	width:100%;
	text-align:center;
}
div.content p{
	width:50%;
	margin:1em auto;
	text-align:justify;
}
If the div is a child in a TD, 100% width is relative to the full width of the TD. Likewise, the paragraph width in this example will be half of the div, not the page, unless of course the div is the full width of the page.

The same method can be used to center a list of fixed or relative width, while maintaining left alignment of the list items. This one would have no bullets and no left indent:
Code:
div.content ul{
	width:50%;
	margin:1em auto;
	padding:0;
	list-style:none;
}
div.content li{
	margin:0;
	text-align:left;
}
Reply With Quote
  #3 (permalink)  
Old 10-03-2006, 06:21 AM
pagetta's Avatar
WebProWorld Veteran
 
Join Date: Nov 2004
Location: UK
Posts: 509
pagetta RepRank 2
Default

is it not possible to save your top images with transparent BGs and then the background wouldn't need to line up?
if you save one sun images, set that as body bg and repeat it, then have your images at the top of your site saved with transparent backgrounds (if a gif you will need to set the matte as the darker brown (#775605)) then your actual site is completely independant of the BG.
I hope that is of some help - nice looking site :-)
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum

Thread Tools
Display Modes

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



All times are GMT -4. The time now is 04:10 PM.



Search Engine Optimization by vBSEO 3.3.0