- This topic is empty.
August 1, 2012 at 1:02 am #39156
For some reason, my website won’t align in the center on all browsers. Seems to be an issue is IE and also on IOS browsers
Any ideas would be most appreciated!
MarkAugust 1, 2012 at 3:27 am #107133AntonNiklassonParticipant
Stop using the center element, it’s not semantic. What if you want to change how the site is layed out? Then you’d have to change the markup.
To center an element, you can set both the left and right margins to auto. Like this:
margin: 0 auto;
In some older versions of IE that won’t work though, so you’ll have to do it like this:
}August 1, 2012 at 11:13 pm #107199
Thanks for the info. I’ve tried what you suggested but it’s still left aligned on my iPhone.
Is it anything to do with some elements having absolute positioning?
MarkAugust 3, 2012 at 2:20 am #107246devsignMember
What Anton Suggested is indeed correct, however, remember that you must also specify a width on anything you want centred. So just confirm that you do specify a width.August 3, 2012 at 3:18 am #107250
Thanks for the comments. I have specified the width but it still doesn’t center align!
I think it’s something to do with the code in the header section as if I remove the header graphics it aligns correctly!
MarkAugust 3, 2012 at 4:54 am #107251Paulie_DModerator
It may not be related but you have put the large image as an element rather than applying it as a background.
You have (.bg) class but apparently aren’t using it except for positioning.
- The forum ‘CSS’ is closed to new topics and replies.