标签归档:内部CSS

html CSS链接的集中方法二 内部CSS

使用内部CSS,在HTML文件的部分使用。

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.link {
color: blue;
text-decoration: none;
}

.link:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<a href="https://example.com" class="link">Example Link</a>
</body>
</html>

优点:适用于单个页面的样式定义。不需要额外的文件,便于快速测试。