批改状态:合格
老师批语:知识点总结了,内容可更详细些。
浏览器
全局对象:window
url 地址
页面显示的内容就是 HTML 文档
使用 VScode 的 live server 插件实时对保存的代码进行实时预览。
http://front.edu:5500/0611/demo.htmlhttp://127.0.0.1:5500/0611/demo.html
浏览器 页面右键 “审查元素”
elements 代码
console 控制台(比较常用)
window 命令
如果使用 consol.log()在控制台获取对象或元素的信息 document
有 JS 脚本、样式表 CSS、主体 body、编码、头元素、主体元素等等
id 属性 由用户保证它在当前页面中的唯一性
使用#号开头
<h1 id="title-id">php中文网-浪子修罗</h1><style>#title-id {color: blue;}</style>
class 类属性 返回多个具有共同特征的元素集合
使用.开头
<h1 class="title-class">php中文网-浪子修罗</h1><style>.title-id {color: blue;}</style>
在标签中直接使用 style 属性样式优先级大于 class
内联样式,仅对当前元素有效
<h1 class="title-class" style="color:red;">php中文网-浪子修罗</h1>
<style>
元素、标签选择器
元素选择器优先级小于类选择器,但是又小于ID选择器<style> < class < id < style=""
<html><head><meta charset="UTF-8"><title>标题</title></head><body>内容</body></html>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号