This is a discussion on "[SOLVED] Centering!" within the Web Page Design section. This forum, and the thread "[SOLVED] Centering! are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] Centering!
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
||||
|
||||
|
[SOLVED] Centering!
ok. my css is this...
my html is this...
it doesn't center. lol
Last Blog Entry: My blog? (Oct 18th, 2007)
Last edited by mcdanielnc89; Oct 21st, 2007 at 18:27. Reason: WHen inserting code i didn't put the < in the front, but still doesn't work. |
|
|
|
#2
|
|||
|
|||
|
Re: Centering!
Dare I point out the obvious, though I'm sure its just a mistake:
|
|
#3
|
|||
|
|||
|
Re: Centering!
Quote:
Applying margin: 0 auto; to an element will cause it to be centred inside the parent container (but this fails on IE5 and IE6 in quirks mode). Do a search, either here or on Google. This has been covered many, many times. |
|
#4
|
||||
|
||||
|
Re: Centering!
This should work as it usually requires you to specify a height and width:
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#5
|
|||
|
|||
|
Re: Centering!
Total server work required for CSS solution: 571B
Total server work required for align='center': 528B Try it yourself: http://www.rossandrus.net/examples/d...d/standard.php http://www.rossandrus.net/examples/d...deprecated.php Test the load time: http://www.websiteoptimization.com/services/analyze/ That's not even taking IE5 and 6 into consideration. The CSS solution also forces you to display the image as block which is less flexible for things like rows of horizontally centered icons, etc. Deprecated doesn't always mean bad. |
|
#6
|
||||
|
||||
|
Re: Centering!
hmm ok so which way is teh way to do itr if it's depreciated, and tyhe height and width would be pointless to do as that vlass is used for several other images...
Last Blog Entry: My blog? (Oct 18th, 2007)
|
|
#7
|
||||
|
||||
|
Re: Centering!
I just told you how to do iit the non-depcricated way.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#8
|
|||
|
|||
|
Re: Centering!
Quote:
You've got to be kidding me. Compared to the total work required for a typical webpage, this is irrelevant. It's far more important to understand the reasons for preferring CSS-based presentation to HTML-based presentation. Saving a few bytes here and there is of dubious value. Moreover, since both pages are invalid HTML, they hardly constitute good examples. Finally, note that although the CSS solution has an initial performance cost, it becomes more efficient the more you use it. Quote:
Quote:
Last edited by MikeHopley; Oct 21st, 2007 at 18:15. |
|
#9
|
||||
|
||||
|
Re: Centering!
Quote:
Last Blog Entry: My blog? (Oct 18th, 2007)
|
|
#10
|
|||
|
|||
|
Re: Centering!
You should not state the height and width. For images inserted via the <img> element (as opposed to CSS backgrounds), the height and width are given in the HTML.
Width is required for centring other boxes (<div>s, typically) that lack an inherent width. |
|
#11
|
||||
|
||||
|
Re: Centering!
If that is the case MikeHopley then what is wrong with my code to make it not center? Is my CSS wrong?(Obviously it has to be)
Last Blog Entry: My blog? (Oct 18th, 2007)
|
|
#12
|
|||
|
|||
|
Re: Centering!
Quote:
I suspect this is IE nuttiness. But the simplest explanation requires that I know more about your browser/code. |
|
#13
|
|||
|
|||
|
Re: Centering!
Quote:
Quote:
Quote:
http://validator.w3.org/check?uri=www.google.com |
|
#14
|
||||
|
||||
|
Re: Centering!
Yes it is IE7, and a link to where one of the images not responding is located here.
Last Blog Entry: My blog? (Oct 18th, 2007)
|
|
#15
|
|||
|
|||
|
Re: Centering!
You need to set the class of your images to link with the information in your stylesheet. Your code modified:
http://centricle.com/ref/css/filters/ But make sure your code is sound before you start looking into browser discrepancies. |
|
#16
|
|||
|
|||
|
Re: Centering!
Quote:
Quote:
Quote:
|
|
#17
|
||||
|
||||
|
Re: Centering!
ok. my css is
Last Blog Entry: My blog? (Oct 18th, 2007)
|