Witam, za pewne dla wielu z was to pestka, ale dla mnie to masakryczna zmora.
Próbowałem już troche sposobów ( padding, margin, vertical-align) ale nic mi nie pomaga.
Jak ustawić wyrównanie na środku ( wertykalnie ) napisu który znajduje się pomiędzy <div position> ?
moje 2 pliki :
index.html
<div class="active float_left"><div class="position">Home
</div></div> <div class="ex2 float_left"><div class="position">Home
</div></div> <div class="ex2 float_left"><div class="position">Home
</div></div> <div class="ex2 float_left"><div class="position">Home
</div></div> <div class="ex2 right_round float_left"><div class="position">Home
</div></div>
style
#menu{
width: 990px;
height: 82px;
margin-left: 100px;
}
.active{
height: 80px;
width: 197px;
margin-top: 1px;
background-image: linear-gradient(bottom, rgb(142,0,0) 0%, rgb(255,0,47) 100%);
background-image: -o-linear-gradient(bottom, rgb(142,0,0) 0%, rgb(255,0,47) 100%);
background-image: -moz-linear-gradient(bottom, rgb(142,0,0) 0%, rgb(255,0,47) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(142,0,0) 0%, rgb(255,0,47) 100%);
background-image: -ms-linear-gradient(bottom, rgb(142,0,0) 0%, rgb(255,0,47) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(142,0,0)),
color-stop(1, rgb(255,0,47))
);
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.ex2{
height: 40px;
width: 197px;
margin-top: 21px;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
background-image: linear-gradient(bottom, rgb(254,254,254) 0%, rgb(235,235,235) 48%, rgb(243,243,243) 52%, rgb(254,254,254) 100%);
background-image: -o-linear-gradient(bottom, rgb(254,254,254) 0%, rgb(235,235,235) 48%, rgb(243,243,243) 52%, rgb(254,254,254) 100%);
background-image: -moz-linear-gradient(bottom, rgb(254,254,254) 0%, rgb(235,235,235) 48%, rgb(243,243,243) 52%, rgb(254,254,254) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(254,254,254) 0%, rgb(235,235,235) 48%, rgb(243,243,243) 52%, rgb(254,254,254) 100%);
background-image: -ms-linear-gradient(bottom, rgb(254,254,254) 0%, rgb(235,235,235) 48%, rgb(243,243,243) 52%, rgb(254,254,254) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(254,254,254)),
color-stop(0.48, rgb(235,235,235)),
color-stop(0.52, rgb(243,243,243)),
color-stop(1, rgb(254,254,254))
);
}
.ex2:hover {
height: 80px;
width: 197px;
margin-top: 1px;
background-image: linear-gradient(bottom, rgb(68,68,68) 0%, rgb(136,136,136) 100%);
background-image: -o-linear-gradient(bottom, rgb(68,68,68) 0%, rgb(136,136,136) 100%);
background-image: -moz-linear-gradient(bottom, rgb(68,68,68) 0%, rgb(136,136,136) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(68,68,68) 0%, rgb(136,136,136) 100%);
background-image: -ms-linear-gradient(bottom, rgb(68,68,68) 0%, rgb(136,136,136) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(68,68,68)),
color-stop(1, rgb(136,136,136))
);
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.float_left{
float: left;
}
.cls{
clear: both;
}
/* GRADIENT CZERWONY */
.red_grad{
background-image: linear-gradient(bottom, rgb(142,0,0) 0%, rgb(255,0,47) 100%);
background-image: -o-linear-gradient(bottom, rgb(142,0,0) 0%, rgb(255,0,47) 100%);
background-image: -moz-linear-gradient(bottom, rgb(142,0,0) 0%, rgb(255,0,47) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(142,0,0) 0%, rgb(255,0,47) 100%);
background-image: -ms-linear-gradient(bottom, rgb(142,0,0) 0%, rgb(255,0,47) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(142,0,0)),
color-stop(1, rgb(255,0,47))
);
}
/* SŁABY SZARY CZERWONY */
.light_grey_grad{
background-image: linear-gradient(bottom, rgb(254,254,254) 0%, rgb(235,235,235) 48%, rgb(243,243,243) 52%, rgb(254,254,254) 100%);
background-image: -o-linear-gradient(bottom, rgb(254,254,254) 0%, rgb(235,235,235) 48%, rgb(243,243,243) 52%, rgb(254,254,254) 100%);
background-image: -moz-linear-gradient(bottom, rgb(254,254,254) 0%, rgb(235,235,235) 48%, rgb(243,243,243) 52%, rgb(254,254,254) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(254,254,254) 0%, rgb(235,235,235) 48%, rgb(243,243,243) 52%, rgb(254,254,254) 100%);
background-image: -ms-linear-gradient(bottom, rgb(254,254,254) 0%, rgb(235,235,235) 48%, rgb(243,243,243) 52%, rgb(254,254,254) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(254,254,254)),
color-stop(0.48, rgb(235,235,235)),
color-stop(0.52, rgb(243,243,243)),
color-stop(1, rgb(254,254,254))
);
}
/* SZARY CZERWONY */
.grey_grad{
}
/* ZAOKRĄGLANIE GÓRNE */
.top_box{
border-top-left-radius: 10px 10px;
border-top-right-radius: 10px 10px;
}
/* ZAOKRĄGLANIE DOLNE */
.bot_box{
border-bottom-left-radius: 10px 10px;
border-bottom-right-radius: 10px 10px;
}
/* ZAOKRĄGLANIE LEWE */
.left_round{
border-top-left-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
}
/* ZAOKRĄGLANIE PRAWE */
.right_round{
border-top-right-radius: 10px 10px;
border-bottom-right-radius: 10px 10px;
}
.round{
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.position{
position: relative;
height: 100%;
text-align: center;
border: 1px solid white;
}
Przepraszam za zaśmiecanie, ale właśnie to znalazłem.
display:-moz-box;
-moz-box-orient:horizontal;
-moz-box-pack:center;
-moz-box-align:center;
Ten post edytował Micchaleq 16.01.2012, 15:16:46