DTP


 
Lively discussions on the graphic arts and publishing — in print or on the web


Go Back   Desktop Publishing Forum > General Discussions > Web Site Building & Maintenance

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 02-25-2007, 11:36 AM   #9
jwoolf09
Member
 
Join Date: Oct 2005
Location: Manchester, NH
Posts: 65
Default

Kathleen,

As a follow-up: I'm having some trouble understanding just how centering works with CSS. I thought it worked like this: if a block element such as <div> or <p> has the text-align property set to "center," then everything in the block gets centered relative to the parent element. Then if some child block element contained a different text-align value, such as "left", the contents of that element would be aligned left within the centering. That is, if I do this:

<div style="text-align:center;">
<p style="width:75%;text-align:left;">
a paragraph of text goes here
</p>
</div>

then the result should be a block of text that is left-justified within a larger centered block, which automatically adjusts itself to match the size of the screen. In other words, it should look like an ordinary paragraph of text with large left and right margins. The same as if I had entered this:

<table align="center" width="75%">
<tr>
<td>
a paragraph of text goes here
</td>
</tr>
</table>

But that isn't what I actually get. The centered-using-tables version works as I expect. The centered-using-CSS code works as I expect in Explorer, but in Firefox it left-aligns the paragraph with the page lefthand margin, as if the outer centered element wasn't there at all.

I suppose I could use percentage left and right margins to achieve the same result, but that's ugly and inelegant and defeats half my purpose, which is to learn how to write HTML/CSS code the way I used to write program code: short and sweet and simple, so anyone who looks at it can understand right away what it does and how.

So, how does centering really work? To what extent can you nest text alignment, and what's the right sequence of CSS styles to do it? Or am I better off using the ugly "percentage margins" approach?
jwoolf09 is offline   Reply With Quote
 

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with graphic Calamity Web Design 21 10-03-2006 02:50 PM
web graphic, now need print quality parana55 General Publishing Topics 24 09-17-2006 10:58 AM
New HP A1510N Media Center Computer dthomsen8 The Corner Pub 20 08-20-2006 08:41 AM
Extraneous Blank Line Before <CENTER> RJ Emery Web Site Building & Maintenance 7 05-31-2006 10:59 PM


All times are GMT -8. The time now is 12:55 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Contents copyright 2004–2014 Desktop Publishing Forum and its members.