<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML CSS Support Example</title>
<style>
/* 简单的CSS样式,用于设置页面中元素的外观 */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: #fff;
padding: 10px 0;
text-align: center;
}
main {
padding: 20px;
}
p {
line-height: 1.6;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
.box {
background: #fff;
border: 1px solid #ccc;
padding: 20px;
margin: 10px 0;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<header>
<h1>HTML and CSS Support</h1>
</header>
<main>
<div class="container">
<div class="box">
<h2>Welcome to the HTML and CSS Support Page</h2>
<p>This page demonstrates how HTML and CSS can be used together to create a structured and styled web page.</p>
</div>
</div>
</main>
</body>
</html>
HTML结构:
<!DOCTYPE html>
声明文档类型为HTML5。<html lang="en">
设置文档语言为英语。<head>
部分包含元数据和链接到外部资源(如样式表)。<title>
标签定义浏览器标签中的标题。<body>
包含网页的主要内容。CSS样式:
<style>
标签在文档头部内嵌入CSS样式。body
设置字体、背景颜色和外边距。header
定义页眉的样式,包括背景颜色、文本颜色和内边距。main
和 .container
类用于布局和对齐内容。.box
类添加了边框、内边距和阴影效果,使内容区域更加突出。通过这个示例,你可以看到如何使用HTML来构建页面结构,并使用CSS来美化这些结构。
上一篇:html for循环
下一篇:html播放器
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站