• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How do I center this? >_<

axas

Well-Known Member
Joined
Feb 23, 2008
Messages
870
Reaction score
94
linkai.html
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="linkai.css">
<title>..::Linkai::..</title>
</head>
<body>

<div class ="center">
<ul>
<li><a href="linkas.html">Linkas</a><br/></li>
<li><a href="linkas.html">Tas pats linkas</a><br/></li>
<li><a href="linkas.html">Vel tas pats</a><br/></li>
</ul>
</center>

</body>
</html>

linkai.css
PHP:
a {
font-size:12px;
font-family:"Arial",Helvetica,sans-serif;}
 
a:link ,a:visited{
color:black;
text-decoration:none;
text-transform:uppercase;
display:block;
width:120px;
font-weight:bold;
color:#FFFFFF;
background-color:#98bf21;
text-align:center;
padding:4px;
margin-right:4px;}

a:hover, a:active{background-color:#7A991A;}

ul{
list-style-type:none;
margin:0;
padding:0;
overflow:hidden; }
li {float:left;}

.center{
width: 700px ;
margin-left: auto ;
margin-right: auto ;}

doesn't seem to work either
 
Centering lines of text

Code:
P { text-align: center }
H2 { text-align: center }

Centering a block or image

Code:
P.blocktext {
    margin-left: auto;
    margin-right: auto;
    width: 6em
}
...
<P class="blocktext">This rather...

This is also the way to center an image: make it into block of its own and apply the margin properties to it. For example:

Code:
IMG.displayed {
    display: block;
    margin-left: auto;
    margin-right: auto }
...
<IMG class="displayed" src="http://otland.net/f295/how-do-i-center-_-111479/..." alt="...">
 
Why are you closing "</center>" while you've not written "<center>"?

<center></center> would work, but it's not correct xHTML I guess.

CSS:
Code:
.center {
width: 700px;
margin-left: auto;
margin-right: auto;
}

HTML:
HTML:
<div class="center">
<!-- ur stuff -->
</div>

[highlight]Try it! :p[/highlight]
 
Last edited:
Why are you closing "</center>" while you've not written "<center>"?

<center></center> would work, but it's not correct xHTML I guess.

CSS:
Code:
.center {
width: 700px;
margin-left: auto;
margin-right: auto;
}

HTML:
HTML:
<div class="center">
<!-- ur stuff -->
</div>

[highlight]Try it! :p[/highlight]

Remember that users may have different video resolutions, so your code doesn't fit in axas' request.
 
Remember that users may have different video resolutions, so your code doesn't fit in axas' request.

His class had width 700px, so that's why I added that also. Anyways, he already fixed this, but he's using width 900px though.
 
Last edited:

Similar threads

  • Question
RevScripts Rank Reset
Replies
3
Views
604
Back
Top