The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
Page 2 -
css and table alignment
Page 2 - Discuss css and table alignment in the CSS Help forum on Dev Shed. css and table alignment Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 13th, 2003, 06:05 PM
|
|
Contributing User
|
|
Join Date: Jul 2000
Posts: 41
Time spent in forums: 11 m 35 sec
Reputation Power: 13
|
|
|
im sure what jharnois posted will work -- even if it's not what you're looking for (at least, from what i get out of your post)
but, why would you want to use margins to center something? when the text-align would work better.
|

June 13th, 2003, 06:37 PM
|
 |
mod_dev_shed
|
|
Join Date: Sep 2002
Location: Atlanta, GA
|
|
|
B/c using margins is the correct method for centering a block element such as a <div> while text-align should be used for inline elements. You have to do it in IE b/c it doesn't conform to the standards correctly -- it's simply a workaround.
|

June 13th, 2003, 07:24 PM
|
 |
Contributing User
|
|
Join Date: Aug 2002
Location: Queensland, Australia
|
|
Unfortunately I can't use text-align : centre as content-area encloses a lot of other HTML for the page. I've just stripped it down here to show what isn't working.
Quote: | Yes, IE does not support the margin: auto; property correctly. |
But IE 6 does. I've read that it does everywhere and have seen it work for myself. But my page is the only page where I have seen it not work. Which leads me to belive that I must be doing something incorrectly.
Is it possible headers could make a difference since we seem to agree that the code I've shown should work?
__________________
Ooh, they have the Internet on computers now!
|

June 13th, 2003, 07:47 PM
|
 |
mod_dev_shed
|
|
Join Date: Sep 2002
Location: Atlanta, GA
|
|
Since you've stripped it down to relevant code it's hard for us to know wether or not anything else is affecting it. It is still possible to use the workaround by adding yet another <div> to the collection. Cross-browser compatibility is such a pain isn't it.
Code:
<div>
<div style="width:100%;text-align:center">
<div style="width:50%;margin-left:auto;margin-right:auto">Center Me</div>
</div>
This text should not be centered.
</div>
|

June 15th, 2003, 07:00 PM
|
 |
Contributing User
|
|
Join Date: Aug 2002
Location: Queensland, Australia
|
|
Thanks for the suggestion jharnois.
This is the only piece of code I left out from my earlier post...
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
I would be interested to hear if this code works for anyone using IE6.
|

June 18th, 2003, 07:21 PM
|
 |
Contributing User
|
|
Join Date: Aug 2002
Location: Queensland, Australia
|
|
FOUND IT!!!
I don't know why I didn't copy this bit of code into my previous post but DW automatically puts this line at the top of a XHTML compliant page...
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
I removed the line and "margin : auto" now works as it should. Booyah! I'm not sure what the intended function of this line is but without it the named CSS fonts sizes (ie. small, x-large) are all one size smaller.
|

June 18th, 2003, 07:29 PM
|
|
Contributing User
|
|
Join Date: Jul 2000
Posts: 41
Time spent in forums: 11 m 35 sec
Reputation Power: 13
|
|
for a code editor - i recommend editplus - colors your code and you dont have to worry about extra lines you didnt put in the file 
|

June 19th, 2003, 08:59 AM
|
 |
Senior Polecat
|
|
Join Date: Jun 2003
Location: Jersey (the original version)
Posts: 210
Time spent in forums: 59 m 57 sec
Reputation Power: 10
|
|
aah ... that explains it. I've also had trouble with the XML declaration before (it drove me nuts with typeface sizing!) and it would seem that there are a number of IE specific bugs related to the inclusion of XML decs.
And before any body gets on their high horse about "bloomin editors inserting their own code ... blah ... blah" it is worth bearing in mind that - according to W3C recomendations, all web pages using an encoding other than UTF-8 or UTF-16 should include the XML Declaration:
http://www.w3.org/TR/xhtml1/#strict
You can omit the line of course and specify your encoding using the meta tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
which dreamweaver also includes automatically. It seems that the guys at Macromedia are trying to cover the asses in terms of how best to specify encoding... but I hasten to add that it isn't their fault that IE doesn't correctly render page elements and styles when the XML is included - Microsoft did that all on their own!
Icy
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|