|
工具版本兼容问题
超链状态有4种
link - 初始状态,从未被访问过
visited - 已访问过
hover - 鼠标悬停于超链的上方
active - 鼠标左键点击下去,但是尚未弹起的时候
示例
1
:
超链状态
示例
2
:
去除超链的下划线
示例
3
:
练习-下拉菜单风格
示例
4
:
答案-下拉菜单风格
伪类,所谓的伪类即被选中的元素处于某种状态的时候
超链状态有4种
link - 初始状态,从未被访问过
visited - 已访问过
hover - 鼠标悬停于超链的上方
active - 鼠标左键点击下去,但是尚未弹起的时候
");
window.frames["iframe_show493"].document.write(decodeHtml($("textarea#stepcodeTextarea493").val()));
window.frames["iframe_show493"].document.close();
$(window.frames["iframe_show493"]).load(function(){
$("#iframe_show493").height($("#iframe_show493").contents().find("body").height()+showittryitheight);
});
$("#iframe_show493").height($("#iframe_show493").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<style>
a:link {color: #FF0000}
a:visited {color: #00FF00}
a:hover {color: #FF00FF}
a:active {color: #0000FF}
</style>
<a href="http://www.12306.com">超链的不同状态</a>
<style>
a:link {color: #FF0000}
a:visited {color: #00FF00}
a:hover {color: #FF00FF}
a:active {color: #0000FF}
</style>
<a href="http://www.12306.com">超链的不同状态</a>
");
window.frames["iframe493"].document.write(decodeHtml(code493));
window.frames["iframe493"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe493"]).load(function(){
$("#iframe493").height($("#iframe493").contents().find("body").height()+showittryitheight);
});
$("#iframe493").height($("#iframe493").contents().find("body").height()+showittryitheight);
alreadyWriteCode493 = code493;
$("#rendering493").hide();
$("#rendered493").show();
}
var tRereshRetry2DemoPanel493 = setInterval(rereshRetry2DemoPanel493,1000);
var binded493 = false;
$("textarea#stepcodeTextarea493").keyup(function(){
if(!binded493){
$(window).bind('beforeunload',function(){
binded493 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code493 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code493!=newCode){
// window.frames["iframe493"].document.write("
");
// window.frames["iframe493"].document.write(decodeHtml($("textarea#stepcodeTextarea493").val()));
// window.frames["iframe493"].document.close();
// $(window.frames["iframe493"]).load(function(){
// $("#iframe493").height($("#iframe493").contents().find("body").height()+showittryitheight);
// });
// code493 = newCode;
// }
});
$(".tryButton493").click(function(){
$("#tryDiv493").show();
$("#stepcodeTextarea493").focus();
$("#stepcodeTextarea493").height(200);
$("#iframe493").height(0);
window.frames["iframe493"].document.write("
");
window.frames["iframe493"].document.write(decodeHtml($("textarea#stepcodeTextarea493").val()));
window.frames["iframe493"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe493"]).load(function(){
$("#iframe493").height($("#iframe493").contents().find("body").height()+showittryitheight);
});
$("#iframe493").height($("#iframe493").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor493.focus();
editor493.setSize(null, "250");
$("#rendering493").hide();
$("#rendered493").hide();
});
var mixedMode = {
name: "htmlmixed",
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
mode: null},
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
var editor493 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea493"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
mode:"text/html",
theme:"eclipse",
selectionPointer: true,
lineWrapping: true,
extraKeys: {
"Alt-/": "autocomplete",
"Ctrl-F": "findPersistent",
"F8": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
editor493.on("change",function(doc){
if(!binded493){
$(window).bind('beforeunload',function(){
binded493 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code493 = newCode;
$("textarea#stepcodeTextarea493").val(newCode);
if(alreadyWriteCode493!=code493){
lastModifedTime493 = new Date().getTime();
$("#rendering493").show();
$("#rendered493").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor493 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor493.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv493").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
默认状态下,超链是有下划线的,但是现在网站上的超链普遍采用无下划线风格。 使用 text-decoration: none 文本修饰的样式来解决
");
window.frames["iframe_show2895"].document.write(decodeHtml($("textarea#stepcodeTextarea2895").val()));
window.frames["iframe_show2895"].document.close();
$(window.frames["iframe_show2895"]).load(function(){
$("#iframe_show2895").height($("#iframe_show2895").contents().find("body").height()+showittryitheight);
});
$("#iframe_show2895").height($("#iframe_show2895").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<style>
a.no_underline {text-decoration: none}
</style>
<a href="http://www.12306.com">默认的超链</a>
<br>
<a class="no_underline" href="http://www.12306.com">去除了下划线的超链</a>
<style>
a.no_underline {text-decoration: none}
</style>
<a href="http://www.12306.com">默认的超链</a>
<br>
<a class="no_underline" href="http://www.12306.com">去除了下划线的超链</a>
");
window.frames["iframe2895"].document.write(decodeHtml(code2895));
window.frames["iframe2895"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe2895"]).load(function(){
$("#iframe2895").height($("#iframe2895").contents().find("body").height()+showittryitheight);
});
$("#iframe2895").height($("#iframe2895").contents().find("body").height()+showittryitheight);
alreadyWriteCode2895 = code2895;
$("#rendering2895").hide();
$("#rendered2895").show();
}
var tRereshRetry2DemoPanel2895 = setInterval(rereshRetry2DemoPanel2895,1000);
var binded2895 = false;
$("textarea#stepcodeTextarea2895").keyup(function(){
if(!binded2895){
$(window).bind('beforeunload',function(){
binded2895 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code2895 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code2895!=newCode){
// window.frames["iframe2895"].document.write("
");
// window.frames["iframe2895"].document.write(decodeHtml($("textarea#stepcodeTextarea2895").val()));
// window.frames["iframe2895"].document.close();
// $(window.frames["iframe2895"]).load(function(){
// $("#iframe2895").height($("#iframe2895").contents().find("body").height()+showittryitheight);
// });
// code2895 = newCode;
// }
});
$(".tryButton2895").click(function(){
$("#tryDiv2895").show();
$("#stepcodeTextarea2895").focus();
$("#stepcodeTextarea2895").height(200);
$("#iframe2895").height(0);
window.frames["iframe2895"].document.write("
");
window.frames["iframe2895"].document.write(decodeHtml($("textarea#stepcodeTextarea2895").val()));
window.frames["iframe2895"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe2895"]).load(function(){
$("#iframe2895").height($("#iframe2895").contents().find("body").height()+showittryitheight);
});
$("#iframe2895").height($("#iframe2895").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor2895.focus();
editor2895.setSize(null, "250");
$("#rendering2895").hide();
$("#rendered2895").hide();
});
var mixedMode = {
name: "htmlmixed",
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
mode: null},
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
var editor2895 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea2895"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
mode:"text/html",
theme:"eclipse",
selectionPointer: true,
lineWrapping: true,
extraKeys: {
"Alt-/": "autocomplete",
"Ctrl-F": "findPersistent",
"F8": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
editor2895.on("change",function(doc){
if(!binded2895){
$(window).bind('beforeunload',function(){
binded2895 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code2895 = newCode;
$("textarea#stepcodeTextarea2895").val(newCode);
if(alreadyWriteCode2895!=code2895){
lastModifedTime2895 = new Date().getTime();
$("#rendering2895").show();
$("#rendered2895").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor2895 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor2895.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv2895").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
");
window.frames["iframe_show2960"].document.write(decodeHtml($("textarea#stepcodeTextarea2960").val()));
window.frames["iframe_show2960"].document.close();
$(window.frames["iframe_show2960"]).load(function(){
$("#iframe_show2960").height($("#iframe_show2960").contents().find("body").height()+showittryitheight);
});
$("#iframe_show2960").height($("#iframe_show2960").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<style>
a{
font-size:14px;
color: CornflowerBlue;
text-decoration: none;
}
div.menu {
width:80px;
border: 1px solid lightgray;
margin-top:15px;
position: absolute;
left: 80px;
top: 20px;
}
div.menu a{
display:block;
font-size:14px;
font-family:宋体;
color: #888;
text-decoration: none;
padding:10 0 10 15;
}
div.menu a:hover
{
background-color: #f1f1f1;
}
</style>
<a href="#nowhere"> 武器 </a>
<a href="#nowhere"> 护甲 </a>
<a href="#nowhere"> 英雄 </a>
<div class="menu">
<a href="#nowhere"> 盖伦 </a>
<a href="#nowhere"> 提莫 </a>
<a href="#nowhere"> 安妮 </a>
<a href="#nowhere"> 死哥 </a>
</div>
<div style="height:200px"></div>
<style>
a{
font-size:14px;
color: CornflowerBlue;
text-decoration: none;
}
div.menu {
width:80px;
border: 1px solid lightgray;
margin-top:15px;
position: absolute;
left: 80px;
top: 20px;
}
div.menu a{
display:block;
font-size:14px;
font-family:宋体;
color: #888;
text-decoration: none;
padding:10 0 10 15;
}
div.menu a:hover
{
background-color: #f1f1f1;
}
</style>
<a href="#nowhere"> 武器 </a>
<a href="#nowhere"> 护甲 </a>
<a href="#nowhere"> 英雄 </a>
<div class="menu">
<a href="#nowhere"> 盖伦 </a>
<a href="#nowhere"> 提莫 </a>
<a href="#nowhere"> 安妮 </a>
<a href="#nowhere"> 死哥 </a>
</div>
<div style="height:200px"></div>
");
window.frames["iframe2960"].document.write(decodeHtml(code2960));
window.frames["iframe2960"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe2960"]).load(function(){
$("#iframe2960").height($("#iframe2960").contents().find("body").height()+showittryitheight);
});
$("#iframe2960").height($("#iframe2960").contents().find("body").height()+showittryitheight);
alreadyWriteCode2960 = code2960;
$("#rendering2960").hide();
$("#rendered2960").show();
}
var tRereshRetry2DemoPanel2960 = setInterval(rereshRetry2DemoPanel2960,1000);
var binded2960 = false;
$("textarea#stepcodeTextarea2960").keyup(function(){
if(!binded2960){
$(window).bind('beforeunload',function(){
binded2960 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code2960 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code2960!=newCode){
// window.frames["iframe2960"].document.write("
");
// window.frames["iframe2960"].document.write(decodeHtml($("textarea#stepcodeTextarea2960").val()));
// window.frames["iframe2960"].document.close();
// $(window.frames["iframe2960"]).load(function(){
// $("#iframe2960").height($("#iframe2960").contents().find("body").height()+showittryitheight);
// });
// code2960 = newCode;
// }
});
$(".tryButton2960").click(function(){
$("#tryDiv2960").show();
$("#stepcodeTextarea2960").focus();
$("#stepcodeTextarea2960").height(200);
$("#iframe2960").height(0);
window.frames["iframe2960"].document.write("
");
window.frames["iframe2960"].document.write(decodeHtml($("textarea#stepcodeTextarea2960").val()));
window.frames["iframe2960"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe2960"]).load(function(){
$("#iframe2960").height($("#iframe2960").contents().find("body").height()+showittryitheight);
});
$("#iframe2960").height($("#iframe2960").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor2960.focus();
editor2960.setSize(null, "250");
$("#rendering2960").hide();
$("#rendered2960").hide();
});
var mixedMode = {
name: "htmlmixed",
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
mode: null},
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
var editor2960 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea2960"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
mode:"text/html",
theme:"eclipse",
selectionPointer: true,
lineWrapping: true,
extraKeys: {
"Alt-/": "autocomplete",
"Ctrl-F": "findPersistent",
"F8": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
editor2960.on("change",function(doc){
if(!binded2960){
$(window).bind('beforeunload',function(){
binded2960 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code2960 = newCode;
$("textarea#stepcodeTextarea2960").val(newCode);
if(alreadyWriteCode2960!=code2960){
lastModifedTime2960 = new Date().getTime();
$("#rendering2960").show();
$("#rendered2960").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor2960 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor2960.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv2960").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
请先登录
在查看答案前,尽量先自己完成,碰到问题再来查看答案,收获会更多
代码高亮插件双击即可选中,不过部分同学反应,通过代码高亮插件复制的代码无法在IDEA里正常显示,这里提供TEXTAREA的方式,方便复制,谢谢
1. 自行完成练习
根据练习目标尽量自己实现代码效果,期间会碰到疑问,难题,和自己不懂的地方,这些都是必要的过程
2. 带着疑问查看答案
完成过程中,碰到无法解决的问题,带着疑问,查看答案,分析答案的解决思路
3. 查看答案讲解视频
依然有不明白的地方,点开视频讲解,带着疑问,听视频讲解有问题的部分
4. 再做一遍
理解后,再从头做一遍,把有疑问的地方都捋清楚
5. 总结
最后再总结一遍,总结思路,总结解决办法,以后遇到类似的问题,怎么处理
HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。
提问之前请登陆
|