i'm using css style like this
text-align:center;
its working in IE and doesn't work with Safari..
any suggestions.
thanks,
i'm using css style like this
text-align:center;
its working in IE and doesn't work with Safari..
any suggestions.
thanks,
It depends on what you are trying to style. You are probably trying to center a block level element like a DIV or UL. In that case, you center using
div {
margin-left:auto;
margin-right:auto;
padding-left:<some fixed size>;
padding-right:<some fixed size>;
width:<some fixed size>;
}
Validating your html and css is the first step to figuring out any rendering issues (even in craptastic browsers like IE 6).
Centering textual content has as far as I know no specific browser/doctype issues. So it look like that you're trying to center something else than text. If you actually want to center a block element, give it a fixed width
(in pixels) and apply margin: 0 auto;
on it as well.
Here's an SSCCE
<!doctype html>
<html lang="en">
<head>
<title>SO question 1897444</title>
<style>
#center {
margin: 0 auto; /* top and bottom 0, left and right expanding. */
width: 300px; /* Required to have a reference point to center. */
border: 1px solid black; /* Not required, just presentational. */
}
</style>
</head>
<body>
<div id="center">Centered block element</div>
</body>
</html>
This however won't work in IE in quirks mode. Just ensure that you're using a strict doctype.
I got the point I made that code:
width: 190px;
padding-left:23px;
height: auto;
text-align: left;
line-height: 18px;
and its working right now thanks for all trying to help me