Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS + a + vertical align

Status
Not open for further replies.

LordGarfield

IS-IT--Management
Jul 31, 2003
112
BE
hi,

I'm trying to create some squares with text in it. the text should be aligned in the center of the square.
the squares are links to difrent pages.

this is my CSS for one of the squares.

a.vz
{
position:absolute;
top:50%;
left:50%;
margin-left: 230px;
margin-top: 22;
BORDER-TOP: 1px solid #000000;
BORDER-BOTTOM: 1px solid #000000;
BORDER-LEFT: 1px solid #000000;
BORDER-RIGHT: 1px solid #000000;
background: #004990;
text-align: center;
color: #FFFFFF;
font-weight: bold;
width:150;
height:150;
vertical-align: middle;
text-decoration: none;
}


the problem here is that the text is aligned at the top. not in the center. the horizontal align works fine but vertical it doesn't. Has anybody an idee howcome?

best regards
roel.

tank you,

(>" "<)
(='o'=)
-(,,)-(,,)-----
|LORD_GARFIELD|
---------------
 
Try adding
Padding:50% 50% 50% 50%;

In my quick test of your css, it seemed to work.

Paul
 
sorry, hit the button to send instead of Edit. you can try

Padding:50% 0% 50% 0%;

That may look more attractive.

Paul
 
well I also did it with the padding.

I never saw display: block before. I check it out.

tanks all

tank you,

(>" "<)
(='o'=)
-(,,)-(,,)-----
|LORD_GARFIELD|
---------------
 
Here are a couple things you can look at.
The above is a description of the display element and the below
is a list of elements that are supported by different browers. Apparently the display element is only partially supported by most of them.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top