
css
css基础
ivanfor666
虽是一只小鸟,玩的却是整个天空。
展开
-
悬停小提示(组件)
<div>鼠标移到这 <p>我现身了</p> </div> p { display: none; background-color: #ccc; padding: 20px; } div:hover p { display: block; }原创 2021-10-27 14:58:58 · 113 阅读 · 0 评论 -
垂直居中的几种方式
1.height , line-height line-height: 100px; height: 100px; 2. 直接padding 撑大元素 3.position: relative; position: absolute;transform: translate(-50%, -50%); <div class="center"> <p>我是垂直和水平居中。</p> </div> <style&g...原创 2021-10-27 14:55:55 · 222 阅读 · 0 评论 -
弹性布局不只flex, float 也用起来
* { box-sizing: border-box; } .box { float: left; width: 33.33%; padding: 50px; } .clearfix::after { content: ""; clear: both; display: table; } <div class="clearfix"> <div class="box" style="background-color:#bbb"> <p.原创 2021-10-27 13:42:38 · 190 阅读 · 0 评论 -
文字段落加背景图
<div class="wrap"> <h1>这是标题</h1> <p>由于图像的 z-index 为 -1,它将被置于文本之后。</p> <img src="XXX.png"> </div> .wrap{ width:100px; } img { width:100%; height:100px; position: absolute; left: 0px; top:.原创 2021-10-27 11:52:50 · 107 阅读 · 0 评论 -
css: 水平居中的几种方式
1. 块级元素设置宽度, margin :auto; 2. text-align:center; 3. display:flex; justify-content:center; 4.transform: translateX .ddd{ width:200px; border:1px solid red; } .eee{ width:100px; text-align:center; transform: translateX(100px); ...原创 2021-10-27 11:23:55 · 209 阅读 · 0 评论 -
flex 知识重点
容器属性: * 1. 给需要使用display:flex的标签容器定义 width, height; display:flex; width:300px; height:300px; * 2. 给项目排列确定方向(默认反向为 row, nowrap), flex-direction, flex-wrap, 但通常使用 flex-flow = flex-direction + flex-wrap; * 3.然后设置我们最常见的两个属性, justify-content 和 align-item ,原创 2021-07-21 21:18:17 · 68 阅读 · 0 评论