国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > CSS > 正文

css 實現矩形四個邊角加粗的方法

2024-07-11 08:58:42
字體:
來源:轉載
供稿:網友

1、工具/原料

  • html
  • css

2、具體實現

效果圖

html代碼

<body>    <h1 style="color: red">css實現矩形邊角加粗</h1>    <div class="main">        <span></span>        <span></span>        <span></span>        <span></span>    </div></body>

css代碼

        body{            display: flex;            justify-content: center;            flex-direction: column;            align-items: center;        }        .main{            position: relative;            width: 400px;            height: 200px;            border: 1px solid red;        }        .main span:nth-child(1){            position: absolute;            left: -5px;            top: -5px;            padding: 15px;            border-style: solid;            border-color: rebeccapurple;            border-width: 5px 0 0 5px;        }        .main span:nth-child(2){            position: absolute;            right: -5px;            top: -5px;            padding: 15px;            border-style: solid;            border-color: rebeccapurple;            border-width: 5px 5px 0 0;        }        .main span:nth-child(3){            position: absolute;            right: -5px;            bottom: -5px;            padding: 15px;            border-style: solid;            border-color: rebeccapurple;            border-width: 0 5px 5px 0;        }        .main span:nth-child(4){            position: absolute;            left: -5px;            bottom: -5px;            padding: 15px;            border-style: solid;            border-color: rebeccapurple;            border-width: 0 0 5px 5px;        }

原理很簡單, 只要弄清position:relative,border和left,top之間的關系就可以了

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 茌平县| 濮阳市| 永年县| 封开县| 瓮安县| 平果县| 唐山市| 三穗县| 巴林右旗| 吉隆县| 浮山县| 招远市| 砚山县| 同德县| 哈密市| 龙川县| 新干县| 东兰县| 介休市| 通渭县| 利川市| 曲阜市| 同德县| 台中市| 石狮市| 全州县| 梁河县| 景泰县| 永登县| 泾川县| 霸州市| 河池市| 丰顺县| 新干县| 吕梁市| 合川市| 阿拉尔市| 安远县| 灵寿县| 吉木萨尔县| 泰宁县|