css div 底部对齐_使用CSS将元素对齐到div的底部

css div 底部对齐

The bottom property in CSS is useful to change the vertical position of the positioned element. This property has no effects on non-positioned elements.

CSS中bottom属性对于更改已定位元素的垂直位置很有用。 此属性对未定位的元素没有影响。

Basic syntax:

基本语法:

    Element{
        bottom:length;
    }

Below are the consequences of different position values on the bottom property of div,

以下是divbottom属性对不同位置值的影响,

位置:绝对|固定 (position:absolute|fixed)

When the value of the position is absolute or fixed then the bottom property is useful to set the bottom edge of an element to a unit above or below the bottom edge of its nearest positioned element.

当位置的值是绝对值或固定值时,bottom属性可用于将元素的底边设置为最接近其元素的底边的上方或下方的单位。

Syntax:

句法:

    Element{
        bottom:length;
        position:fixed;
    }

Example:

例:

<!DOCTYPE html>

<html>

<head>
    <style>
        .div0 {
   
            background: pink;
            padding: 10px;
            width: 360px;
            height: 40px;
        }
        
        .div1,
        .div2,
        .div3 {
   
            float: left;
            background: yellow;
            border: 2px solid green;
            width: 115px;
        }
        
        .div2 {
   
            position: fixed;
            bottom: 5px;
        }
    </style>
</head>
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值