|
工具版本兼容问题
元素内边距
指的是元素里的内容与边框之间的距离
属性:
padding-left: 左内边距
padding-right: 右内边距
padding-top: 上内边距
padding-bottom: 下内边距
padding: 上 右 下 左
示例
1
:
左内边距
示例
2
:
内边距,写1个和写4个的区别
示例
3
:
当内边距的值少于4个的时候
属性:padding-left
值:数字
指的是,元素中的内容,与边框之间的距离
");
window.frames["iframe_show479"].document.write(decodeHtml($("textarea#stepcodeTextarea479").val()));
window.frames["iframe_show479"].document.close();
$(window.frames["iframe_show479"]).load(function(){
$("#iframe_show479").height($("#iframe_show479").contents().find("body").height()+showittryitheight);
});
$("#iframe_show479").height($("#iframe_show479").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<style>
.red{
border:5px solid red;
background-color:green;
}
.pad-left{
border:5px solid red;
background-color:green;
padding-left:50px;
}
</style>
<span class="red"> 无内边距的span </span><br/> <br/>
<span class="pad-left"> 左边距为50的span </span><br/>
<style>
.red{
border:5px solid red;
background-color:green;
}
.pad-left{
border:5px solid red;
background-color:green;
padding-left:50px;
}
</style>
<span class="red"> 无内边距的span </span><br/> <br/>
<span class="pad-left"> 左边距为50的span </span><br/>
");
window.frames["iframe479"].document.write(decodeHtml(code479));
window.frames["iframe479"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe479"]).load(function(){
$("#iframe479").height($("#iframe479").contents().find("body").height()+showittryitheight);
});
$("#iframe479").height($("#iframe479").contents().find("body").height()+showittryitheight);
alreadyWriteCode479 = code479;
$("#rendering479").hide();
$("#rendered479").show();
}
var tRereshRetry2DemoPanel479 = setInterval(rereshRetry2DemoPanel479,1000);
var binded479 = false;
$("textarea#stepcodeTextarea479").keyup(function(){
if(!binded479){
$(window).bind('beforeunload',function(){
binded479 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code479 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code479!=newCode){
// window.frames["iframe479"].document.write("
");
// window.frames["iframe479"].document.write(decodeHtml($("textarea#stepcodeTextarea479").val()));
// window.frames["iframe479"].document.close();
// $(window.frames["iframe479"]).load(function(){
// $("#iframe479").height($("#iframe479").contents().find("body").height()+showittryitheight);
// });
// code479 = newCode;
// }
});
$(".tryButton479").click(function(){
$("#tryDiv479").show();
$("#stepcodeTextarea479").focus();
$("#stepcodeTextarea479").height(200);
$("#iframe479").height(0);
window.frames["iframe479"].document.write("
");
window.frames["iframe479"].document.write(decodeHtml($("textarea#stepcodeTextarea479").val()));
window.frames["iframe479"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe479"]).load(function(){
$("#iframe479").height($("#iframe479").contents().find("body").height()+showittryitheight);
});
$("#iframe479").height($("#iframe479").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor479.focus();
editor479.setSize(null, "250");
$("#rendering479").hide();
$("#rendered479").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 editor479 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea479"), {
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);
}
}
});
editor479.on("change",function(doc){
if(!binded479){
$(window).bind('beforeunload',function(){
binded479 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code479 = newCode;
$("textarea#stepcodeTextarea479").val(newCode);
if(alreadyWriteCode479!=code479){
lastModifedTime479 = new Date().getTime();
$("#rendering479").show();
$("#rendered479").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor479 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor479.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv479").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
示例
2
:
内边距,写1个和写4个的区别
顶
折
属性:padding 值:如果只写一个,即四个方向的值 值:如果写四个,即四个方向的值 上 右 下 左,依顺时针的方向依次赋值
");
window.frames["iframe_show480"].document.write(decodeHtml($("textarea#stepcodeTextarea480").val()));
window.frames["iframe_show480"].document.close();
$(window.frames["iframe_show480"]).load(function(){
$("#iframe_show480").height($("#iframe_show480").contents().find("body").height()+showittryitheight);
});
$("#iframe_show480").height($("#iframe_show480").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<style>
.pad-left-one{
border:5px solid red;
background-color:green;
padding: 20;
}
.pad-left-four{
border:5px solid red;
background-color:green;
padding: 10 20 30 40;
}
</style>
<br/>
<span class="pad-left-one"> padding:20的span </span> <br/> <br/> <br/> <br/>
<span class="pad-left-four">
padding: 10 20 30 40 的span </span> <br/> <br/> <br/> <br/>
<style>
.pad-left-one{
border:5px solid red;
background-color:green;
padding: 20;
}
.pad-left-four{
border:5px solid red;
background-color:green;
padding: 10 20 30 40;
}
</style>
<br/>
<span class="pad-left-one"> padding:20的span </span> <br/> <br/> <br/> <br/>
<span class="pad-left-four">
padding: 10 20 30 40 的span </span> <br/> <br/> <br/> <br/>
");
window.frames["iframe480"].document.write(decodeHtml(code480));
window.frames["iframe480"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe480"]).load(function(){
$("#iframe480").height($("#iframe480").contents().find("body").height()+showittryitheight);
});
$("#iframe480").height($("#iframe480").contents().find("body").height()+showittryitheight);
alreadyWriteCode480 = code480;
$("#rendering480").hide();
$("#rendered480").show();
}
var tRereshRetry2DemoPanel480 = setInterval(rereshRetry2DemoPanel480,1000);
var binded480 = false;
$("textarea#stepcodeTextarea480").keyup(function(){
if(!binded480){
$(window).bind('beforeunload',function(){
binded480 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code480 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code480!=newCode){
// window.frames["iframe480"].document.write("
");
// window.frames["iframe480"].document.write(decodeHtml($("textarea#stepcodeTextarea480").val()));
// window.frames["iframe480"].document.close();
// $(window.frames["iframe480"]).load(function(){
// $("#iframe480").height($("#iframe480").contents().find("body").height()+showittryitheight);
// });
// code480 = newCode;
// }
});
$(".tryButton480").click(function(){
$("#tryDiv480").show();
$("#stepcodeTextarea480").focus();
$("#stepcodeTextarea480").height(200);
$("#iframe480").height(0);
window.frames["iframe480"].document.write("
");
window.frames["iframe480"].document.write(decodeHtml($("textarea#stepcodeTextarea480").val()));
window.frames["iframe480"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe480"]).load(function(){
$("#iframe480").height($("#iframe480").contents().find("body").height()+showittryitheight);
});
$("#iframe480").height($("#iframe480").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor480.focus();
editor480.setSize(null, "250");
$("#rendering480").hide();
$("#rendered480").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 editor480 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea480"), {
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);
}
}
});
editor480.on("change",function(doc){
if(!binded480){
$(window).bind('beforeunload',function(){
binded480 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code480 = newCode;
$("textarea#stepcodeTextarea480").val(newCode);
if(alreadyWriteCode480!=code480){
lastModifedTime480 = new Date().getTime();
$("#rendering480").show();
$("#rendered480").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor480 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor480.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv480").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
如果缺少左内边距的值,则使用右内边距的值。 如果缺少下内边距的值,则使用上内边距的值。 如果缺少右内边距的值,则使用上内边距的值。 举例说明 这是完整4个的 padding: 10 20 40 80 如果只有3个 padding: 10 20 40 那么left取right padding: 10 20 40 = padding: 10 20 40 20 如果只有两个 padding: 10 20 那么bottom取top,left取right padding: 10 20 = padding:10 20 10 20 如果只有一个 padding:10 那么right取top,bottom取top,left取top padding:10 = padding:10 10 10 10
代码高亮插件双击即可选中,不过部分同学反应,通过代码高亮插件复制的代码无法在IDEA里正常显示,这里提供TEXTAREA的方式,方便复制,谢谢
1. 自行完成练习
根据练习目标尽量自己实现代码效果,期间会碰到疑问,难题,和自己不懂的地方,这些都是必要的过程
2. 带着疑问查看答案
完成过程中,碰到无法解决的问题,带着疑问,查看答案,分析答案的解决思路
3. 查看答案讲解视频
依然有不明白的地方,点开视频讲解,带着疑问,听视频讲解有问题的部分
4. 再做一遍
理解后,再从头做一遍,把有疑问的地方都捋清楚
5. 总结
最后再总结一遍,总结思路,总结解决办法,以后遇到类似的问题,怎么处理
HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。
提问之前请登陆
|