任务一:使用富文本编辑器
首先,在开源富文本编辑器(https://summernote.org/)中随便输入一段文本。
然后,在源码模式下,查看内容是如何被转变为带标签的文本的,都带了哪些HTML标签。
最后,实现编辑器没有的功能,例如让表格隔行换色,加入JavaScript按钮,试着完成它。
任务二:“所见即所得”式开发
在code.org上一“所见即所得(WYSIWYG)”的方式完成HTML和CSS系列网页开发任务(https://studio.code.org/s/csd2-2019)
如果已注册账号则无需再注册。
加深对HTML和CSS技术的理解。
拓展:CSS盒子模型
深入理解CSS盒子模型多层次含义
边框边距
标准文档流(浮动与定位)
布局模式
完成下图的CSS盒子模型布局
自测:
- HTML5为了使img元素可拖放,需要增加什么属性?
- HTML5哪一个input类型可以选择一个无时区的日期选择器?
- CSS盒子模型中的Margin、Border、Padding都是什么意思?
- 说出至少五种常见HTML事件
- HTML的onblur和onfocus是哪种类型的属性?
- 怎么设置display属性的值使容器成为弹性容器?
- JavaScript中有多少中不同类型的循环?
- 用户搜索某个单词后,JavaScript高亮显示搜索到的单词,使用哪个语义化标签最合适?
分割线开始任务
任务一:
如图所示:表格隔行换色,js按钮效果如下。

代码如下:
<p align="center">北上广天气预报</p>
<table border="5" width="500px" bgcolor="skyblue" cellspacing="0" cellpadding="20px" align="center" frame="void">
<caption>标题:3月平均气温</caption>
<thead>
<tr align="center" valign="center" bgcolor="steelblue">
<th height="40"><span align="center" valign="center">城市</span></th> <!-- 加粗和居中 -->
<td align="center">北京</td>
<td align="center">上海</td>
<td align="center">广州</td>
</tr>
</thead>
<tbody>
<tr align="center">
<td>温度</td>
<td>26℃</td>
<td>25℃</td>
<td>30℃</td>
</tr>
<tr align="center" bgcolor="steelblue">
<td>紫外线</td>
<td>弱</td>
<td>弱</td>
<td>强</td>
</tr>
<tr align="center">
<td>天气</td>
<td>多云</td>
<td>多云</td>
<td>晴天</td>
</tr>
</tbody>
<tfoot>
<tr align="center" bgcolor="steelblue">
<td>风力</td>
<td>3级</td>
<td>4级</td>
<td>1级</td>
</tr>
</tfoot>
</table> <p></p><p><br></p>
<button border="1" cellpadding="1" onclick="alert('开始考试')">我要考试</button>
任务二:“所见即所得”式开发
https://studio.code.org/s/csd2-2019


拓展任务:CSS盒子模型
深入理解CSS盒子模型多层次含义
边框边距
标准文档流(浮动与定位)
布局模式
完成下图的CSS盒子模型布局

代码如下:
采用table的方式布局(主体部分如下:table123456)
<!DOCTYPE html>
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
}
table{width: 100%;height: 100%;}
.table0{
border: solid;
border-width: 5px;
border-color: #838383;
background-color:#dfdf6f ;
max-width: 500px;
max-height: 400px;
}
.table1{
width: 100%;
border-style: none;
line-height: 80px;
border-spacing: 10px 10px;
}
.table2{
width: 100%;
border-style: none;
border-spacing: 0px 10px;
padding-right: 10px;
}
#block1{
background-color: #81ec8d;
height: 100%;
text-align: center;
}
#block2{
background-color: #81ec8d;
height: 200px;
text-align: center;
}
#block3{
background-color: #81ec8d;
height: 150px;
text-align: center;
}
#block4{
background-color: #81ec8d;
height: 150px;
text-align: center;
}
</style>
</head>
<body>
<table class="table0">
<tr>
<td>
<table class="table1">
<tr id="block1"><td>1</td></tr>
<tr id="block2"><td>2</td></tr>
</table>
</td>
<td>
<table class="table2">
<tr id="block3"><td>3</td></tr>
<tr>
<td>
<table >
<tr>
<td id="block4">4</td>
<td>
<table >
<tr><td>5</td></tr>
<tr><td>6</td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
采用table的方式布局
继续完善block789
<!DOCTYPE html>
<html>
<head>
<style>
* {
margin: 0px;
padding: 0px;
}
#block9{
background-color: #ffaa7f;
position: absolute;
width:35px;
padding: 30px;
text-align: center;
left: 120px;
top: 340px;
}
table{width: 100%;height: 100%;}
.table0{
border: solid;
border-width: 5px;
border-color: #838383;
background-color:#dfdf6f ;
max-width:600px;
box-sizing: border-box;
}
.table1{
width: 100%;
border-style: none;
line-height: 100px;
border-spacing: 10px 10px;
}
.table2{
width: 100%;
border-style: none;
border-spacing: 0px 10px;
padding-right: 10px;
}
#block1{
background-color: #81ec8d;
height: 100px;
text-align: center;
}
#block2{
background-color: #81ec8d;
height: 190px;
text-align: center;
}
#block3{
box-sizing: border-box;
background-color: #81ec8d;
height: 180px;
text-align: center;
}
#block4{
background-color: #81ec8d;
height: 100px;
text-align: center;
position: relative;
z-index:10000;
}
#block5{
background-color: #81ec8d;
text-align: center;
height: 80px;
}
#block6{
background-color: #81ec8d;
text-align: center;
height: 80px;
}
.table4{
padding-left: 10px;
border-spacing: 0px 10px;
margin-top: -10px;
margin-bottom: -10px;
}
#block7{
background-color: #ffaa7f;
position: relative;
margin-left: 10px;
width: 30px;
padding: 40px;
}
#block_3{
position: relative;
text-align: center;
top: -60px;
}
#block8{
margin: -20px;
background-color: #ffaa7f;
position: absolute;
width:15px;
padding: 50px;
height: 10px;
box-sizing: border-box;
left: 400px;
top: -20px;
text-align: center;
}
</style>
</head>
<body>
<div >
<table class="table0">
<tr>
<td>
<table class="table1">
<tr id="block1"><td>1</td></tr>
<tr id="block2"><td>2</td></tr>
</table>
</td>
<td>
<table class="table2">
<tr id="block3"><td><div id="block7">7</div><div id="block_3" >
3
</div><div id="block8">8</div></td></tr>
<tr>
<td>
<table class="table3">
<tr>
<td id="block4" >4 </td>
<td>
<table class="table4">
<tr id="block5" ><td>5</td></tr>
<tr id="block6"><td>6</td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="block9">
9
</div>
</body>
</html>
自测:
1.HTML5为了使img元素可拖放,需要增加什么属性?
答:<img draggable="true">
2.HTML5哪一个input类型可以选择一个无时区的日期选择器?
答: <input type="date">
3.CSS盒子模型中的margin,border,padding都是什么意思?
答:外边距(margin)、边框(border)、内边距(padding)
4.说出5种常见的HTML事件
答:Window 事件属性,表单事件,键盘事件,鼠标事件,媒介事件
5.HTML的onblur和onfocus是哪种类型的属性?
答:onblur失去焦点事件 onfocus 获得焦点事件
6.怎么设置display属性值使容器成为弹性容器?
答:flex
7.Javascript种有多少种不同类型的循环?
答:for循环;do..while循环;while循环
8.用户搜索某个单词后,JavaScript高亮显示搜索到的单词,使用哪个语义化标签最适合?
答:<mark>
本文介绍了如何使用开源富文本编辑器Summernote,并展示了如何将文本转换为HTML标签。同时,通过实例演示了如何实现表格隔行换色和JavaScript按钮功能。接着,以WYSIWYG方式在code.org上进行HTML和CSS的网页开发任务,深化了对这两种技术的理解。此外,详细探讨了CSS盒子模型,包括边距、边框和内边距,以及浮动和定位的概念。最后,给出了一个CSS盒子模型布局的实现,并提供了HTML5和CSS的相关技术问题供读者自测。
9万+

被折叠的 条评论
为什么被折叠?



