|
工具版本兼容问题
css的语法
selector {property: value}
即 选择器{属性:值}
学习css即学些有哪些选择器,哪些属性以及可以使用什么样的值
示例
1
:
选择所有的p元素
示例
2
:
也可以直接在元素上增加style属性
");
window.frames["iframe_show448"].document.write(decodeHtml($("textarea#stepcodeTextarea448").val()));
window.frames["iframe_show448"].document.close();
$(window.frames["iframe_show448"]).load(function(){
$("#iframe_show448").height($("#iframe_show448").contents().find("body").height()+showittryitheight);
});
$("#iframe_show448").height($("#iframe_show448").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<style>
p{
color:red;
}
</style>
<p>这是一个P</p>
<p>这是一个P</p>
<p>这是一个P</p>
<p>这是一个P</p>
<style>
p{
color:red;
}
</style>
<p>这是一个P</p>
<p>这是一个P</p>
<p>这是一个P</p>
<p>这是一个P</p>
");
window.frames["iframe448"].document.write(decodeHtml(code448));
window.frames["iframe448"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe448"]).load(function(){
$("#iframe448").height($("#iframe448").contents().find("body").height()+showittryitheight);
});
$("#iframe448").height($("#iframe448").contents().find("body").height()+showittryitheight);
alreadyWriteCode448 = code448;
$("#rendering448").hide();
$("#rendered448").show();
}
var tRereshRetry2DemoPanel448 = setInterval(rereshRetry2DemoPanel448,1000);
var binded448 = false;
$("textarea#stepcodeTextarea448").keyup(function(){
if(!binded448){
$(window).bind('beforeunload',function(){
binded448 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code448 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code448!=newCode){
// window.frames["iframe448"].document.write("
");
// window.frames["iframe448"].document.write(decodeHtml($("textarea#stepcodeTextarea448").val()));
// window.frames["iframe448"].document.close();
// $(window.frames["iframe448"]).load(function(){
// $("#iframe448").height($("#iframe448").contents().find("body").height()+showittryitheight);
// });
// code448 = newCode;
// }
});
$(".tryButton448").click(function(){
$("#tryDiv448").show();
$("#stepcodeTextarea448").focus();
$("#stepcodeTextarea448").height(200);
$("#iframe448").height(0);
window.frames["iframe448"].document.write("
");
window.frames["iframe448"].document.write(decodeHtml($("textarea#stepcodeTextarea448").val()));
window.frames["iframe448"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe448"]).load(function(){
$("#iframe448").height($("#iframe448").contents().find("body").height()+showittryitheight);
});
$("#iframe448").height($("#iframe448").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor448.focus();
editor448.setSize(null, "250");
$("#rendering448").hide();
$("#rendered448").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 editor448 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea448"), {
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);
}
}
});
editor448.on("change",function(doc){
if(!binded448){
$(window).bind('beforeunload',function(){
binded448 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code448 = newCode;
$("textarea#stepcodeTextarea448").val(newCode);
if(alreadyWriteCode448!=code448){
lastModifedTime448 = new Date().getTime();
$("#rendering448").show();
$("#rendered448").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor448 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor448.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv448").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
示例
2
:
也可以直接在元素上增加style属性
顶
折
直接在某一个元素上增加style属性即可达到css一样的效果
");
window.frames["iframe_show495"].document.write(decodeHtml($("textarea#stepcodeTextarea495").val()));
window.frames["iframe_show495"].document.close();
$(window.frames["iframe_show495"]).load(function(){
$("#iframe_show495").height($("#iframe_show495").contents().find("body").height()+showittryitheight);
});
$("#iframe_show495").height($("#iframe_show495").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<p style="color:red">这是style为红色的</p>
<p>这是一个没有style的p</p>
<p style="color:red">这是style为红色的</p>
<p>这是一个没有style的p</p>
");
window.frames["iframe495"].document.write(decodeHtml(code495));
window.frames["iframe495"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe495"]).load(function(){
$("#iframe495").height($("#iframe495").contents().find("body").height()+showittryitheight);
});
$("#iframe495").height($("#iframe495").contents().find("body").height()+showittryitheight);
alreadyWriteCode495 = code495;
$("#rendering495").hide();
$("#rendered495").show();
}
var tRereshRetry2DemoPanel495 = setInterval(rereshRetry2DemoPanel495,1000);
var binded495 = false;
$("textarea#stepcodeTextarea495").keyup(function(){
if(!binded495){
$(window).bind('beforeunload',function(){
binded495 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code495 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code495!=newCode){
// window.frames["iframe495"].document.write("
");
// window.frames["iframe495"].document.write(decodeHtml($("textarea#stepcodeTextarea495").val()));
// window.frames["iframe495"].document.close();
// $(window.frames["iframe495"]).load(function(){
// $("#iframe495").height($("#iframe495").contents().find("body").height()+showittryitheight);
// });
// code495 = newCode;
// }
});
$(".tryButton495").click(function(){
$("#tryDiv495").show();
$("#stepcodeTextarea495").focus();
$("#stepcodeTextarea495").height(200);
$("#iframe495").height(0);
window.frames["iframe495"].document.write("
");
window.frames["iframe495"].document.write(decodeHtml($("textarea#stepcodeTextarea495").val()));
window.frames["iframe495"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe495"]).load(function(){
$("#iframe495").height($("#iframe495").contents().find("body").height()+showittryitheight);
});
$("#iframe495").height($("#iframe495").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor495.focus();
editor495.setSize(null, "250");
$("#rendering495").hide();
$("#rendered495").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 editor495 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea495"), {
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);
}
}
});
editor495.on("change",function(doc){
if(!binded495){
$(window).bind('beforeunload',function(){
binded495 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code495 = newCode;
$("textarea#stepcodeTextarea495").val(newCode);
if(alreadyWriteCode495!=code495){
lastModifedTime495 = new Date().getTime();
$("#rendering495").show();
$("#rendered495").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor495 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor495.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv495").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
代码高亮插件双击即可选中,不过部分同学反应,通过代码高亮插件复制的代码无法在IDEA里正常显示,这里提供TEXTAREA的方式,方便复制,谢谢
1. 自行完成练习
根据练习目标尽量自己实现代码效果,期间会碰到疑问,难题,和自己不懂的地方,这些都是必要的过程
2. 带着疑问查看答案
完成过程中,碰到无法解决的问题,带着疑问,查看答案,分析答案的解决思路
3. 查看答案讲解视频
依然有不明白的地方,点开视频讲解,带着疑问,听视频讲解有问题的部分
4. 再做一遍
理解后,再从头做一遍,把有疑问的地方都捋清楚
5. 总结
最后再总结一遍,总结思路,总结解决办法,以后遇到类似的问题,怎么处理
HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。
提问之前请登陆
|