html/css/javacript

HTML5 (elements&attributes )

The quickest way to create a html5 web :first you should print “!”,then you should press the key “tab”.

网站模板:
https://www.w3cschool.cn/html/html-template.html
(内容十分丰富请好好利用)

HTML文本框参考样式及常见操作技巧大全:
https://www.w3cschool.cn/html/html-textbox.html

HTML滚动条样式代码及使用技巧:
https://www.w3cschool.cn/html/html-scrollbar.html

HTML版权符号写法及美化:
https://www.w3cschool.cn/html/html-copyright.html

HTML元素嵌套嵌套错误可能引起的问题:
https://www.w3cschool.cn/html/html-cui11xk2.html

目前的模式是html+css+javascript,如何理解呢,就是html是网页的结构,CSS是网页的样式,javascript是行为。

html+css代码
文本设置
1、font-size: 字号大小 
2、font-style: 字体格式
3、font-weight: 字体粗细
4、颜色属性color: 文本颜色
注意使用网页安全色

超链接设置
text-decoration: 参数
参数取值范围: 
underline:为文字加下划线 
overline:为文字加上划线 
line-through:为文字加删除线 
blink:使文字闪烁 
none:不显示上述任何效果

背景
1、背景颜色
background-color: 设置背景色
2、背景图片
background-image: url(URL)
URL就是背景图片的存放路径,none表示无。
3、背景图片重复
background-repeat: 参数
参数取值范围 :
no-repeat:不重复平铺背景图片
repeat-x:使图片只在水平方向上平铺
repeat-y:使图片只在垂直方向上平铺
如果不指定背景图片重复属性,浏览器默认的是背景图片向水平和垂直两个方向平铺。
4、背景图片固定
background-attachment: 参数
背景图片固定控制背景图片是否随网页的滚动而滚动。如果不设置背景图片固定属性,浏览器默认背景图片随网页的滚动而滚动。为了避免过于花哨的背景图片在滚动时转移浏览者的注意力,一般都设为固定。
参数取值范围:
fixed:网页滚动时,背景图片相对于浏览器的窗口而言,固定不动
scroll:网页滚动时,背景图片相对于浏览器的窗口而言,一起滚动

区块
1、单词间距 
word-spacing: 单词间距 
2、字母间距 
letter-spacing: 字母间距
3、文本对齐
text-align: 参数
参数的取值:
left:左对齐
right:右对齐
center:居中对齐
justify:相对左右两端对齐
4、垂直对齐
vertical-align: 参数
top:顶对齐
bottom:底对齐
text-top:相对文本顶对齐
text-bottom:相对文本底对齐
baseline:基准线对齐
middle:中心对齐
sub:以下标的形式显示
super:以上标的形式显示
5、文本缩进
text-indent: 缩进距离
12px相当于一个文字距离
6、空格
white-space: 参数
参数取值范围: 
normal 默认,空白会被浏览器忽略
pre 保留空白
nowrap 文本不换行
7、显示样式 
display: 参数 
参数取值范围: 
block:块级元素,在对象前后都换行 
inline:在对象前后都不换行 
list-item:在对象前后都换行,增加了项目符号 
none:无显示
方框
1、height 高度
2、width 宽度
3、padding 内边距
4、margin 外边距
5、float(浮动):可以让块级元素在一行中排列,例如横向菜单。 
6、clear 清除浮动

边框
1、样式
border style 参数
边框样式的参数:
none:无边框 
dotted:边框为点线
dashed:边框为长短线
solid:边框为实线
double:边框为双线
2、宽度 border width 
3、颜色 border color

列表
list-style-type 列表样式
不同浏览器的列表符可能不相同,可能会影响到网页,所以网页中的列表大多都是由背景图片显示。
控制用户界面的样式

鼠标
cursor:鼠标形状参数 
CSS鼠标形状参数表: 
鼠标形状:CSS代码
style=“cursor:hand”      手形
style=“cursor:crosshair”   十字形
style=“cursor:text”      文本形
style=“cursor:wait”      沙漏形
style=“cursor:move”     十字箭头形:
style=“cursor:help”      问号形
style=“cursor:e-resize”    右箭头形
style=“cursor:n-resize”    上箭头形
style=“cursor:nw-resize”   左上箭头形
style=“cursor:w-resize”    左箭头形
style=“cursor:s-resize”    下箭头形 
style=“cursor:se-resize”   右下箭头形 
style=“cursor:sw-resize”   左下箭头形

