前端基础——HTML总结

news/2024/7/19 13:52:09 标签: html, css, html5, js, web
webkit-tap-highlight-color: rgba(0, 0, 0, 0);">

一、HTML

HTML(HyperText Mark-up Language)是超文本标记语言。

详细学习参考W3C网址以及菜鸟教程

网页实现基本结构

  • HTML:页面结构
  • CSS:页面样式,如元素大小、颜色、位置、隐藏显示、部分动效等
  • JavaScript:页面行为,部分动画效果,页面与用户交互等
html"><!DOCTYPE html>
<html lang="en">
    <head>            
        <meta charset="UTF-8">
        <meta name="keywords" content="html,css,javascript">
        <meta name="description" content="前端学习">
        <meta http-equiv="refresh" content="3; url=https://www.baidu.com">
        <title>网页标题</title>
        <style type="text/css">css">
            div{ width:100px; height:100px; color:red }
        </style>
    </head>
    <body>
        网页显示内容
    </body>
</html>

meta标签说明:

  • keywords:表示网站的关键字。
  • description:指定网站的描述。
  • title:网站搜索结果的超链接上的文字描述。
  • http-equiv=“refresh”:N秒后跳转指定网址。

二、HTML常用转义字符

显示结果描述实体名称
空格&nbsp;
<小于号&lt;
>大于号& gt;
&和号&
"引号"

三、常见标签

图像标签

属性含义
src图像路径
width图像宽
height图像高
alt图像不能显示时的文本

链接标签

说明:在网页中不仅可以创建文本超链接,还可以在图像,表格,音频,视频都可以添加超链接

属性含义
href跳转url,#或javascript:;作为空链接
target目标弹窗弹出方式

表单标签

属性含义
typetext 单行文本输入框
password 密码输入框
radio 单选按钮
checkbox 多选按钮
button 普通话按钮
submit 提交按钮
reset 重置按钮
image 图像按钮
file 文件按钮
email 邮箱格式输入框
url 网址格式输入框
number 数字格式输入框
search 搜索框样式输入框
name控件名称
valueinput标签默认文本
sizeinput标签显示宽度
maxlengthinput标签允许输入的最大字符数量
placeholder占位符
autofoces自动获取焦点
required必填项

<label> 标签

属性含义
for用于绑定input标签(请把 “for” 属性的值设置为相关元素的 id 属性的值)

文本域标签

属性含义
cols每行显示字符数
rows显示的行数

表单域

属性含义
action提交表单的url地址
method提交方式
name表单名称,用于区分一个页面多个表单(为控件命名,以备后台程序 ASP、PHP 使用)
html"><strong> 加粗

<em> 斜体

<del> 加删除线

<ins> 加下划线

<header> 头部标签

<nav> 导航栏标签

<footer> 底部标签

<article> 文章标签

<section> 文章的区域

<aside> 侧边区域

表单的基本使用(写一遍就会)

html"><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表单</title>
</head>
<body>
    <form action="#">
        <fieldset>
            <legend>学生档案</legend>
            <label for="username">姓名:</label>
            <input type="text" name="username" id="username" placeholder="请输入用户名"><br>
            <label for="userPhone">手机号码:</label>
            <input type="tel" name="userPhone" id="userPhone" pattern="^1\d{10}$"><br>
            <label for="email">邮箱地址:</label>
            <input type="email" required="required" name="email" id="email"><br>
            <label for="collage">所属学校:</label>
            <input type="text" name="collage" id="collage" list="cList" placeholder="请选择"><br>
            <datalist id="cList">
                <option value="前端学院"></option>
                <option value="C++学院"></option>
                <option value="java学院"></option>
            </datalist>
            <label for="score">入学成绩:</label>
            <input type="number" max="100" min="0" value="0" id="score"><br>
            <form action="#">
                <fieldset>
                    <legend>学生档案</legend>
                    <label>姓名:<input type="text" placeholder="请输入学生姓名"></label><br><br>
                    <label>手机号:<input type="tel"></label><br><br>
                    <label>邮箱:<input type="email"></label><br><br>
                    <label>所属学校:<input type="text" placeholder="请选择学校" list="university"></label><br><br>
                    <datalist id="university">
                        <option>java学院</option>
                        <option>前端学院</option>
                        <option>C++学院</option>
                        <option>Python学院</option>
                    </datalist>
                    <label>所选择的专业:
                    <select name="major">
                        <option value="1">开发</option>
                        <option value="2">测试</option>
                        <option value="3">产品</option>
                    </select> </label><br><br>
                    <label>出生日期:<input type="date"></label><br><br>
                    <label>成绩:<input type="number"></label><br><br>
                    <label>毕业时间:<input type="date"></label><br><br>
                    <input type="submit">
                    <input type="reset">
                </fieldset>
            </form>
            <label for="inTime">入学时间:</label>
            <input type="date" id="inTime" name="inTime"><br><br>
            <label for="leaveTime">毕业时间:</label>
            <input type="date" id="leaveTime" name="inTime"><br><br>
            <input type="submit">
        </fieldset>
    </form>
</body>
</html>

音视频标签

html"><audio src="audio.mp3" controls autoplay loop></audio>
html"><audio controls>
    对不起,您的浏览器不支持播放音频!请升级浏览器!
    <source src="audio.mp3">
    <source src="audio.ogg">
</audio>
html"><video controls>
    <source src="flower.mp4">
</video>

四、HTML标签分类

HTML标签可分为:容器级和文本级。

