HTML简介
HTML(HyperText Markup Language,超文本标记语言)是一种用于创建网页的标准标记语言,它允许开发者使用一系列预定义的标签和属性来描述网页的结构、内容和样式,HTML5是HTML的最新版本,它引入了许多新的元素和属性,使得网页开发变得更加强大和灵活。
HTML基本结构
一个简单的HTML页面包括以下几个部分:
1、<!DOCTYPE html>
声明:告诉浏览器这是一个HTML5文档。
2、<html>
标签:包含整个页面的内容。
3、<head>
标签:包含页面的元数据,如字符集、标题、样式表和脚本等。
4、<title>
标签:定义页面的标题,显示在浏览器的标签页上。
5、<body>
标签:包含页面的主体内容,如文本、图片、链接等。
6、</html>
标签:表示页面的结束。
下面是一个简单的HTML页面示例:
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <title>我的第一个HTML页面</title> <style> body { font-family: "微软雅黑", sans-serif; background-color: lightblue; } </style> </head> <body> <h1>欢迎来到我的网站!</h1> <p>这是一个简单的HTML页面示例。</p> <img src="example.jpg" alt="示例图片"> </body> </html>
HTML常用特效及实现方法
1、文字加粗效果
在<strong>
标签中添加需要加粗的文字。
<strong>这是加粗的文字。</strong>
2、文字居中效果
使用CSS的text-align: center;
属性实现文字居中。
<!DOCTYPE html> <html> <head> <style> .center { text-align: center; } </style> </head> <body> <div class="center">这是居中的文字。</div> </body> </html>
3、设置背景颜色和字体颜色效果
使用内联样式或者外部样式表(CSS)设置背景颜色和字体颜色。
<!DOCTYPE html> <html> <head> <style> .red-background { background-color: red; color: white; padding: 10px; border-radius: 5px; width: 200px; height: 100px; display: inline-block; margin: 20px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5); text-align: center; font-size: 24px; font-weight: bold; cursor: pointer; transition: all 0.3s ease; animation: fadeInOut 2s infinite linear; user-select: none; touch-action: none; white-space: nowrap; overflow: hidden; text-overflow: clip; line-height: normal; word-wrap: break-word; vertical-align: middle; border-collapse: collapse; box-sizing: border-box; min-width: fit-content; min-height: fit-content; outline: none; position: relative; z-index: auto; top: auto; right: auto; bottom: auto; left: auto; transform: none; backface-visibility: hidden; perspective: none; transform-style: preserve-3d; transform-origin: center center; transform-position: center center; transform-rotation: nonedeg translate3d(0px, 0px, 0px); transform-scale(1); transform-translate(0px, 0px); transition-delay: inherit; transition-timing-function: linear; transition-duration: inherit; transition-property: opacity, transform, box-shadow, filter, backdropFilter, backdropImage, WebkitBackdropFilter, transformOrigin, transformStyle, transformBox, transformBoxWebkit,webkitTransform, willChange, willChangeStyle, willChangeTransitionProperties, fillOpacity, strokeDasharray, strokeDashoffset, strokeLinecap, strokeLinejoin, strokeMiterlimit, strokeOpacity, strokeWidth, styleFloat, contentStyleType, pointerEvents, touchAction, tapHighlightColor, touchCalloutColor, userDrag, msUserSelectEnabled, MozUserSelectEnabled, WebkitUserSelectEnabled, oUserSelectEnabled, userDragOver, msUserDragOver, MozUserDragOver, WebkitUserDragOver, oUserDragOver, userSelect, msUserSelect, MozUserSelect, WebkitUserSelect, oUserSelect"; animation-name: fadeInOut; animation-iteration-count: infinite; animation-timing-function: linear; animation-delay: 0s; animation-direction: alternate; animation-fill-mode: forwards; animation-play-state: running; animation-iteration-count: infinite; animation-timeline: linear infinite; animation-timing-function: linear; animation-delay: initial; animation-direction: normal; animation-fill-mode: forwards; animation-play-state: running; animation-iteration-count: infinite; animation-timeline: linear infinite; animation-timing-function: linear; animation-delay: initial; animation-direction: normal; animation-fill-mode: forwards; animation-play-state: running; animation-iteration-count: infinite; animation-timeline: linear infinite; animation-timing-function: linear; animation-delay: initial; animation-direction: normal; animation-fill-mode: forwards; animation-play-state: running; animation-iteration-count: infinite; animation-timeline: linear infinite; animation-timing-function: linear; animation-delay: initial; animation-direction: normal; animation-fill-mode: forwards; animation-play-state: running; animation-iteration-count: infinite; animation-timeline: linear infinite; animation-timing-function: linear; animation-delay: initial; animation-direction: normal; animation-fill-mode: forwards; animation
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/232770.html