- This topic is empty.
-
AuthorPosts
-
March 7, 2012 at 3:00 pm #37031
downbylaw
MemberHi guys!
the last few days I’ve been struggeling with an issue in IE… Alignment! I’m trying to align the div ‘container’ in the center of the browser. All browsers (Safari, Chrome, Firefox, Opera) handle the css (margin-left: auto; margin-right: auto;) fine but IE explorer doesn’t at all. It basically ignores that.
I’ve been checking around and found some work arounds that seem to work for other people but not for me. I’ve created a folder on my website to test this simple issues. http://www.test.kh-media.be/public
I’ve tried to create a wrapper with css (position: absolute; width: 100%;) for around the container. Didn’t work.
Text-align: center; for the container. Didn’t work.
CSS can be viewed in http://www.test.kh-media.be/css/main.css
Can somebody help me with this issues because it’s becoming a real PITA…
Thanks
March 7, 2012 at 4:49 pm #98412Senff
ParticipantCan you show the HTML as well? I don’t see anything wrong in the CSS right away.
March 7, 2012 at 5:10 pm #98414downbylaw
MemberHow do I post clean code so it doesn’t render
March 8, 2012 at 5:26 pm #98525downbylaw
MemberAnyone? So I can paste my html? It keeps rendering…
March 8, 2012 at 8:22 pm #98545Senff
ParticipantPaste HTML — select all HTML — click the
button at the top of the text area (white paper with blue thingies on it).
March 8, 2012 at 10:51 pm #98553downbylaw
Member
KH Media | Web en audiovisuele oplossingen
Could this doctype solve it?
March 8, 2012 at 11:15 pm #98554TheDoc
MemberThe doctype needs to come before the html tag.
March 8, 2012 at 11:16 pm #98555TheDoc
MemberNOt having a doctype throws IE into Quirks Mode which basically means it goes crazy.
March 9, 2012 at 1:56 am #98565karlpcrowley
ParticipantThe start of your html pages should really look something like this
The rest of your code as normal....It’s vital to have the meta charset before the title to prevent a certain type of xss hack
the rest of the code will make IE render the page as it shouldMarch 9, 2012 at 4:53 am #98576Vermaas
ParticipantThis is what i use very often:
And with the css to align the container in the middle:
#container {
width: 970px;
margin: 0px auto;
}
If your div, which you want to center, has no width, it’s almost impossible to align it in the middle of the screen. This is a good way to center your div. For the div’s (header, section, footer) inside the wrapper, just use float.
Hope this is helpfull to you.
March 9, 2012 at 6:57 am #98580Senff
ParticipantAlso not very good:
XX
March 9, 2012 at 7:25 am #98582Paulie_D
MemberAlso…
is not a good idea.
Just give the wrapper/container a
border-top: 5px solid red;
March 9, 2012 at 6:00 pm #98659downbylaw
MemberThanks guys for reviewing my script. The problem is solved now but what about Senff’s comment… What’s wrong with using that div? Should I consider section? What are pro’s and con’s?
Thanks
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.