DifferentPseudonym
DifferentPseudonym

Reputation: 1024

Vertical percentages issue

I can't use percentages in height and vertical margins-paddings. It doesn't matter almost, but I have to vertical center a div and I have to use

#ana > #kapak > .ğ-contey > .anabaslik-kutusu
{
    top: 50%;
    transform:translateY(-50%);
}

that code but top not working.

http://jsfiddle.net/hgLo21f1/

Please Help.

Upvotes: 1

Views: 53

Answers (3)

Paco
Paco

Reputation: 129

I corrected your fiddle

You cannot use the "top" attribute unless you add "position". For example like this:

#ana > #kapak > .ğ-contey > .anabaslik-kutusu
{
    position: relative;
    top: 50%;
    transform:translateY(-50%);
}

Upvotes: 3

DifferentPseudonym
DifferentPseudonym

Reputation: 1024

Add:

#ana > #kapak > .ğ-contey > .anabaslik-kutusu { position:relative; }

Upvotes: 0

Zelta
Zelta

Reputation: 764

I don't really get your problem. If you're trying to achieve vertical centering this article should help. But it's known problem with height in css. Sometimes it's better to use js than height percentages.

Also be sure you can use negative margins, it's really helpful.

Upvotes: 1

Related Questions