HTML+CSS+JavaScript轻松学习

HTML部分讲义稿

html第1讲

<html>

<head>

<title>第一个网页</title>

</head>

<body>

<!-1-><font color=red>hello world</font>                       <!--使用<font color=red></font>来调整字体颜色-->

</br>

<!-2-><font size=7 color=blue>hello world1</font>               <!--使用<font size=7></font>来调整字体大小,但是size里面的取值是1—7-->

</br>

<!-3-><font style="font-size:150px" color=yellow>hello world2</font>   <!--使用CSS中<font style="font-size:40px"></font>将字体调整更大-->

</br>

<!-4-><p><font color=cyan>为字体更换颜色4</font></p>

<b> <font color="red">hhhhh</font></b>

<!-5->

</body>

</html>

html第2讲

Html的超链接:

例子:

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

</head>

<body>

<!--*****************html超链接案例***************-->

<!--*****************html超链接默认格式***************-->

<a href="http://www.sohu.com">超链接</a>           </br>               <!--超链接基本格式-->

<!--**target常见的两个属性-blank(表示在新页面打开文件).-self(表示替换当前页面)**-->

<a href="http://www.sohu.com"target= "-blank">在新窗口打开</a>     <!--超链接在新窗口下打开文件--></br>

<a href="http://www.sohu.com"target= "-self">在本页面打开</a>      <!--超链接在本页面打开文件--></br>

<a href="mailto:yanli457352797@hotmail.com">给自己写信</a>

</body>

</html>

Html图片元素标记):

<img src ="图片路径" width="宽度" height=高度” ></img>  

案例:(网页上显示图片)

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>无标题文档</title>

</head>

<body>

<!--*****************图片元素***************-->

<img src ="a.jpg" width="100" >                               <!--***********插入图片************-->  

<a href="http://www.sohu.com"><img src ="a.jpg" width="100" ></a> <!--***********图片链接************-->

<img src ="http://img.blog.163.com/photo/OqCsSUr6ytmOilpU0_1VaA==/4023121842125901437.jpg" width="400" >

<img src ="a.jpg" width="100" border="10" > </img>            <!--*******border表示为插入的图片加上边框********-->

</body>

</html>

Table表格:

<!--<table border=边框宽度 cellspacing两个列行间的距离大小 cellpadding各行列间的内容被填充" align="表格的位置" bgcolor="设置表格背景颜色"></table    <!--**tr表示行,td表示列,<tr align="设置字体对齐方式</tr>"***-->

案例:

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>无标题文档</title>

</head>

<body>

******************表格,为表格添加背景****************</br>

<!--<table border=”边框宽度 ”cellspacing”空隙大小” cellpadding”填充大小" align="表格的位置" bgcolor="设置表格背景颜色"></table>-->

<table border="15" height="1" cellpadding="20" cellspacing="0" width="477" align="center" bgcolor="cyan">

<tr align="center"><td >1</td><td>2</td><td>3</td></tr>                          <!--**tr表示行,td表示列,<tr align="设置字体对齐方式</tr>"***-->

</table>

</body>

</html>

html第3讲

合并单元格:

colspan=跨行列数

roespan=跨列行数

<head>

  <title> 表格</title>

  ***********菜谱***********

  <table border=1 bordercolor=red cellspacing=0 align="center"  width=500px cellpadding="0" height=180>

  <tr align=center><td colspan=3>周一菜谱</td>></tr>

  <tr align=center><td rowspan=2>素菜</td>><td>青菜</td>><td>土豆</td></tr>

  <tr align=center><td>豆腐</td>><td>白菜</td></tr>

  <tr align=center><td rowspan=2>荤菜</td>><td>肉丝</td>><td>大虾</td></tr>

  <tr align=center><td>海参<img src="a.jpg" width=70></img></td>><td>鲍鱼</td>></tr>

 </head>

 <body>

 </body>

</html>

注释:<tr align=center></tr>在此处表示字体的对齐方式

html第4讲

无序列表(html常用标记/元素-ui/li)

格式:      Html列表——无序列表

<ul type=属性值>

<li>列表内容</li>

</ul>

<ul>的属性设定(常用):

例如:<ul tyre=square>

Type=”squre”

设定符号款式,其值有三种,如下,默认为Typr=”disc”

Type=”disc”时的列项符号是实心圆点

Type=”circle”时的列项符号为空心圆

Type=”square”时的列项符号为空心正方形

************无序列表代码例子*********

<html>

<body>

<ul type="circle">

<li>1</li>

<li>1</li>

<li>1</li>

</ul>

</body>

</html>

Html列表——有序列表ol称顺序列表标记

<ol type=属性值 start=起始值>

<li>列表内容</li>

</ol>的属性设定常用):

例如:<ol type=”i” start=”4”></ol>

type=”i”

