HTML:
css:
1.1css样式
1.id比class的优先级更高。
2.css规定的定位机制:标准文档流,浮动和绝对定位。
3.css样式分为:行内样式,内部样式和外部样式。(优先级遵循就近原则)
4.css的盒子模型的3D样式的先后顺序:border,content+padding,background-image,background-color,margin
1.2css的布局
1.如果要实现多列布局,每一个div块都需要设置float,而不是只设置左右两个。
2.特殊的多列布局的:
- 三列中左右两列使用固定的宽度。
- 中间列使用自适应宽度。
这个时候我们就不能使用float来解决问题了,如果用float是得不到三列在一行的效果。
我们需要把左右两列设置成position的绝对定位,中间列则设置成margin的左右边距为左右列的固定宽度。
下面是相关的代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <style type="text/css"> *{ margin:0px; padding:0px; } .main{ height: 100px; 100%; margin:0 auto; } .left{ height: 100px; 33.33%; position: absolute; top: 0px; left: 0px; background-color: gray; } .right{ height: 100px; 33.33%; position: absolute; top: 0px; right: 0px; background-color: black; } .middle{ height: 100px; 33.33%; margin:auto; background-color:red; } </style> </head> <body> <div class="main"> <div class="left"> </div> <div class="middle"> </div> <div class="right"> </div> </div> </body> </html>
js
1.HTML文本的修改语法:document.getElementId("").innerHTML="";
2.在js中要换行,需要在()内加<br/>而不是在外面
形如:
document.write("我叫"+mySun.name+"是"+mySun.age+"岁"+"<br/>");