HTML常用代码之:结构性定义
文件类型 (放在档案的开头与结尾)
文件主题 (必须放在「文头」区块内)
文头 (描述性资料,像是「主题」)
文体 (文件本体)
标题<H?></H?> (从1到6,有六层选择)
标题的对齐 <H?ALIGN=LEFT|CENTER|RIGHT></H?>
区分


区分的对齐 <DIVALIGN=LEFT|RIGHT|CENTER|JUSTIFY>
引文区块
(通常会内缩)
强调 (通常会以斜体显示)
特别强调 (通常会以加粗显示)
引文 (通常会以斜体显示)
(显示原始码之用)
样本
键盘输入
变数
定义 (有些浏览器不提供)
地址

大字
小字
与外观相关的标签(作者自订的表现方式)
加粗
斜体
底线 (尚有些浏览器不提供)
删除线 (尚有些浏览器不提供)
下标
上标
打字机体 (用单空格字型显示)
预定格式
 (保留文件中空格的大小) 

预定格式的宽度
(以字元计算) 

向中看齐
(文字与图片都可以)
闪耀 (有史以来最被嘲弄的标签)
字体大小 <FONTSIZE=?>(从1到7)
改变字体大小 <FONTSIZE=+|-?>
基本字体大小 <BASEFONTSIZE=?> (从1到7; 内定为3)
字体颜色 <FONTCOLOR="# " > < / F O N T > ( "></FONT>( "></FONT>为颜色代码)

HTML常用代码之:修改页面的实用性HTML代码
贴图:
加入连接:写上你想写的字
在新窗口打开连接:写上要写的字
移动字体(走马灯):写上你想写的字
字体加粗:写上你想写的字
字体斜体:写上你想写的字
字体下划线: 写上你想写的字
字体删除线: 写上你想写的字
字体加大: 写上你想写的字
字体控制大小:

写上你想写的字