设定数目款式的值有5种:阿拉伯数字,a小写字母,A大写字母,i小写罗马数字,I大写罗马数字

************有序列表代码例子*********

<html>

<body>

<ol type="1">

<li>1</li>

<li>1</li>

<li>1</li>

</ol>

<ol type="1" start=”5”>

<li>1</li>

<li>1</li>

<li>1</li>

</ol>

</body>

</html>

Html框架标记元素)frameset/frame

<Frameset frameborder=边框大小 cols=按照列的百分比,隔开>rows= 按照行的百分比><Frame name=frame取名 src=html路径 noresize></frameset>

实例:

qq.html

<html>

<body bgcolor=blue>

歌词

</body>

</html>

ee.html

<html>

<body bgcolor=red>

费玉清

</body>

</html>

All.html

<html>

<frameset cols="20%,*" frameborder=100>

<frame src="qq.html" noresise name=”song” />

<frame src="ee.html" noresise name=”jun” / >

</frameset>

</html>

注释:all.html中不能带body标记

综合案例:

all.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

 <head>

  <title> New Document </title>  

 </head>

<frameset rows="30%,*" border="0">

<frame src="top.html"noresize/>

<frameset cols="20%,*">

<frame src="left.html" border=0 noresize/>

<!--frame元素中有一个属性,相当于给该frame取名-->

<frame src="right1.html"name="right"/>

</frameset>

</frameset>

</html>

top.html

<html>

 <head>

  <title> New Document </title>

 </head>

 <body >

  <img src="logo1.jpg" ></img>

 </body>

</html>

Left.html

<html>

 <head>

  <title> New Document </title>

 </head>

 <body bgcolor=pink>

  <a href="right1.html"target="right">青花瓷1</a></br>

  <a href="right2.html"target="right">青花瓷2</a></br>

 </body>

</html>

Right1.html

<html>

 <head>

  <title> New Document </title>

 </head>

 <body bgcolor=blue>

  <p>right1.html</p>

 </body>

</html>

Right2.html

<html>

 <head>

  <title> New Document </title>

 </head>

 <body bgcolor=yellow>

  <p>right2.html</p>

 </body>

</html>

html第5讲

html表单form:

介绍:html的表单元素,主要用于让客户输入数据,并提交给服务器

语法格式:<form action=url method=“提交方法(get,post)默认是get方法”>       

各种元素(输入框,下拉列表,文本域,密码框)

<input type=submit>

<input type=reset>

</form>

代码:

提交界面.html

<html>

 <head>

  <title> 登陆界面 </title>

 </head>

 <body>

 <h1>登陆界面</h1>

  <form action="ok.html" method="get" align=center>

  用户名:<input type="text" name="username"/></br>

  密  码:<input type="password" name="pwd"/></br>

  <input type="submit" value="登录"/>

  <input type="reset" value="重新填写"/>

  </form>

 </body>

</html>

Ok.html

<html>

 <head>

 </head>

 <body>

 ok

 </body>

</html>

表单中提供给用户的输入形式有<input  type=* name=**>

*=text文本框,  password密码框,  checkbox复选框 ,  radio单选框,  image图片按钮,  hidden , submit提交按钮,  reset重置按钮

name是你给表单元素取的名子

**=Symbolic  Name for CGI script

Action:指定把请求交给那个界面

 其他:

<html>

 <head>

  <title> New Document </title>

 </head>

 <body>

 1****************复选框*******************</br>

  <form action="" method="post" >

 <input type="checkbox" name="1"/>苹果<p>

  <input type="checkbox" name="1"/>香蕉<p>

 <p ><font color=red>*****************单选框******************</font></p></br>

  <input type="radio" name="1"/>苹果<p>

  <input type="radio" name="1" checked/>香蕉<p>

2******隐藏一个表单元素****用处是可提交数据,同时不影响界面**********</br>

  <input type="hidden" name="add" value="a.jpg">这里有一个隐藏的表单元素<p>

<p ><font*****************图片按钮******************</font></p></br>

   <input type="image" name="submit" src="a.jpg" width=30  align="top"/>苹果<p>

   *****************下拉列表******************</br>

   <select name="like">

   <option valu= select>--请选择--</option>

   <option valu=网游 select>网游</option>

   <option valu=足球 select>足球</option>

   <option valu=游泳 select>游泳</option>

   </select></br>

*******文本区**<!--cols表示行,rows表示列-->*******</br>  

<textarea name="comment" rows="4" cols="25">

请输入文本</textarea>

   </select></br>

************请选择要上传的文件*************</br>

   <input type="file" name="myfile">请选择文件

</br>

************按钮*************</br>

<input type="button" value="点击一下吧"/>

   </input>

  </form>

 </body>

</html>

DIV+CSS、javascript课程请参考正式课件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值