容器级的标签中可以嵌套其它所有的标签 ,文本级的标签中只能嵌套文字/图片/超链接,不能嵌套容器级

容器级

html">div h li ul ol dl dt dd......

文本级

html">p span a img buis strong em ins del......

五、HTML 快速参考

HTML基本文档

html"><html>
<head>
<title>Document name goes here</title>
</head>
<body>
Visible text goes here
</body>
</html>

文本元素

html"><p>This is a paragraph</p>
<br> (line break)
<hr> (horizontal rule)
<pre>This text is preformatted</pre>

逻辑样式

html"><em>This text is emphasized</em>
<strong>This text is strong</strong>
<code>This is some computer code</code>

物理样式

html"><b>This text is bold</b>
<i>This text is italic</i>

链接、锚定和图像元素

html"><a href="http://www.example.com/">This is a Link</a>
<a href="http://www.example.com/"><img src="URL"
alt="Alternate Text"></a>
<a href="mailto:webmaster@example.com">Send e-mail</a>A named anchor:
<a name="tips">Useful Tips Section</a>
<a href="#tips">Jump to the Useful Tips Section</a>

无序列表

html"><ul>
<li>First item</li>
<li>Next item</li>
</ul>

有序列表

html"><ol>
<li>First item</li>
<li>Next item</li>
</ol>

定义列表

html"><dl>
<dt>First term</dt>
<dd>Definition</dd>
<dt>Next term</dt>
<dd>Definition</dd>
</dl>

表格

html"><table border="1">
<tr>
  <th>someheader</th>
  <th>someheader</th>
</tr>
<tr>
  <td>sometext</td>
  <td>sometext</td>
</tr>
</table>

框架

html"><frameset cols="25%,75%">
  <frame src="page1.htm">
  <frame src="page2.htm">
</frameset>

表单

html"><form action="http://www.example.com/test.asp" method="post/get">
<input type="text" name="lastname"
value="Nixon" size="30" maxlength="50">
<input type="password">
<input type="checkbox" checked="checked">
<input type="radio" checked="checked">
<input type="submit">
<input type="reset">
<input type="hidden">
<select>
<option>Apples
<option selected>Bananas
<option>Cherries
</select>
<textarea name="Comment" rows="60"
cols="20"></textarea>
</form>

实体

html">&lt; is the same as <
&gt; is the same as >
&nbsp; is the same as ‘ ’
&#169; is the same as ©

其他元素

html"><!-- This is a comment -->
<blockquote>
Text quoted from some source.
</blockquote>
<address>
Address 1<br>
Address 2<br>
City<br>
</address>

结语
如果你觉得这篇博客还可以,别忘记点个赞加个关注再走哦。
如果你不嫌弃,还可以关注微信公众号———梦码城(持续更新中)
梦码在这里感激不敬


http://www.niftyadmin.cn/n/941763.html

相关文章

第八届蓝桥杯5-7题

E. 取数位 /* Description 求1个整数的第k位数字有很多种方法。 以下的方法就是一种。 Input 没有输入。 Output 见上文描述。 */ // 求x用10进制表示时的数位长度 //思路&#xff1a;对递归的掌握和使用理解 #include<stdio.h> int len(int x){if(x<10) return…

第九届蓝桥杯5-7题

E. 快速排序 /* Description 以下代码可以从数组a[]中找出第k小的元素。 它使用了类似快速排序中的分治算法&#xff0c;期望时间复杂度是O(N)的。 请仔细阅读分析源码&#xff0c;填写划线部分缺失的内容。 Input 见上文描述。 Output 注意&#xff1a;只填写划线部分缺少…

AcWing第七周周赛题解

A - 3758. 距离零点的时刻 题目 题目链接 已知当前时钟的显示时间为 小时 分&#xff08; 小时制时间格式&#xff09;&#xff0c;请问多少分钟后&#xff0c;时钟会第一次变为 时 分。 思路 代码 #include<stack> #include<cstdlib> #include<cstdio&g…

Python中flask_sqlalchemy的使用

flask_sqlalchemy的使用 from flask import Flask from flask_sqlalchemy import SQLAlchemyapp Flask(__name__) db SQLAlchemy(app) # 配置数据库地址 app.config[SQLALCHEMY_DATABASE_URI] mysql://mysql127.0.0.1/app.py # 跟踪数据库的更改&#xff0c;不建议开启&…

Java面向对象知识点总结(全)

1、封装 定义 封装就是把对象的属性&#xff08;状态&#xff09;和方法&#xff08;行为&#xff09;结合在一起&#xff0c;并尽可能隐蔽对象的内部细节&#xff0c;成为一个不可分割的独立单位&#xff08;即对象&#xff09;&#xff0c;对外形成一个边界&#xff0c;只保…

Codeforces 1447B - B. Numbers Box Acwing 3763.数字矩阵 每日一题7.12

题目 Codeforces链接Problem - 1447B - Codeforces AcWing链接3763. 数字矩阵 - AcWing题库 思路 如果一个n*m的矩阵里面有许多分散的负数&#xff0c;我们可以两两交换使得负数接近&#xff0c;那么我们就看是否有两个两个配对&#xff0c;也就是负数是奇数还是偶数&#xff…

Codeforces Round #731 (Div. 3) 总结

目录 比赛链接 A. Shortest Path with Obstacle 题意 思路 代码 B.Alphabetical Strings 题意 思路 代码 C. Pair Programming 题意 思路 代码 D. Co-growing Sequence 题意 思路 代码 E. Air Conditioners 题意 思路 代码 F. Array Stabilization (GCD …