前端入门:HTML(CSS边框综合案例)

案例:

源代码:

css-borders.html:

<body>

<div id="square"> </div>

<br>

<div id="triangle"> </div>

<br>

<div id="trapezium"> </div>

<br>

<div id="windmills">

<div class="box1"></div>

<div class="box2"></div>

<div class="box3"></div>

<div class="box4"></div>

</div>

</body>

border-style.css:

#square {

width: 0px;

height: 0px;

border-top: 50px solid red;

border-right: 50px solid yellow;

border-bottom: 50px solid blue ;

border-left: 50px solid green;

}

#triangle {

width: 0px;

height: 0px;

border: 50px solid transparent;

border-top: 50px solid red;

}

#trapezium {

width: 0px;

height: 0px;

border-right: 50px solid blue;

border-bottom: 50px solid blue ;

border-left: 50px solid transparent;

}

#windmills {

width: 200px;

height: 200px;

border: 2px solid gray;

}

#windmills div{

float: left;

}

#windmills .box1 {

width: 0px;

height: 0px;

border: 50px solid transparent;

border-bottom: 50px solid red ;

}

#windmills .box2 {

width: 0px;

height: 0px;

border: 50px solid transparent;

border-left: 50px solid red ;

}

#windmills .box3 {

width: 0px;

height: 0px;

border: 50px solid transparent;

border-right: 50px solid red ;

}

#windmills .box4 {

width: 0px;

height: 0px;

border: 50px solid transparent;

border-top: 50px solid red ;

}

相关推荐
甲维斯15 分钟前
GLM5.2超过Opus4.8Think,全球第二了!
前端·人工智能·ai编程
黄敬峰17 分钟前
纯 CSS3 打造 3D 旋转魔方:从文档流、Flex 布局到空间变换的硬核复盘
css
by————组态18 分钟前
Ricon组态系统 - 新一代Web可视化组态平台
前端·后端·物联网·架构·组态·组态软件
JieE21219 分钟前
手把手带你用纯 CSS 实现一个 3D 旋转魔方,这些前端基础你能打几分?
前端·css·html
lichenyang45331 分钟前
鸿蒙 Web 容器(二):H5 和 ArkTS 说话前,先定一份「协议」
前端
JYeontu34 分钟前
开箱流水加载动画
前端·javascript·css
RANxy35 分钟前
AntV 入门系列:G6 图可视化实战
前端
尽欢i37 分钟前
Vue3 customRef 封神教程:防抖、本地存储、自动埋点一套搞定,模板干干净净
前端·javascript·vue.js
VOLUN40 分钟前
TypeScript封装通用RESTful BaseAPI,后台接口代码精简80%
前端·javascript