|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
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. |
|
#17
|
||||
|
||||
|
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.
|
|
#18
|
||||
|
||||
|
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:
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! |
|
#19
|
||||
|
||||
|
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>
|
|
#20
|
||||
|
||||
|
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. |
|
#21
|
||||
|
||||
|
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. |
|
#23
|
||||
|
||||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > css and table alignment |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|