网页设计之HTML

本文详细介绍了HTML的基础结构,包括HTML文件结构、标签结构,以及常用的HTML标签,如标题、段落、换行、列表、超链接和图片等。此外,还探讨了超链接的定位功能和表格的创建。同时,文章还提到了表单元素,如单行文本框、密码框、单选按钮、复选框等,并展示了如何创建和使用这些表单组件。
摘要由CSDN通过智能技术生成

HTML

一.HTML结构

1.HTML文件结构

在这里插入图片描述

  • !DOCTYPE html
  • html根标签
  • head头标签
    • meta: 标签可提供有关页面的元信息
    • title:标题
  • body体标签,网页内容都在里面

<!-- 
html项目结构    
 -->
 
<!DOCTYPE html>       <!-- 声明html的版本 告诉浏览器html版本 去进行解析-->

<html>     <!-- 根标签  所有内容都必须写在根标签中,方便解析查询-->

	<head>     <!-- 头标签  写一些对网页的设置-->
	
		<meta charset="utf-8" />      <!-- 标签可提供有关页面的元信息(meta-information) 
		                                指定网页编码  还可以写一些关键字,作者名称..供搜索引擎搜索-->
		 <meta name=“keywords” content=“手机,家电"> 
		 <meta name="description" content="免费 Web & 编程 教程">
		 <meta name="author" content=“jim">
		 
		
		<link rel="icon" href="ico地址">     <!-- 给标题处添加图标 rel必须写不然网页显示不出来-->
		
		<title></title>    <!-- 标题-->
	</head>
	<body>      <!-- 网页体 网页内容都写在body中-->
		
	</body>
</html>

2.标签结构

  • 标签

HTML中的标记指的就是标签。

HTML使用标记标签来描述网页。

结构:

<标签名>标签内容</标签名> 闭合标签(有标签内容)

<标签名/> 自闭合标签 (无标签内容)

  • 标签属性:标签可以拥有属性。属性进一步说明了该标签的显示或使用 ,属性对标签的显示进行各种设置

    特性。如:

    1.属性的格式 :属性名 = “属性值“

    1. 属性的位置: 开始标签中 <标签名 属性名 = “属性值“ >xxx</标签名>

    2. 添加多个属性: <标签名 属性名 = “属性值“ 属性名 = “属性值“ >xxx </标签名>

二.常用标签

1.标签

标题标签

六级标签

段落标签

换行标签

列表 无序列表 有序列表

超链接 超链接有一个重要且我以前不知道的属性 精确定位看以下第二段代码

图片标签

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<!-- 标题标签  块级标签  占一行 -->
		<h1>一级标签</h1>
		<h2>二级标签</h2>
		<h3>三级标签</h3>
		
		<!-- 段落标签 段落与段落之间由距离 -->
		<p>2. 四指继续按主屏幕,向上滑动就会显示后台启动的程序
		(其实连按两下home键或者单只从屏幕下方往上拖效果也是一样的);
		</p>
		<p>2. 四指继续按主屏幕,向上滑动就会显示后台启动的程序
		(其实连按两下home键或者单只从屏幕下方往上拖效果也是一样的);
		</p>
		
		 <!-- 换行标签--><br><!-- 列表-->
		 <!-- 1.有序列表 -->
		 <ol type="I">   <!-- type 显示风格-->
		 	<li>知识预习</li>
		 	<li>知识学习</li>
		 	<li>知识回顾</li>
		 	<li>知识在回顾</li>
		 </ol>
		 
		 <!-- 2.无序列表 -->
		 <ul type="square">    <!-- type 显示风格-->
		 	<li>知识预习</li>
		 	<li>知识学习</li>
		 	<li>知识回顾</li>
		 	<li>知识在回顾</li>
		 </ul>
		 
		 <!-- 超链接-->
		 <a href="https://www.zhihu.com/" target="_blank">知乎内容</a>
		 <!-- href 资源位置   target 打开文件的方式 如_blank 在当前窗口打开-->
		 
		 
		 <!-- 图片标签 -->
		 
		 <img src="img/hao123.png" alt="hao123,上网从这里开始">
		 <!-- src 图片存放的地址  alt 图片不能显示显示的内容-->
		 
	</body>
</html>

