CSS vertical-align:text-bottom; [英] CSS vertical-align: text-bottom;

查看:148
本文介绍了CSS vertical-align:text-bottom;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我试图将文本定位到< div> 的底部。 vertical-align:text-bottom; vertical-align:bottom;

Hi there I'm trying to position text to the bottom of the <div>. Neither vertical-align:text-bottom; or vertical-align:bottom;

麻烦的是它是我的导航按钮,如果我推它,然后他们失去对齐。

The trouble is below it is my navigation buttons and if I push it down then they go out of alignment.

有没有办法用我的CSS解决这个问题?

Is there a way I can work around this with my CSS?

a:link {color:#452809}
a:hover {text-decoration:underline;color:#f00}
a:visited {color:#3886e0}
.fleft {float:left}
.fright {float:right}
.clear {clear:both}
* {border:0;margin:0}
**body {font:12px Tahoma,Arial,Helvetica,sans-serif;color:#666;background:#3cb40d}
#main {margin:0 auto;width:780px;background:#fff url(images/vitalbodyhealth.gif) no-repeat center top}
#header {width:780px;margin:10px; height:210px}
#logo {padding-right:10px;text-align:right;padding-bottom:9px;height:150px;vertical-align:text-bottom} 
#logo a {text-decoration:none;text-transform:lowercase;font-style:italic;font-size:16px;color:#fff;font-weight:bold}
#logo H2 a {font-size:10px}
#buttons {padding-top:0px;height:40px;width:780px}
#buttons li {display:inline}
#buttons a {display:block;float:left;width:80px;height:26px;text-align:center;text-decoration:none;color:#fff;font-weight:bold;font-size:14px;padding-top:0px;margin-left:12px}
#buttons a:hover {width:80px;height:36px;text-decoration:underline}
#content {width:720px;margin:0 auto;padding:20px}**
.inner_copy {border:0;color:#f00;float:right;width:50%!important;margin:-100% 0 0 0;overflow:hidden;line-height:0;padding:0;font-size:11px}
#left {width:450px;padding:10px; background:#EFEFEF}
#left H1, #left H2 {color:#3cb40d;margin:0}
#left H1 {font-size:24px;padding:0}
#left H2 {font-size:18px;padding-top:10px}
#left a {color:#3886e0}
#left a:hover {text-decoration:none;color:#f00}
#left a:visited {color:#3886e0}
#right {float:right;width:240px; background:#EFEFEF}
#sidebar {width:240px;background:#EFEFEF}
#sidebar ul {margin:0;padding:0;list-style:none}
#sidebar li {margin-bottom:15px}
#sidebar li ul {padding:10px;border-top:none}
#sidebar li li {margin:0;padding:3px 0}
#sidebar li h2 {height:36px;margin:0;padding:10px 0 0 20px;background:#47872B;font-size:18px;color:#fff}
#sidebar a:link, #sidebar a:visited {text-decoration:none}
#sidebar a:hover {text-decoration:underline}
#sidebar li a {padding-left:10px;background:url(images/img09.gif) no-repeat 1px 5px}
#footer {background:#452809;height:47px;width:780px;margin:0 auto;font-size:10px;color:#fff;padding-top:23px;text-align:center;}
#footer div {padding:10px 38px}
#footer a {color:#fff;font-size:10px;text-decoration:none}
.padding {padding:10px;color:#f00;font-weight:bold}

任何帮助将非常感谢。

Any help would be greatly appreciated.

:)

推荐答案

vertical-align ,您应该在 table 标记上执行。但是有一种方法让其他html标签作为一个表,通过分配一个css display:table 给你的父,和显示: table-cell vertical-align:bottom 将适用于该子女。

To use vertical-align properly, you should do it on table tag. But there is a way to make other html tags to behave as a table by assigning them a css of display:table to your parent, and display:table-cell on your child. Then vertical-align:bottom will work on that child.

HTML:

​​​​​​<div class="parent">
    <div class="child">
        This text is vertically aligned to bottom.    
    </div>
</div>​​​​​​​​​​​​​​​​​​​​​​​​

CSS:

​.parent {
    width: 300px;
    height: 50px;
    display:​ table;
    border: 1px solid red;
}
.child { 
    display: table-cell;
    vertical-align: bottom;
}​

这里是一个实例:链接演示

这篇关于CSS vertical-align:text-bottom;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