符:利用表格属性做漂亮的代码边框。 一些新手看到别人做出漂亮的帖子边框都很好奇是怎么做成的,说穿了也就是巧妙的应用了表格的相关属性。这里我就统计几种常见的表格使用方法,可能大家也有更多更好的想法,也就起个抛砖引玉的作用吧。
例1:
说明:看起来好像是用了四层表格,其实只用了两层,同一个背景图。主要是边框向光和背光部分的颜色应用起到的效果。
源代码:
<table align="center" border="1" cellpadding="8" cellspacing="10" width="500" background="http://cry.shidabbs.com/home/bbsjc/images/jcbj01.jpg" bordercolorlight="#0C091D" bordercolordark="#C0B4FE"><tr><td width="100%" align="center"><table align="center" border="1" cellpadding="4" cellspacing="6" width="100%" background="http://cry.shidabbs.com/home/bbsjc/images/jcbj01.jpg" bordercolorlight="#0C091D" bordercolordark="#C0B4FE"><tr><td width="100%" align="center">
<br><br><img border="0" src="http://cry.shidabbs.com/home/bbsjc/images/jchanxing.jpg">
<br><br></td></tr></table></td></tr></table>
例2:
说明:这种效果其实有好几种方法做出来,但是在我认为这种是最简单的,只是金色背景那层(第二层)表格的宽是100%其它属性值一律为0。主要是在第三层,第三层的宽width的取值要是99%,而第三层的td里的width属性要是100%。
源代码:
<table align="center" border="0" cellpadding="0" cellspacing="10" width="500" background="http://cry.shidabbs.com/home/bbsjc/images/jcbj01.jpg"><tr><td width="100%" align="center"><table lign="center" border="0" cellpadding="0" cellspacing="0" width="100%" background="http://cry.shidabbs.com/home/bbsjc/images/jcbj02.jpg"><tr><td width="100%" align="center"><table align="center" border="0" cellpadding="0" cellspacing="0" width="99%" background="http://cry.shidabbs.com/home/bbsjc/images/jcbj01.jpg"><tr><td width="100%" align="center">
<br><br><img border="0" src="http://cry.shidabbs.com/home/bbsjc/images/jchanxing.jpg">
<br><br></td></tr></table></td></tr></table></td></tr></table>
例3:
说明:这个好像没什么特别的,就是把四个角上的框架图用表格分开。
源代码:
<br><table align="center" border="0" cellpadding="0" cellspacing="0" width="500" background="http://cry.shidabbs.com/home/bbsjc/images/jcbj01.jpg"><tr><td width="100%" align="center"><TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0><TBODY><TR><TD width="50%" align=left><img border="0" src="http://cry.shidabbs.com/home/bbsjc/images/ta1.gif"></TD><TD width="50%" align=right><img border="0" src="http://cry.shidabbs.com/home/bbsjc/images/ta2.gif"></TD></TR></TBODY></TABLE>
<br><br><img border="0" src="http://cry.shidabbs.com/home/bbsjc/images/jchanxing.jpg">
<br><br>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0><TBODY><TR><TD width="50%" align=left><img border="0" src="http://cry.shidabbs.com/home/bbsjc/images/ta3.gif"></TD><TD width="50%" align=right><img border="0" src="http://cry.shidabbs.com/home/bbsjc/images/ta4.gif"></TD></TR></TBODY></TABLE></td></tr></table>
例4:
说明:把图片应用到边框上面,整个表格的大小很重要,调整也是件麻烦的事,所以建议大家用表格格线的厚度cellspacing的属性值或者是表格格线的间距cellpadding的属性值来调整。
源代码:
<table align="center" border="1" cellpadding="0" cellspacing="10" width="400" background="http://cry.shidabbs.com/home/bbsjc/images/jcbj03.jpg" bordercolorlight="#C0B4FE" bordercolordark="#0C091D"><tr><td width="100%" align="center"><table align="center" border="1" cellpadding="0" cellspacing="18" width="100%" background="http://cry.shidabbs.com/home/bbsjc/images/xing.gif" bordercolor="#C0B4FE"><tr><td width="100%" align="center"><table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" background="http://cry.shidabbs.com/home/bbsjc/images/jcbj01.jpg"><tr><td width="100%" align="center">
<br><br><img border="0" src="http://cry.shidabbs.com/home/bbsjc/images/jchanxing.jpg">
<br><br></td></tr></table></td></tr></table></td></tr></table>
关与内容居中:
说明:
一般大家做帖子为了美观总是把整体内容全都居中,内容中的文字图片等都加上了居中的代码CENTER,频繁的使用同一组代码,用多了大家是不是觉得有些杂乱的感觉?在这里我都教大家一招,只需要用一次就可以使整个表格内的内容全都居中。
下面是大家一般使用的表格代码:
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" background="http://cry.shidabbs.com/home/bbsjc/images/jcbj03.jpg"><tr><td></td></tr></table>
将其改成如下代码:
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" background="http://cry.shidabbs.com/home/bbsjc/images/jcbj03.jpg"><tr><td width="100%" align="center"></td></tr></table>
这样样在表格内的文字图片等都不用再加居中代码了,直接插入就可以了。
|