前端入门: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 ;

}

相关推荐
子淼8121 分钟前
HTML入门指南:构建网页的基石
前端·html
农夫山泉不太甜3 分钟前
Electron离屏渲染技术详
前端
深念Y4 分钟前
Chrome MCP Server 配置失败全记录:一场历时数小时的“fetch failed”排查之旅
前端·自动化测试·chrome·http·ai·agent·mcp
一个有故事的男同学6 分钟前
从零打造专业级前端 SDK (四):错误监控与生产发布
前端
2601_948606187 分钟前
从 jQuery → V/R → Lit:前端架构的 15 年轮回
前端·架构·jquery
wuhen_n12 分钟前
Vite 核心原理:ESM 带来的开发时“瞬移”体验
前端·javascript·vue.js
nibabaoo13 分钟前
前端开发攻略---vue3长列表性能优化终极指南:虚拟滚动、分页加载、时间分片等6种方案详解与代码实现
前端·javascript·vue.js·虚拟滚动·分页加载·长列表·时间分片
未完成的歌~26 分钟前
前端 AJAX 详解 + 动态页面爬虫实战思路
前端·爬虫·ajax
Mintopia31 分钟前
时间源不统一 + 网络延迟 + 客户端时钟偏移
前端·架构
不甜情歌32 分钟前
拆解JS原型核心:显式原型(prototype)+ 隐式原型(__proto__)+原型链,解锁JS继承的关键密码
前端·javascript