I want to float a div
to center. Is it possible? text-align: center
is not working in IE.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
- Adding a timeout to a render function in ReactJS
Use "spacer" divs to surround the div you want to center. Works best with a fluid design. Be sure to give the spacers height, or else they will not work.
Try this, it helped me: wrap the div in tags, the problem is that it will center the content of the div also (if not coded otherwise). Hope that helps :)
Following solution worked for me.
This worked for me.
I included an unordered list on my page twice. One div class="menu" id="vertical" the other to be centered was div class="menu" id="horizontal". Since the list was floated left, I needed an inner div to center it. See below.
The usual technique for this is
margin:auto
However, old IE doesn't grok this so one usually adds
text-align: center
to an outer containing element. You wouldn't think that would work but the same IE's that ignoreauto
also incorrectly apply the text align center to block level inner elements so things work out.And this doesn't actually do a real float.
this could help you..:D