在这里插入图片描述
超链接定位标签

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<a name="top"></a>
		
		<a href="#one">产品一</a>
		<a href="#two">产品二</a>
		<a href="#three">产品三</a>
		<a href="#four">产品四</a>
		<a href="#five">产品五</a>
		
		
		<h3><a name="one">产品一</a></h3>
		<img src="img/1.png" alt="">
		<h3><a name="two">产品二</a></h3>
		<img src="img/2.png" alt="">
	     <h3><a name="three">产品三</a></h3>
		<img src="img/3.png" alt="">
		<h3><a name="four">产品四 </a></h3>
		<img src="img/4.png" alt="">
		<h3><a name="four">产品五</a></h3>
		<img src="img/5.png" alt="">
		
		<a href="#top" style="position: fixed; right: 20px; bottom: 20px;" > 返回顶部</a>
	</body>
</html>

在这里插入图片描述

2.表格

表格的基本构成标签

table标签:表格标签

tr标签:表格中的行

th标签:表格的表头

td标签:表格单元格

在这里插入图片描述

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<table width="50%" border="1" cellpadding="0"
		 cellspacing="0" align="center" background="img/1.png" bgcolor="aquamarine" height="600">
			<tr>
				<th> 学号</th> <th>班级</th>  <th>姓名</th>
				</tr>
			<tr>
			<td>1</td>
			<td>1</td>
			<td>1</td>
			</tr>
			<tr>
			<td>2</td>
			<td>2</td>
			<td>2</td>
			</tr>
		</table>
	</body>
</html>

在这里插入图片描述

表格属性和表格结构
在这里插入图片描述

3.表单

form标签:表单

网页表单中有许多可以输入或选择的组件,用户可以在表单中填写信息,最终 提交表单,把客户端数据提交至服务器.

在这里插入图片描述

(1) 单行文本框
在这里插入图片描述

(2)密码框
在这里插入图片描述

(3)单选按钮
在这里插入图片描述

(4)复选框

在这里插入图片描述

注:
在这里插入图片描述

(5)文件选择框
在这里插入图片描述

(6)下拉框
在这里插入图片描述

(7)多行文本输入框
在这里插入图片描述

(8)按钮

三种按钮
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-GvzRZKR2-1633401227859)(C:\Users\封纪元\AppData\Roaming\Typora\typora-user-images\1625826328916.png)]

代码

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<!-- 
		input  输入框
			type="text"  文本框
			属性:
				id="" 值唯一 ,值自定义值   唯一标记是网页用来区分它的
				name="" 值自定义 向服务器
				value="" 输入的内容最终向服务器提交
				pleaceholder="请输入用户名" 提示信息不属于值
				readonly="readonly" 只读不能输入   如果里面有值可以向服务器发送
				disabled="disabled" 禁用 不能向服务器发送
				
				type="password"   密码框
				
				
				type="radio" 单选框   name相同为一组,互斥只能选中一个,选中的组件必须给value因为如果不定义
				value值这个组件没办法像服务器发值
				
		 -->
		
		
		
		<form action="" method="get">
			<label for="textid">用户名:</label>
			<input type="text" id="text1id" name="text1" placeholder="请输入内容" ><br>
			<label for="pwdid">密码:</label>
			<input type="password" name="pwd1" id="pwdid" placeholder="请输入密码"><br>
			
			性别:<input type="radio" name="radio1" id="radio1id" value="" />男
			<input type="radio" name="radio1" id="radio2id" value="女" / checked="checked">女<br>
			
			
			
			<!-- 复选框 -->
			请选择学习内容:<input type="checkbox" name="checkbox1" value="java"  checked="checked">java
			<input type="checkbox" name="checkbox1" value="html">html
			<input type="checkbox" name="checkbox1" value="css">css
			<input type="checkbox" name="checkbox1" value="xml">xml<br>
			
			<!-- 下拉框 -->
			请选择城市:<select name="sekect1">
				<option value="北京">北京</option>
				<option value="上海">上海</option>
				<option value="天津">天津</option>
				<option value="西安" selected="selected">西安</option>
			</select><br>
			
			附件:<input type="file"  accept=".jpg.png"> <br>
			
			备注:<textarea rows="30" cols="50" name="textarea1">
				
			</textarea>
			
			
			
			
			<input type="submit" id="submit1" name="" />
               <input type="reset" value="重置" />			
			   <input type="button" value="普通按钮" onclick="alert()">
			
		</form>
	</body>
</html>

结果
在这里插入图片描述

三.内联样式

内联框架可以在一个窗口内嵌入一个子窗口,从而在子窗口中引入一个外部的 页面

