<h1>是标题标签,用于显示单个标题。<p>是小标题标签,用于显示小标题。<br>是分隔符标签,用于在文本中插入空格。
样式表(CSS):
style标签用于定义样式,包括颜色、字体、 hover效果等。meta标签用于设置优先级和 viewport参数,如meta name="viewport" content="width=device-width, initial-scale=1"。
应用场景:
- 设置屏幕尺寸:
body { width: 1vw; } - 调整字体大小:
body { font-family: system-ui, sans-serif; } - 设置滚动效果:
html, body { overflow: hidden; }
动态样式:
transform:调整位置,如拉伸或旋转。translate:移动位置,如水平或垂直移动。scale:缩放元素。
常用技巧:
- 使用
before和after标签来调整元素的位置。 - 使用
focus标签来实现焦点跟踪。
常见错误:
- 确认标签名是否与元数据冲突。
- 使用
before和after时,确保正确引用。
HTML标签的标签名规则
冲突情况:
<span>和<p>,避免使用相同标签名。<em>和<strong>,避免使用相同标签名。
常见错误:
- 缺少
before或after,可能导致元素无法正确定位。 - 使用
before时,确保after同时存在,以避免混淆。
数据库使用
关系型数据库:
- 适合建模,自动处理表与表之间的关系。
- 示例:MySQL、PostgreSQL。
非关系型数据库:
- 适合非建模场景,如事务查询。
- 示例:MongoDB、MySQL。
JavaScript事件
常见事件:
document clicks:按Enter触发的事件。window selection,window click:实现选中或点击事件。window.cloneLocation。window.location.href:在URL中添加路径。window.getSelection:执行选中的操作。select:从列表中选择一个元素。back:执行回车事件。
SQL语法
常用语法:
SELECT用于查询数据。FROM和WHERE确定查询范围。LIMIT和HAVING限制结果数量。GROUP BY和HAVING分组查询。
示例项目
一个简单的网页
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">My Website</title>
<style>
body {
font-family: system-ui, sans-serif;
padding: 2px;
}
.container {
max-width: 12px;
margin: 0 auto;
padding: 2px;
}
h1 {
text-align: center;
margin-bottom: 2px;
}
p {
margin-bottom: 1px;
}
.button {
background-color: #7bff;
color: white;
padding: 1px 2px;
border-radius: 5px;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
}
.button:hover {
background-color: #56b3;
}
</style>
</head>
<body>
<div class="container">
<h1>Welcome to My Website! 🎉</h1>
<p>This is a simple website example. You can add more content here.</p>
<button class="button">Learn More</button>
</div>
</body>
</html>
使用CSS调整页面格式
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0;
background-color: #fff;
}
.container {
max-width: 12px;
margin: 0 auto;
padding: 2px;
}
h1 {
color: #333;
text-align: center;
margin-bottom: 2px;
}
p {
color: #666;
line-height: 1.5;
margin-bottom: 1px;
}
.button {
background-color: #7bff;
color: white;
padding: 1px 2px;
border-radius: 5px;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
}
.button:hover {
background-color: #56b3;
}
</style>
</head>
<body>
<div class="container">
<h1>Welcome to My Website! 🎉</h1>
<p>This is a simple website example. You can add more content here.</p>
<button class="button">Learn More</button>
</div>
</body>
</html>
通过以上教程,你已经掌握了HTML、CSS、JavaScript和数据库的基础知识,可以尝试自己动手制作一些项目来提升自己的实际应用能力,学习SS是一个充满潜力的工具,关键是不断的实践和探索。




