日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

css absolute絕對定位 讓 top 和bottom 同時生效

作者:yunchong_zhao 更新時間: 2022-04-17 編程語言

在這里插入圖片描述
只要你的元素沒有設置高度就可以 實現。可以用來處理一些響應式的頁面處理

DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Documenttitle>
    <style>
        div {
            position: absolute;
            top: 50px;
            bottom: 150px;
            left: 50px;
            right: 50px;
            border: 1px solid #f00;
        }
    style>
head>
<body>
    <div>div>
body>
html>

關注我 持續更新前端知識

原文鏈接:https://yunchong.blog.csdn.net/article/details/122543840

欄目分類
最近更新