在这里插入图片描述

  • 0
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
css标签,网页模板/* Author: W3layout Author URL: http://w3layouts.com License: Creative Commons Attribution 3.0 Unported License URL: http://creativecommons.org/licenses/by/3.0/ */ /* reset */ html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,dl,dt,dd,ol,nav ul,nav li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;} article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;} ol,ul{list-style:none;margin:0;padding:0;} blockquote,q{quotes:none;} blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;} table{border-collapse:collapse;border-spacing:0;} /* start editing from here */ a{text-decoration:none;} .txt-rt{text-align:right;}/* text align right */ .txt-lt{text-align:left;}/* text align left */ .txt-center{text-align:center;}/* text align center */ .float-rt{float:right;}/* float right */ .float-lt{float:left;}/* float left */ .clear{clear:both;}/* clear float */ .pos-relative{position:relative;}/* Position Relative */ .pos-absolute{position:absolute;}/* Position Absolute */ .vertical-base{ vertical-align:baseline;}/* vertical align baseline */ .vertical-top{ vertical-align:top;}/* vertical align top */ .underline{ padding-bottom:5px; border-bottom: 1px solid #eee; margin:0 0 20px 0;}/* Add 5px bottom padding and a underline */ nav.vertical ul li{ display:block;}/* vertical menu */ nav.horizontal ul li{ display: inline-block;}/* horizontal menu */ img{max-width:100%;} /*end reset*/ body, html { font-size: 100%; height: 100%; } body { font-family:Arial, Helvetica, sans-serif; background:url(../images/bg2.jpg)no-repeat; background-color:#FFF; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover; background-attachment: fixed; background-position:100% center; } .wrap{ width:95%; margin:0 auto; } /***** Header ****/ .header{ border-top:5px solid #111; } .logo{ text-align:center; margin:10px 0; } .menu { text-align:center } .menu li a{ font-size:0.8em; padding:10px; display:block; color:#FFF; text-transform: uppercase; background-color:rgba(70, 70, 70, 0.47); border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 5px; } .menu li a:hover{ background:#222; } .bl-content{ background:rgba(0, 0, 0, 0.58); } .bl-main > section { display:inline-block; width:24%; } .bl-box { position: relative; width: 100%; height: 100%; cursor: pointer; } .bl-box h2 a{ font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; color:#FFF; text-align: center; margin: 0; padding:15px 0; width: 100%; font-size:0.8em; display: block; text-transform: uppercase; background-color:rgba(70, 70, 70, 0.45); } .bl-box h2:hover { background:#222; color:#FFF; } /* Custom content */ .works > ul { list-style: none; padding: 0; margin: 0; } .works > ul li { display: inline-block; width:48.5%; padding:0%; } .works > ul li a { display: block; padding: 0; border:3px solid #FFF; } .works > ul li a img { display: block; max-width: 100%; width:100%; } .works p{ font-size:0.8em; color:#FFF; line-height:1.6em; padding:5px 0; } /* Panel Items */ div.bl-panel-items, div.bl-panel-items > div { width: 100%; height: 100%; } div.bl-panel-items > div > div { margin: 0 auto; opacity: 1; padding:0 10px; } div.bl-panel-items > div > div h3 { font-size:1.2em; color:#000; margin: 0 0 5px 0; } div.bl-panel-items > div > div p { font-size:0.8em; color:#5A5A5C; line-height:1.6em; } div.bl-panel-items > div > div img { float:none; margin:20px 0px 5px 0; max-width: 100%; } div.bl-panel-items { top: 100%; z-index: 9999; } div.bl-panel-items > div { background:rgba(252, 252, 252, 0.760784); } /**** About ***/ .bl-content h2 { font-size:1.2em; color:#FFF; padding: 5px 0; margin-top:20px; text-transform:uppercase; } .about_img img{ padding:2px; background:#FFF; border:1px solid #DBDBDB; margin:5px 0; width:98%; } .about_data p{ font-size:0.9em; color:#FFF; line-height:1.6em; padding:5px 0; } .content_bottom_right { margin-top:80px; padding-bottom:20px; } .posts{ padding:10px 0 20px; border-bottom: 1px dashed #EEE; } .date{ float:left; width:40px; } .posts figure{ font-weight:bold; font-size:10px; color: #FFF; text-align:center; border-right:1px solid #EEE; padding:0 10px 2px 0; } .posts figure span{ font-size:3em; line-height: 52px; color:#F18D05; display:block; margin-bottom:-10px; letter-spacing:-1px; } .post_desc{ float:left; padding-left:4%; width:77%; } .post_desc p{ color:#FFF; font-size:0.9em; line-height:1.6em; } /***** Blog*****/ .image { clear: both; padding: 0px; margin: 0px; padding:10px 0; } .group:before, .group:after { content:""; display:table; } .group:after { clear:both; } .group { zoom:1; } .grid { display: block; float:none; margin: 0% 0 0% 0%; } .grid:first-child { margin-left: 0; } .images_3_of_1 { width:100%; position:relative; margin-bottom:10px; } .blog-leftgrids{ padding-top:10px; } .blog-desc{ width:100%; } .images_3_of_1 img { max-width:100%; display:block; padding:2px; background:#FFF; border:1px solid #FFF; width:98%; } .blog-desc h3{ padding-bottom:5px; } .blog-desc h3 a{ color:#FFF; font-size:0.9em; font-weight:bold; } .blog-desc p { color:#FFF; font-size:0.823em; line-height:1.6em; } /*** Buttons ****/ .button { float:right; font-size:0.9em; text-transform:uppercase; margin-top: 15px; display: inline-block; font-weight: bold; line-height: 18px; padding:8px 10px; background-color: #f18d05; border-color: #bf7004; color: white; } .button:hover { background-color: #f18d05; } .button:active { background: #d8891e; color: #8d5303; } /*----artical-links---*/ .artical-links{ padding: 10px 0px; border: 1px solid rgba(255, 255, 255, 0.19); border-left: none; margin-top: 5px; border-right: none; } .artical-links ul li{ display:inline-block; } .artical-links ul li img{ vertical-align:middle; padding-right:10px; } .artical-links ul li a{ font: 400 14px/22px Arial; color:#F18D05; padding-right: 20px; } .artical-links ul li a:hover{ color:#FFF; } /*** Page numbers ***/ .content-pagenation{ padding:35px 0; } .content-pagenation li { display: inline-block; } .content-pagenation li a { color:#F18D05; font-size: 0.8em; font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; background:#FFF; padding:8px 10px; } .content-pagenation li a:hover{ background:#F18D05; color:#FFF; } /* Contact Form ============================================================================= */ .section { clear: both; padding: 0px; margin: 0px; } .group:before, .group:after { content:""; display:table; } .group:after { clear:both; } .group { zoom:1; } .col{ display: block; float:left; margin: 2% 0 2% 0%; } .col:first-child{ margin-left:0; } .span_2_of_3 { width:100%; padding:0%; } .span_1_of_3 { width:100%; padding:0%; margin-top:10px; } .span_2_of_3 h3, .span_1_of_3 h3 { color:#FFF; font-size:1.5em; margin-bottom:10px; } .contact-form{ position:relative; padding-top:15px; } .contact-form div{ padding:5px 0; } .contact-form span{ display:block; font-size:0.9em; color:#F18D05; padding-bottom:5px; font-family :verdana, arial, helvetica, helve, sans-serif; } .contact-form input[type="text"],.contact-form textarea{ padding:6px; display:block; width:94%; background: rgba(252, 252, 252, 0); border:1px solid rgba(255, 255, 255, 0.38); outline:none; font-size:1.2em; font-family:Arial, Helvetica, sans-serif; color:#FFF; -webkit-appearance:none; } .contact-form textarea{ resize:none; height:120px; } .myButton { text-transform:uppercase; display: inline-block; font-weight: bold; line-height:18px; border:none; background: #465467; color: #fff; font-size:1em; padding:8px 12px; background-color: #f18d05; border-color: #bf7004; cursor:pointer; } .myButton:hover { background-color: #f18d05; } .myButton:active { background: #d8891e; color: #8d5303; } .company_address p{ color:#FFF; font-size:0.9em; line-height:1.8em; } .company_address p span{ text-decoration:underline; color:#EEE; cursor:pointer; } .contact_info{ padding-top:30px; } .map{ border:1px solid #CCC; margin-bottom:10px; } .copy_right{ padding:25px 0 10px 0; text-align:center; font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; } .copy_right p{ font-size:0.8123em; color: #FFF; line-height:1.8em; } .copy_right p a{ color: #FFF; font-size:1em; text-decoration:underline; } .copy_right p a:hover{ color:#FD9200; text-decoration:none; }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值