分类 Html 下的文章

Html转义字符对照表

原始字符 entity 原始字符 entity
" " & &
' &#039; < &lt;
> &gt;   &nbsp;
¡ &iexcl; ¢ &cent;
£ &pound; ¤ &curren;
¥ &yen; ¦ &brvbar;
§ &sect; ¨ &uml;
© &copy; ª &ordf;
« &laquo; ¬ &not;
­ &shy; ® &reg;
¯ &macr; ° &deg;
± &plusmn; ² &sup2;
³ &sup3; ´ &acute;
µ &micro; &para;
· &middot; ¸ &cedil;
¹ &sup1; º &ordm;
» &raquo; ¼ &frac14;
½ &frac12; ¾ &frac34;
¿ &iquest; À &Agrave;
Á &Aacute; Â &Acirc;
à &Atilde; Ä &Auml;
Å &Aring; Æ &AElig;
Ç &Ccedil; È &Egrave;
É &Eacute; Ê &Ecirc;
Ë &Euml; Ì &Igrave;
Í &Iacute; Î &Icirc;
Ï &Iuml; Ð &ETH;
Ñ &Ntilde; Ò &Ograve;
Ó &Oacute; Ô &Ocirc;
Õ &Otilde; Ö &Ouml;
× &times; Ø &Oslash;
Ù &Ugrave; Ú &Uacute;
Û &Ucirc; Ü &Uuml;
Ý &Yacute; Þ &THORN;
ß &szlig; à &agrave;
á &aacute; â &acirc;
ã &atilde; ä &auml;
å &aring; æ &aelig;
ç &ccedil; è &egrave;
é &eacute; ê &ecirc;
ë &euml; ì &igrave;
í &iacute; î &icirc;
ï &iuml; ð &eth;
ñ &ntilde; ò &ograve;
ó &oacute; ô &ocirc;
õ &otilde; ö &ouml;
÷ &divide; ø &oslash;
ù &ugrave; ú &uacute;
û &ucirc; ü &uuml;
ý &yacute; þ &thorn;
ÿ &yuml; Œ &OElig;
œ &oelig; Š &Scaron;
š &scaron; Ÿ &Yuml;
ƒ &fnof; ˆ &circ;
˜ &tilde; Α &Alpha;
Β &Beta; Γ &Gamma;
Δ &Delta; Ε &Epsilon;
Ζ &Zeta; Η &Eta;
Θ &Theta; Ι &Iota;
Κ &Kappa; Λ &Lambda;
Μ &Mu; Ν &Nu;
Ξ &Xi; Ο &Omicron;
Π &Pi; Ρ &Rho;
Σ &Sigma; Τ &Tau;
Υ &Upsilon; Φ &Phi;
Χ &Chi; Ψ &Psi;
Ω &Omega; α &alpha;
β &beta; γ &gamma;
δ &delta; ε &epsilon;
ζ &zeta; η &eta;
θ &theta; ι &iota;
κ &kappa; λ &lambda;
μ &mu; ν &nu;
ξ &xi; ο &omicron;
π &pi; ρ &rho;
ς &sigmaf; σ &sigma;
τ &tau; υ &upsilon;
φ &phi; χ &chi;
ψ &psi; ω &omega;
ϑ &thetasym; ϒ &upsih;
ϖ &piv; &ensp;
&emsp; &thinsp;
&zwnj; &zwj;
&lrm; &rlm;
&ndash; &mdash;
&lsquo; &rsquo;
&sbquo; &ldquo;
&rdquo; &bdquo;
&dagger; &Dagger;
&bull; &hellip;
&permil; &prime;
&Prime; &lsaquo;
&rsaquo; &oline;
&frasl; &euro;
&image; &weierp;
&real; &trade;
&alefsym; &larr;
&uarr; &rarr;
&darr; &harr;
&crarr; &lArr;
&uArr; &rArr;
&dArr; &hArr;
&forall; &part;
&exist; &empty;
&nabla; &isin;
&notin; &ni;
&prod; &sum;
&minus; &lowast;
&radic; &prop;
&infin; &ang;
&and; &or;
&cap; &cup;
&int; &there4;
&sim; &cong;
&asymp; &ne;
&equiv; &le;
&ge; &sub;
&sup; &nsub;
&sube; &supe;
&oplus; &otimes;
&perp; &sdot;
&lceil; &rceil;
&lfloor; &rfloor;
&lang; &rang;
&loz; &spades;
&clubs; &hearts;
&diams;

使用HTML5的Placeholder属性给输入框增加背景文字提示效果

背景文字提示效果是输入框常用的功能,但大部分是使用JavaScript实现的:

value="请输入影片名称或主演名称..." onBlur="if(this.value=='') this.value='请输入影片名称或主演名称...';" onFocus="if(this.value=='请输入影片名称或主演名称...') this.value='';"

HTML5提供了新的实现方式,只需要在文本框的标记上添加placeholder属性,然后在属性值里输入你需要的提示信息即可。
语法:

<input placeholder=”提示信息...”>

示例:

<form>
<input type="text" placeholder="你的姓名..." name="lname">
<input type="password" placeholder="你的密码..." name="pass">
<input type="submit" value="提交">
</form>

用在评论框时,可能需要换行,但Placeholder默认不支持换行,这里以JS实现:

$(function() {
    var placeholder = '第一行文本提示\n第二行文本提示\n第三行文本提示';
    $('textarea').val(placeholder);
    $('textarea').css({"line-height":"20px","color":"#A9A9A9"});
    $('textarea').focus(function() {
        if ($(this).val() == placeholder) {
            $(this).val('');
        }
    });
    $('textarea').blur(function() {
        if ($(this).val() == '') {
            $(this).val(placeholder);
        }
    });
});

Html5 audio标签详解

audio标签的语法结构:

<audio src="音频地址">您的浏览器不支持audio标签</audio>

其中audio中间的文字可以去掉,加上这些文字是为了让一些不支持audio标签的浏览器进行识别.

audio标签的基本属性:
src(链接地址);
loop(设置是否循环播放);
autoplay(自动播放);
controls (提供给用户一个可以控制音频的控件);
preload(可以选择设置“none”,“metadata”,“auto”)

none:默认不加载,按需加载. metadata::元数据,默认不加载,但是可以提取该音频的元数据信息. auto:自动加载,如果不是动态载入的audio,该音频会随页面一起加载进来.

- 阅读剩余部分 -