例:
#content {
float: left
width: 500px
padding: 10px 15px
margin-left: 20px
display:inline
}
2.克服盒子模型的hack
原写法:
#main-div{
width: 150px
border: 5px
padding: 20px
}
修正后
#main-div1{
width: 150px
}
#main-div1 div{
border: 5px
padding: 20px
}
例如:
<div id="main-div">1</div>
<div id="main-div1"><div>2</div></div>见图:
两者区别:1是把padding加到父层里,DIV的宽度是150+20+20
2是把PADDING加到子层里,div的宽度是150.
我习惯是用1的方法去自己计算宽高.
3,4.最小高度(最小宽度)IE不识别的解决方法
.container {
width:20em
padding:0.5em
border:1px solid #000
min-height:8em
height:auto
}
* html .container {
height: 8em
}
5.整块元素居中对齐的方法
body{
text-align: center
}
#container
{
text-align: left
width: 960px
margin: 0 auto
}
先定义BODY中的文字整个居中text-align:center,再定义其中需要左对齐的子元素text-align:left
6.垂直居中的CSS
#wrapper {
width:530px
height:25px
background:url(container.gif) no-repeat left top
padding:0px 10px
}
#wrapper p {
line-height:25px
}
适用单行文字,将height设成line-height同值
Traceback (most recent call last):File "D:\Program Files (x86)\JetBrains\PyCharm Educational Edition 1.0.1\helpers\pydev\pydev_run_in_console.py", line 66, in <module>
globals = run_file(file, None, None)
File "D:\Program Files (x86)\JetBrains\PyCharm Educational Edition 1.0.1\helpers\pydev\pydev_run_in_console.py", line 28, in run_file
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:/python/xpth/xpathPractice.py", line 51, in <module>
results = pool.map(spider, page)
File "D:\anzhuang\Anaconda\lib\multiprocessing\pool.py", line 251, in map
return self.map_async(func, iterable, chunksize).get()
File "D:\anzhuang\Anaconda\lib\multiprocessing\pool.py", line 558, in get
raise self._value
IndexError: list index out of range123456789101112123456789101112
出现如上所示的错误:
IndexError 下标索引超出序列边界,比如当x只有三个元素,却试图访问x[5]