定格手机样式
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
重置样式
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
去掉列表前端符号
ul,li { list-style: none; }
公共样式
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
ul,li { list-style: none; }
/* 公共样式 */
/* body的背景颜色 */
body { background-color: #f4f4f4; }
/* 相对定位 */
.rel { position: relative; }
/* 绝对定位 */
.abs{ position: absolute }
/* 固定定位 */
.fixed { position: fixed; }
/* 隐藏 */
.dsn { display: none; }
/* 宽度100% */
.w100p { width: 100%; }
.h100p { height: 100%; }
/* 颜色 */
.fff { color: #fff; }
.bg-fff { background-color: #fff; }
/* 主题色 */
.base { color: #f03d37; }
.bg-base { background-color: #f03d37; }
/* 字体 */
.f10 { font-size: 10px; }
.f12 { font-size: 12px; }
.f14 { font-size: 14px; }
.f16 { font-size: 16px; }
.f18 { font-size: 18px; }
.f20 { font-size: 20px; }
.f22 { font-size: 22px; }
.f24 { font-size: 24px; }
.f26 { font-size: 26px; }
.f28 { font-size: 28px; }
.f30 { font-size: 30px; }
.f32 { font-size: 32px; }
.f34 { font-size: 34px; }
.f36 { font-size: 36px; }
/* 弹性盒子 */
.flex { display: flex; }
.jc-c { justify-content: center; }
.jc-sb { justify-content: space-between; }
.jc-sa { justify-content: space-around; }
.aic { align-items: center; }
/* 盒子排成一列 */
.fdc { flex-direction: column; }
/* 剩余空间分配 */
.fg1 { flex-grow: 1; }
.fww {flex-wrap:wrap;}
/* margin */
.mt-5 {margin-top: 5px;}
.mt-10 {margin-top: 10px;}
.mt-15 {margin-top: 15px;}
.mt-20 {margin-top: 20px;}
.mt-25 {margin-top: 25px;}
.mt-30 {margin-top: 30px;}
.ml-5 {margin-left: 5px;}
.ml-10 {margin-left: 10px;}
.ml-15 {margin-left: 15px;}
.ml-20 {margin-left: 20px;}
.ml-25 {margin-left: 25px;}
.ml-30 {margin-left: 30px;}
.mr-5 {margin-right: 5px;}
.mr-10 {margin-right: 10px;}
.mr-15 {margin-right: 15px;}
.mr-20 {margin-right: 20px;}
.mr-25 {margin-right: 25px;}
.mr-30 {margin-right: 30px;}
.mb-5 {margin-bottom: 5px;}
.mb-10 {margin-bottom: 10px;}
.mb-15 {margin-bottom: 15px;}
.mb-20 {margin-bottom: 20px;}
.mb-25 {margin-bottom: 25px;}
.mb-30 {margin-bottom: 30px;}
/* padding */
.pt-5 {padding-top: 5px;}
.pt-10 {padding-top: 10px;}
.pt-15 {padding-top: 15px;}
.pt-20 {padding-top: 20px;}
.pt-25 {padding-top: 25px;}
.pt-30 {padding-top: 30px;}
.pl-5 {padding-left: 5px;}
.pl-10 {padding-left: 10px;}
.pl-15 {padding-left: 15px;}
.pl-20 {padding-left: 20px;}
.pl-25 {padding-left: 25px;}
.pl-30 {padding-left: 30px;}
.pr-5 {padding-right: 5px;}
.pr-10 {padding-right: 10px;}
.pr-15 {padding-right: 15px;}
.pr-20 {padding-right: 20px;}
.pr-25 {padding-right: 25px;}
.pr-30 {padding-right: 30px;}
.pb-5 {padding-bottom: 5px;}
.pb-10 {padding-bottom: 10px;}
.pb-15 {padding-bottom: 15px;}
.pb-20 {padding-bottom: 20px;}
.pb-25 {padding-bottom: 25px;}
.pb-30 {padding-bottom: 30px;}
<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>Document</title>
</head>
<body>
<!-- 文本输入框 -->
<input type="text" placeholder="请输入手机号码"> <br/>
<!-- 密码输入框 -->
<input type="password" placeholder="请输入密码"> <br/>
<!-- 单选框,添加name=xxx实现单选 -->
男<input type="radio" name="aaa">
女<input type="radio" name="aaa"> <br>
<!-- 多选框 -->
篮球<input type="checkbox">
足球<input type="checkbox">
羽毛球<input type="checkbox">
/* 设置圆角 */
border-radius: 10px;
文本字体
.box {
border: 1px solid;
padding: 10px;
width: 300px;
/* 字体大小 */
font-size: 20px;
/* 字体颜色 */
color: red;
/* 行高 */
/* line-height: 50px; */
line-height: 1.5;
/* 加粗100~900或者bold */
/* font-weight: 500; */
font-weight: bold;
}
.box {
width: 300px;
height: 100px;
border: 1px solid red;
/* 文本对齐方式 */
text-align: left; /*左对齐*/
text-align: right; /*右对齐*/
text-align: center; /*居中*/
/* 垂直对齐: 让行高=元素的高度 */
line-height: 100px;
<!--控制行间距离,当文本到底最右边掉落时控制下面一行与上面一行的距离-->
}
<span class="aa mt-10"><b>理由:</b>OC是一种通用、高级、面向对象的编程语言。詹姆作为名门望族之后,气质出众,但他拥有其他角色不具备的凡人之痛,错爱、忠孝难两全...</span>
<!--<b>对字体进加粗,快穿插在文本中进行使用 -->
text-indent: 2em;<!--首行缩进两个字符-->
/*对段落进行首行缩进*/
相当定位和绝对定位
.box1 {
width: 200px;
height: 200px;
border: 1px solid red;
/* 1.给父元素设置相对定位 */
position: relative;
}
.box2 {
/* 2.给子元素设置绝对定位 */
position: absolute;
/* 3.设置子元素在父元素中的位置 */
right: 0;
bottom: 0;
background-color: gray;
width: 50px;
height: 50px;
}
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。