当前位置: 首页 > news >正文

css3

基础

<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>style</title><!-- link(外部样式)和style(内部样式)优先级相同,重复写会覆盖 --><link rel="stylesheet" href="main.css"/><style>/* 标签选择器 */h1 {background-color: aquamarine;/* !important 表示优先级最高 */color: black !important;}/* 类选择器 */.class1{color: red;}/* id选择器 */#id1{color: blue;}/* 后代选择器:#id2内所有的p标签 */#id2 p{color: royalblue;}/* 子代选择器:#id2的第一级子标签 */#id2 > p{text-decoration-line: underline;}/* 伪类选择器:需要有a的选择器 */a{}/* 鼠标置于a标签,颜色改变 */a:hover {color: red;}a:link{color: yellow;}a:visited{color: green;}a:active{color: blue;}body{background-color: aliceblue;background-image: url("../img/demo2.png");background-repeat: no-repeat;background-size: 200px 200px;/* 背景固定 */background-attachment: fixed;/* 背景随滚动条滚动 *//* background-attachment: scroll; */background-position-x: center;background-position-y: center;/* xy轴占比 */background-position: 10% 10%;}span{/* font-size: 20px;font-family: "Microsoft YaHei UI";font-weight: bold;font-style: italic; *//* 连写要注意顺序 */font: italic bold 30px "Microsoft YaHei UI";}p{font-size: 16px;width: 120px;color: crimson;line-height: 24px;/* 缩进 */text-indent: 1em;}</style></head><body><!-- 行内样式优先级高于内部样式 --><h1 style="background-color: aqua; text-align: center;">111</h1><h1 class="class1">222</h1><h1 id="id1">333</h1><div id="id2"><p>p1</p><div><p>p2</p></div></div><a href="">百度</a></body>
</html>

计时器

<h1 id="clock"></h1>
<script>const formatTime = n => n < 10 ? '0' + n : n;function updateClock(){const date = new Date();const hours = formatTime(date.getHours());const minutes = formatTime(date.getMinutes());const seconds = formatTime(date.getSeconds());const clock = document.getElementById("clock");clock.textContent = `${hours}:${minutes}:${seconds}`;}setInterval(updateClock,1000);
</script>
http://www.lryc.cn/news/241792.html

相关文章:

  • 超级应用平台(HAP)起航
  • cocos2dx ​​Animate3D(二)
  • 基于java技术的社区交易二手平台
  • (Matalb回归预测)GA-BP遗传算法优化BP神经网络的多维回归预测
  • 【Docker】从零开始:10.registry搭建私有仓库
  • 树莓派上使用Nginx通过内网穿透实现无公网IP访问内网本地站点
  • 长征故事vr互动教育体验系统让师生感同身受
  • 汽车级芯片NCV7518MWATXG 可编程六沟道低压侧 MOSFET预驱动器 特点、参数及应用
  • 【分布式】小白看Ring算法 - 03
  • 使用Git bash切换Gitee、GitHub多个Git账号
  • 【RtpRtcp】1: webrtc m79:audio的ChannelReceive 创建并使用
  • Ubuntu系统安装docker
  • 如何访问linux上的web服务
  • Vatee万腾的数字化掌舵:Vatee科技解决方案的全面引领
  • YOLOv5 第Y6周 模型改进
  • Unity Android FireBase bugly报错查询
  • React中如何解决点击<Tree>节点前面三角区域不触发onClick事件
  • 如何利用4G路由器构建茶饮连锁店物联网
  • 【2024系统架构设计】 系统架构设计师第二版-大数据架构理论设计与实践
  • 正整数分解
  • 基于51单片机电子钟闹钟LCD1602显示proteus仿真设计
  • 第三节-Android10.0 Binder通信原理(三)-ServiceManager篇
  • 使用XHProf查找PHP性能瓶颈
  • 矩阵论(Matrix)
  • 解决Emmy Lua插件在IDEA或 Reder 没有代码提示的问题(设置文件关联 增加对.lua.txt文件的支持)
  • macos端文件夹快速访问工具 Default Folder X 最新for mac
  • 树形 DP:树的直径
  • 【Python百宝箱】第三维度的魔法:探索Python游戏世界
  • 3ds Max 电脑配置建议 | 建模+渲染选专业显卡or游戏显卡?
  • 水淹七军(递归,又是递归)