I want to have a text aligned centrally on the bottom of the page.
I have the following code:
<html>
<head>
<title>test</title>
</head>
<body>
<div style="position: relative">
<p style="position: fixed; bottom: 0; width:100%; text-align: center"> bla bla
</p>
</div>
</body>
</html>
It works fine in Firefox and Chrome but not in IE.
You need to add a doctype as the very first line:
<!DOCTYPE html>
<html>
Without it, IE is using Quirks Mode which emulates IE 5.5 (which doesn't support position: fixed
).
Might be a copy and paste issue but you need an ending quote in your <p style=... >
, that should help. Another option is the set your text-align: center
on the actual <div>
so your aligning the text inside the div. Both of these worked in IE 9 - what version of IE are you using that it's not working in?
<html>
<head>
<title>test</title>
</head>
<body>
<div style="position: relative">
<p style="position: fixed; bottom: 0; width:100%; text-align: center"> bla bla</p>
</div>
</body>
</html>
OR
<html>
<head>
<title>test</title>
</head>
<body>
<div style="position: relative; text-align: center">
<p style="position: fixed; bottom: 0; width:100%;"> bla bla</p>
</div>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With