(其中字体大小可从h1-h5,h1最大,h5最小)
更改字体颜色: 写上你想写的字(其中value值在000000与ffffff(16位进制)之间
消除连接的下划线: 写上你想写的字
贴音乐:
贴flash:
贴影视文件:
换行:

段落:

段落


原始文字样式:
正文

换帖子背景:
固定帖子背景不随滚动条滚动:
定制帖子背景颜色:(value值见10)
帖子背景音乐:<bgsound=“背景音乐地址” loop=infinite>
贴网页:<iframe. src=“相关地址” width=“宽度” height=“高度”>

HTML常用代码之:常常会遇到的问题

点击关闭窗口
点击关闭窗口!
请问如何去掉主页右面的滚动条?

如何做到让一个网页自动关闭. 这个窗口会在10秒过后自动关闭,而且不会出现提示.

如何在不刷新页面的情况下刷新css?

<button nclick=document.styleSheets[0].rules[0].style.color=‘‘‘‘red‘‘‘‘>点击按钮直接修改style标签里button选择符使按钮改为  红色
  
请问如何让网页自动刷新?
在head部记入<META. HTTP-EQUIV=“Refresh” c>其中20为20秒后自动刷新,你可以更改为任意值。
如何让页面自动刷新?
方法一,用refresh
HTML 代码片段如下:

HTML常用代码之:你不一定知道的技巧
 ncontextmenu=“window.event.returnValue=false” 将彻底屏蔽鼠标右键

no
可用于Table 取消选取、防止复制

onpaste=“return false” 不准粘贴

oncopy=“return false;” ncut=“return false;” 防止复制

<inputstyle=“ime-mode:disabled”> 关闭输入法

永远都会带着框架
<script. language=“JavaScript”>

防止被人frame.
<SCRIPT. LANGUAGE=JAVASCRIPT>

网页将不能被另存为
<iframe.src=*.html>

查看网页源代码
<input type=button value=查看网页源代码
onclick=“window.location = “view-source:”+“http://www.w3cschool.cn””>

删除时确认
<a href="javascript:if(confirm(“确实要删除吗?”))location=“boos.asp? &areyou=删除&page=1"”>删除

屏蔽功能键Shift,Alt,Ctrl

网页不会被缓存
<META. HTTP-EQUIV=“pragma” CONTENT=“no-cache”>
<META. HTTP-EQUIV="Cache-Control"CONTENT=“no-cache, must-revalidate”>
<META. HTTP-EQUIV="expires"CONTENT=“Wed, 26 Feb 1997 08:21:57 GMT”>
或者<META. HTTP-EQUIV="expires"CONTENT=“0”>

怎样让表单没有凹凸感?

不要滚动条?
让竖条没有:

   让横条没有: 两个都去掉?更简单了

怎样去掉图片链接点击后,图片周围的虚线?
<a href="#"nFocus=“this.blur()”><img src="logo.jpg"border=0>

电子邮件处理提交表单
<form. name="form1"method=“post” action="mailt****@***.com"enctype=“text/plain”>

在打开的子窗口刷新父窗口的代码里如何写?
window.opener.location.reload()

如何设定打开页面的大小

打开页面的位置

在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动

检查一段字符串是否全由数字组成
<script. language=“Javascript”>

获得一个窗口的大小
document.body.clientWidth; document.body.clientHeight

怎么判断是否是字符
if (/[^/x00-/xff]/g.test(s)) alert(“含有汉字”);
else alert(“全是字符”);

TEXTAREA自适应文字行数的多少
<textarea rows=1 name=s1 cols=27npropertychange=“this.style.posHeight=this.scrollHeight”>

日期减去天数等于第二个日期
<script. language=Javascript>
function cc(dd,dadd)
{
//可以加上错误处理
var a = new Date(dd)
a = a.valueOf()
a = a - dadd * 24 * 60 * 60 * 1000
a = new Date(a)
alert(a.getFullYear() + “年” + (a.getMonth() +1) + “月” + a.getDate() + “日”)
} cc(“12/23/2002”,2)

选择了哪一个Radio

脚本永不出错
<SCRIPT. LANGUAGE=“JavaScript”>

ENTER键可以让光标移到下一个输入框

1.contentEditable(user can edit the content in the web ):
For example:

Document
carzy Java
crazy java crazy html
crazy js crazy spring
fun java fun html
i love cat i love dog

相比平时的空格( ),nbsp拥有不间断(non-breaking)特性。即连续的nbsp会在同一行内显示。即使有100个连续的nbsp,浏览器也不会把它们拆成两行。

2.designMode(when use designMode ,se it as”on”the whole web page ’s elements which support contentEditable can all be edited):
For example:

carzy Java
crazy java crazy html
crazy js crazy spring
fun java fun html
i love cat i love dog

3.hidden(when hidden=true,the browser will not display it):
For example:
//the good of this code is use “target.hidden=!target.hidden” when we click one time of the button the content will show, when we click again, the content will hidden again.we can use this to create a list or navigator which can show when you need ,can hidden when you do not need it.//

crazy html
show /hidden

4.spellcheck(for <input…/><textarea…/> and so on, the browser can check the spell for you, notice which spell is wrong):
For example:

5.common elements:
<article…/>:a article
<section…/>:divided the web page

6.use

7.use

animal
cat dog

8.:
//below code :when we link cat, the browser will go to www.baidu.com/index.php

Document cat

9.<meta…/>://we can use “name”and”content” to find info just like we use “map” in java, or just like we create meta icon in the xml
@1.name and content:
For example:

crazy

@2.http-equiv://in the “http-equiv”just like “name and content above”,but in “http-equiv”should be a sure name which web can know it already,that means they should has special meaning.
For example:

crazy

10.draggable://when you press the mouse and not release it and you move the mouse, during the moving it will continue create a draggable event.
//in HTML5 the “<img…/>and <a…/>”is in default that it can be draggable.

draggable
crazy

11.//we use DataTransfer :
?.dataTransfer.setDragImage(element x,y):set the iconImage when you drag(“x”is the distance of icon and mouse’s horizontal,”y”is icon and mouse ’s vertical distance)
?.dataTransfer.addElement(element):add the icon define y yourself
?.dataTransfer.types:has dataTransfer’s all data’s type
?.dataTransfer.getData(format):get the data in the defined format
?.dataTransfer.setData(format, data):set the data use”format”’s format
?.dataTransfer.clearData([format]):delete the data in “format”,if we don’t write the “format”,we will delete all data in DataTransfer’s object.

//now we write a program which can use drag to add “collectionItem”
For example:

create a CollectionDir and a Garbagebin

add what you like into CollectionDir

java
python
linux

CollectionDir

garbagebin

?DataTransfer’s object’s “effectAllowed”is control the object which is “be drag”,so you can set “effectAllowed”in”ondragstart”.And ”dropEffect”is control the destination (the goal) object, so you can set”dropEffect”in “ondragover”
//“dropEffect” can only do what “effectAllowed” can do ,eg.”effectAllowed” can “move,copy”,then “dropEffect”can do”move” or”copy”or “move and copy”.
For example

"effectAllowed and dropEffect Test"
"drag me"
HTML5’s Form and formElement and their attributes //we use form to get user’s request, and send the request to remote server. //below is some attribute in @1.action:is used to sure where the form be post when you click the “ok”button, so you should write “address” in it.must be write. @2.method:you can choose”GET” or”POST” : ”GET”will be use when you type something in the browser to find web;”GET”will be use when you do not write it in the,or you write like”GET” can only post small data, which can not be bigger than 2kB,and the data you send will be add behind original URL ,so you can see it in the address place ,so it is not very safety. “POST” can send big data than “GET”,”POST”usually used in ,and the data will be put into “HTML HEADER”to sends we can see the data directly ,so it is more safety. @3.name:the form ’s unique name,suggest be similar with “id”. @4.target:where to open the new URL // can only send “GET” request.eg. when you click the link, system will send request to aa,jsp and parameter’s name is “name”,parameter’s value is “crazy.org”.

For example

form oneLineText
textCanNotEdit
password
hidden domain button welcome
ok
//can only has “onchange”eventAttribute,and it not has “value”,it should be used with “”,when you chose some option ,the option’s value will be given to theas it parameterValie. For example: select MENU
java c ruby

crazyJava crazyC crazyRuby crazyAndroid crazyLinux

lucy kate jack bob

OK

//when you set”multiple”or”size” the web will set the “”as a box of list, when you not set “multiple” or”size”the web will look it as a list which can be drag to choose something.

//if betweenthere is no text the ’s parameterValue will be the content which you print in.if between has content ,the parameterValue will be that For example: textarea simpleMultipleLineText

readonlyMultipleText
hi everyone ,i love html5
OK

Attributes:”formaction”:can let different button in the same “form” send the request to different “URL”,so they can do different things.
For example:
//in one web ’s one form has two button “register” and”login” the two different button obviously should do different things,go to different URL

formaction username
password
</form>

Attributes:”form” can let the formElements not in the same place in the web, but can send them to the same server when the form be send
For example:

form object description

Attributes:””autofocus:when an formElement has this attribute when you open this web ,this formElements will get the focus automatically, so in one web ,there can only has one form elements has this attributes.

//attributes:”placeholder”:
When use it ,it can show prompt in the oneLineText or ,multipleLineText
//you can see the prompt at the beginning, but when you start to type something into the text ,the prompt will be disappeared
For example:

placeholder username
password

Attributes:”list”:
//this is a very useful attribute ,this is a actually ComboBox,users can print information in it, and users can also choose from pull-down menu.
//NOTICE:the “list” must be used with ,the’s”id”must be same as “list ”’s attributeValue.
When you doubleClick the formElements which has”list” attribute ,it will display the pull-down menu.
For example:

placeholder please input the book you want to buy
java ruby

More ’s “type” to create different formElements:
For example:

placeholder color

date

time

datetime

datetime-local

month

week

e-mail

tel

URL

number

range

search

//you can use”output” to get the output
For example:

placeholder

FileList&&File
//“accept”:control which type of file to get
//“multiple”:let us can choose more than one file at a time
For example:

FileList and File browser the images

//use “FileReader”to get the content of the file
//“FileReader” has “on loadstar:when start to read will use this event”,”onprogress:when is reading cause this event”,”onload:read succeed will cause this event”,”onloadend:will be cause when finished read ,do not care succeed pr not”,”onerror:when read failure will cause this event”
For example:

FileList and File browser files



//use “onprogress”to see how many we have finished to read the file
//NOTICE:”FileReader ”is just a client’s javascriptObject,when we use “FileReader”to send file is just send the file which in our local disk to the browser’s memory ,can not send it to the server.if you need to send the clientFile to the remoteServer,we should use”POST”to send the file ,the remoteServer will parser the fileData,and save data on the server.
For example:

FileList and File browser files
rate of finished

//“checkValidity”:use this method to check. If correct return “true”,if wrong return “false”
For example:

checkValidity birthday
email-adress

//define error prompt by yourself
For example:

checkValidity bookName

//if you want to close checkValidity,you can:
@1.then the whole form will not be checked
@2.fororset attribute “formnovalidate=novalidate” then when we click this submit button and want to submit the form , the whole form will not be checked.
Draw on HTML5
//NOTICE:we useto draw ,but can only give us a empty picture, we actually use to get a CanvasRenderingContext2D object, and we then use javascript to draw pictures ,so <canvas…/>is just a picture container.
//we can define “canvas”’s width and height.
//when we want to draw, we should do as below:
@1.get<canvas…/>’s DOM object, this is a CanvasObject
@2.use CanvasObject’s “getContext()”method, it will return a CanvasRenderingContext2D object, this object can let us draw picture.
@3.use “CanvasRenderingContext2D”’s method to draw
For e

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值