图片素材来自 http://www.dotflowers.com/
截图:
还是选择Lighty
CSS代码:
body, html {
background:#FFF url(http://www.donews.net/images/www_donews_net/dodo/54776/o_beijing3.gif) repeat-x;
color: #555555;
font-family:ms shell dlg;
font-size:12px;
margin: 0;
line-height:150%;padding:0px;
text-align:center
}
#nadframe{display:none}
form{
margin-right: auto;
margin-left: auto;
font-size:14px;
}
.pagelayout{
margin: auto;
padding:0px 0px 0px 0px;
width: 752px;
font-size:14px;
text-align:left
}
a:visited, a:active, a:link {
color : #73AF1D;
text-decoration : none;
}
a:hover {
color: #73AF1D;
text-decoration :none;padding:3px;
background:#D7EDB7;
border-bottom:1px dotted #333
}
blockquote {
font-style : italic;
}
#header {
text-align:right;
color: #fff;
font-size:12px;
font-family:ms shell dlg;
padding-top:0px;
padding-right:20px;
background:url(http://www.donews.net/images/www_donews_net/dodo/54776/o_header-bg.gif) 0 0 no-repeat;height:147px ;width:752px
}
#header span{float:left;padding-top:105px;text-align:right;width:707px;}
#header #Header1_HeaderTitle{
color: #000000;
font-size:14px;font-family:arial;line-height:120%;font-weight:bold;color:#fff
}
#main {float:left;padding: 30px 0px 0px 15px;width:540px;font-size:14px;line-height:160%;color: #555555;word-wrap:break-word;
}
#footer{clear:both;border-top:3px solid #c0c0c0;padding-top:10px;text-align:center;font-size:12px}
#menu {clear:both;padding:0;
float:right;
width:185px;padding-top:30px;
word-wrap:break-word;
border-left:1px dotted #c0c0c0;padding-left:5px
}
#menu h1 {
color:#fff;padding:8px 0px 0px 35px;width:180px;
font-size: 14px;
font-weight: bold;
margin: 0px;
background:#FFF url(http://www.donews.net/images/www_donews_net/dodo/54776/o_navbg.gif) no-repeat;height:30px
}
#menu h3 {
color: #fff;padding:8px 0px 0px 35px;width:180px;
font-size: 14px;
font-weight: bold;
margin: 0px;
background:#FFF url(http://www.donews.net/images/www_donews_net/dodo/54776/o_navbg1.gif) no-repeat;height:30px
}
#menu ul {
list-style: none;
padding: 0px;
margin: 0px 0px 15px 5px;
font-size: 12px;
}
#comments{font-size:12px;line-height:150%}
#comments a{font-weight:bold}
.postTitle{font-weight:bold}
.postTitle a,.postTitle a:link,.postTitle a:visited{color:#73AF1D;font-size:14px}
div,select,input{font-size:12px;word-wrap:break-word;}
div.block {
background-image: url(images/main_background.gif);
background-position: top left;
background-repeat: repeat-y;
font-size: 12px;
text-align: justify;
}
div.block_footer {
background-image: url(images/day_footer.gif);
background-position: top left;
background-repeat: no-repeat;
height: 67px;
}
div.post {
padding-left: 0px;
}
.dateTitle{color:#808080;font-size:14px;font-weight:bold;line-height:280%}
div.posttitle {
color: #73AF1D;
font-family: "ms shell dlg";
font-size: 14px;
font-weight: bold;
}
.posttitle{background:#FFF url(http://www.donews.net/images/www_donews_net/dodo/54776/o_title1.gif) no-repeat;height:30px;padding-left:30px}
div.postText{line-height:160%;font-size:12px;}
.posttitle a:visited, .posttitle a:active, .posttitle a:link {
color:#73AF1D;
text-decoration : none;
border-bottom:1px dotted #73AF1D;padding:2px;
}
.posttitle a:hover {
color: #73AF1D;
text-decoration : none;padding:3px;
border-bottom:1px dotted #73AF1D;
}
.postFoot{line-height:120%;border-bottom:1px dotted #808080;font-size:12px;}
div.itemdesc {
color: #808080;
font-size: 12px;
text-transform: uppercase;
}
div.seperator {
background-position: top left;
background-repeat: no-repeat;
margin: 15px 0px 10px 0px;
}
div.entrylistitem {
padding-left: 20px;
padding-bottom: 10px;
}
a.entrylisttitle, a.entrylisttitle:visited, a.entrylisttitle:link, a.entrylisttitle:active {
color: #FF6600;
font-size: 14px;
font-weight: bold;
}
div.moreinfo {
font-size: 12px;
text-align: justify;
}
div.moreinfotitle {
color: #FF2a00;
font-size: 12px;
font-weight: bold;
}
div.comments {
font-size: 12px
}
div.comment {
background-color: #FBFBFB;font-size:12px;
border: 0px dotted #DDDDDD;
margin: 10px 0px 10px 0px;
padding: 10px;
}
div.comment_author {
margin: 5px 0px 5px 0px;font-size:12px;
}
div.comment_content {
margin: 5px 0px 5px 0px;font-size:12px;
}
#postcomment {
border: 0px solid #DDDDDD;
background-color: #FBFBFB;
font-size: 12px;
padding: 10px;
text-align: justify;
margin-top: 15px;
width: 435px;
}
#postcomment div {
color: #808080;
font-size: 12px;
font-weight: bold;
margin: 5px 0px 5px 0px;
}
#postcomment input.text, textarea {
border: 1px solid #DDDDDD;
font-size: 12px;
}
input.text {
width : 300px;
}
textarea {
width : 300px;
height : 200px;
}
#relatedlinks ul {
list-style : none;
margin-left : 10px;
padding : 0px;
}
span.highlight
{
background-color:Yellow;
}
.block_title{font-size:14px;font-weight:bold}
.code{float:left;width:90%;padding:10px;border:1px dotted #d9d9d9;background:#f4f4f4;}
.postFoot{clear:both;padding-top:6px}
br{clear:both;}
素材来自CSS ZEN。由于页面上有一个窄告的580宽的iframe影响显示.saivan建议用CSS来隐藏,是啊,我怎么忘了。
还有就是IE中不能居中的问题,虽然处理,但是在不同分辨率下还是有问题(适合1024X768),等待Blog程序的更新。
还是选Lighty
CSS代码:
body, html {
background:#FFF url(http://www.donews.net/images/www_donews_net/dodo/54776/o_ie_back.jpg) 50% 0 no-repeat;
color: #444444;
font-family:ms shell dlg;
font-size:12px;
margin: 0;
line-height:150%;padding:0px;
text-align:center;
}
form{
margin-right: auto;
margin-left: auto;
font-size:14px;
}
.pagelayout{
margin: auto;
padding:120px 0px 0px 0px;
width: 750px;
font-size:14px;
text-align:left;
}
a:visited, a:active, a:link {
color : #686e24;
text-decoration : none;
}
a:hover {
color: #686e24;
text-decoration :none;padding:3px;
background:#D7EDB7;
border-bottom:1px dotted #333
}
blockquote {
font-style : italic;
}
#header {
text-align:center;
color: #686e24;
font-size:12px;
font-family:ms shell dlg;
padding-top:10px;
padding-right:20px;
background:url(http://www.iqoo.com/images/pix.gif) 0 0 no-repeat;
}
#header span{line-height:100%;}
#header #Header1_HeaderTitle{
color: #000000;
font-size:16px;font-family:arial;line-height:120%;font-weight:bold;color:#686e24
}
#main {float:left;padding: 30px 0px 0px 15px;width:490px;font-size:14px;line-height:160%;color: #444444;word-wrap:break-word;
}
#footer{clear:both;border-top:3px solid #c0c0c0;padding-top:10px;text-align:center;font-size:12px}
#menu {clear:both;padding:0;
float:right;
width:178px;
word-wrap:break-word;
}
#menu h1 {
color:#686e24;padding:0px 0px 0px 5px;width:160px;
font-size: 14px;
font-weight: bold;
margin: 0px;
border-bottom:1px dotted #d9d9d9;
}
#menu h3 {
color: #686e24;padding:0px 0px 0px 5px;width:160px;
font-size: 14px;
font-weight: bold;
margin: 0px;
border-bottom:1px dotted #d9d9d9;
}
#menu ul {
list-style: none;
padding: 0px;
margin: 0px 0px 15px 5px;
font-size: 12px;
}
#comments{font-size:12px;line-height:150%}
#comments a{font-weight:bold}
.postTitle{font-weight:bold}
.postTitle a,.postTitle a:link,.postTitle a:visited{color:#355EA0;font-size:14px}
.dateTitle{color:#808080;font-size:12px}
div,select,input{font-size:12px;word-wrap:break-word;}
div.block {
background-image: url(images/main_background.gif);
background-position: top left;
background-repeat: repeat-y;
font-size: 12px;
text-align: justify;
}
div.block_footer {
background-image: url(images/day_footer.gif);
background-position: top left;
background-repeat: no-repeat;
height: 67px;
}
div.post {
padding-left: 0px;
}
.dateTitle{font-size:12PX;color:#000000;line-height:280%}
div.posttitle {
color: #686e24;
font-family: "ms shell dlg";
font-size: 14px;
font-weight: bold;
}
div.postText{line-height:150%}
.posttitle a:visited, .posttitle a:active, .posttitle a:link {
color:#686e24;
text-decoration : none;
border-bottom:1px dotted #686e24;padding:2px;
}
.posttitle a:hover {
color: #355EA0;
text-decoration : none;padding:3px;
border-bottom:1px dotted #686e24;
}
.postFoot{line-height:120%;border-bottom:1px dotted #808080;font-size:12px;}
div.itemdesc {
color: #808080;
font-size: 12px;
text-transform: uppercase;
}
div.seperator {
background-position: top left;
background-repeat: no-repeat;
margin: 15px 0px 10px 0px;
}
div.entrylistitem {
padding-left: 20px;
padding-bottom: 10px;
}
a.entrylisttitle, a.entrylisttitle:visited, a.entrylisttitle:link, a.entrylisttitle:active {
color: #FF6600;
font-size: 14px;
font-weight: bold;
}
div.moreinfo {
font-size: 12px;
text-align: justify;
}
div.moreinfotitle {
color: #FF2a00;
font-size: 12px;
font-weight: bold;
}
div.comments {
font-size: 12px
}
div.comment {
background-color: #FBFBFB;font-size:12px;
border: 0px dotted #DDDDDD;
margin: 10px 0px 10px 0px;
padding: 10px;
}
div.comment_author {
margin: 5px 0px 5px 0px;font-size:12px;
}
div.comment_content {
margin: 5px 0px 5px 0px;font-size:12px;
}
#postcomment {
border: 0px solid #DDDDDD;
background-color: #FBFBFB;
font-size: 12px;
padding: 10px;
text-align: justify;
margin-top: 15px;
width: 435px;
}
#postcomment div {
color: #808080;
font-size: 12px;
font-weight: bold;
margin: 5px 0px 5px 0px;
}
#postcomment input.text, textarea {
border: 1px solid #DDDDDD;
font-size: 12px;
}
input.text {
width : 300px;
}
textarea {
width : 300px;
height : 200px;
}
#relatedlinks ul {
list-style : none;
margin-left : 10px;
padding : 0px;
}
span.highlight
{
background-color:Yellow;
}
#nadframe{display:none}
.block_title{font-size:14px;font-weight:bold}
.code{float:left;width:90%;padding:10px;border:1px dotted #d9d9d9;background:#f4f4f4;}
.postFoot{clear:both;padding-top:6px}
br{clear:both;}
因为改不了程序代码,只能在CSS上下功夫,所以这个模板做了一些变相的处理,如:使用到了!important属性(可以去这里http://www.w3cn.org/article/tips/2004/91.html了解更多)
截图
还是选择系统CSS:Lighty
自定义CSS代码:
body, html {
background:#52a5f2;
color: #444444;
font-family:ms shell dlg;
font-size:12px;
margin: 0;
line-height:150%;padding:0px;
text-align:center
}
form{
margin-right: auto;
margin-left: auto;
font-size:14px;
}
.pagelayout{
background: #f7f7f7;
margin: auto;
padding: 0;
width: 755px;
font-size:14px;
border-left:1px dashed #fff;
border-right:1px dashed #fff;
text-align:left;
}
a:visited, a:active, a:link {
color : #355EA0;
text-decoration : none;
}
a:hover {
color: #FF6600;
text-decoration : underline;
}
blockquote {
font-style : italic;
}
#header {
background: url(http://www.donews.net/images/www_donews_net/dodo/54776/o_logo.gif) #348bd7 no-repeat 10px 15px;
height:100px;
text-align:right;
color: #fff;
font-size:12px;
font-family:ms shell dlg;
padding-top:10px;
padding-right:20px;
border-bottom:3px solid #52a5f2;
border-top:8px solid #3E74A2
}
#header span{line-height:100%;display:none;}
#header #Header1_HeaderTitle{display:none;
color: #000000;
font-size:16px;font-family:arial;line-height:200%;font-weight:bold;color:#fff
}
#main {float:left;
padding: 30px 0px 0px 15px;width:575px;font-size:14px;line-height:160%;color: #444444;word-wrap:break-word;
}
#footer{clear:both;border-top:3px solid #c0c0c0;padding-top:10px;text-align:center;font-size:12px}
#menu {clear:both;padding:0px;
float:left;
width:148px;
background:#e1f3ff;word-wrap:break-word;border-right:2px dotted #fff
}
#menu h1 {
color: #fff;padding:0px 0px 0px 5px;
font-size: 12px;
font-weight: bold;
margin: 0px;
border-bottom:0px dashed #c0c0c0;
background:#99d5f4;
}
#menu h3 {
color: #555555;padding:0px 0px 0px 5px;
font-size: 12px;
font-weight: bold;
margin: 0px;
border-bottom:0px dashed #c0c0c0;
background:#99d5f4;
color:#fff
}
#menu ul {
list-style: none;
padding: 0px;
margin: 0px 0px 15px 5px;
font-size: 12px;
}
#comments{font-size:12px;line-height:150%}
#comments a{font-weight:bold}
.postTitle{font-weight:bold}
.postTitle a,.postTitle a:link,.postTitle a:visited{color:#355EA0;font-size:14px}
.dateTitle{color:#808080;font-size:12px}
div,select,input{font-size:12px;word-wrap:break-word;}
div.block {
background-image: url(images/main_background.gif);
background-position: top left;
background-repeat: repeat-y;
font-size: 12px;
text-align: justify;
}
div.block_footer {
background-image: url(images/day_footer.gif);
background-position: top left;
background-repeat: no-repeat;
height: 67px;
}
div.post {
padding-left: 0px;
}
.dateTitle{font-size:12PX;color:#000000;line-height:280%}
div.posttitle {
color: #355EA0;
font-family: "ms shell dlg";
font-size: 14px;
font-weight: bold;
}
div.postText{line-height:150%}
.posttitle a:visited, .posttitle a:active, .posttitle a:link {
color:#355EA0;
text-decoration : none;
border-bottom:0px solid ##355EA0
}
.posttitle a:hover {
color: #FF6600;
text-decoration : underline;
}
.postFoot{line-height:120%;border-bottom:1px dashed #808080;font-size:12px;}
div.itemdesc {
color: #808080;
font-size: 12px;
text-transform: uppercase;
}
div.seperator {
background-image: url(images/post_footer.gif);
background-position: top left;
background-repeat: no-repeat;
margin: 15px 0px 10px 0px;
}
div.entrylistitem {
padding-left: 20px;
padding-bottom: 10px;
}
a.entrylisttitle, a.entrylisttitle:visited, a.entrylisttitle:link, a.entrylisttitle:active {
color: #FF6600;
font-size: 14px;
font-weight: bold;
}
div.moreinfo {
font-size: 12px;
text-align: justify;
}
div.moreinfotitle {
color: #FF2a00;
font-size: 12px;
font-weight: bold;
}
div.comments {
font-size: 12px
}
div.comment {
background-color: #FBFBFB;font-size:12px;
border: 0px dashed #DDDDDD;
margin: 10px 0px 10px 0px;
padding: 10px;
}
div.comment_author {
margin: 5px 0px 5px 0px;font-size:12px;
}
div.comment_content {
margin: 5px 0px 5px 0px;font-size:12px;
}
#postcomment {
border: 0px solid #DDDDDD;
background-color: #FBFBFB;
font-size: 12px;
padding: 10px;
text-align: justify;
margin-top: 15px;
width: 435px;
}
#postcomment div {
color: #808080;
font-size: 12px;
font-weight: bold;
margin: 5px 0px 5px 0px;
}
#postcomment input.text, textarea {
border: 1px solid #DDDDDD;
font-size: 12px;
}
input.text {
width : 300px;
}
textarea {
width : 300px;
height : 200px;
}
#relatedlinks ul {
list-style : none;
margin-left : 10px;
padding : 0px;
}
span.highlight
{
background-color:Yellow;
}
#nadframe{display:none}
.block_title{font-size:14px;font-weight:bold}
.code{float:left;width:90%;padding:10px;border:1px dotted #d9d9d9;background:#f4f4f4;}
.postFoot{clear:both;padding-top:6px}
br{clear:both;}
类似KESO,刘韧等的BLOG上有照片显示,可能很多人已经知道怎么弄,这个是写给不会弄的人
1。首先登录后台使用“相册”功能,上传一张照片
2。然后点击刚上传好的照片,出现新页面以后,鼠标右键复制这个的连接“Original Image”,或者再点击一下,会弹出一个图片的浏览器窗口,复制浏览器地址栏的路径也可以
3。然后点击"选项",然后再点击“配置”,然后在公告下面的输入框:粘贴下面代码
<div style="text-align"center"><img src="http://www.donews.net/images/www_donews_net/dodo/24872/www.gif" /></div>
红色部分替换为刚才复制的照片的连接路进
因为支持HTML代码,所以你也可以放其他的,比如GOOGLE广告,FLASH等等你想放的。
选Lighty,然后将下面的代码复制添加进去
背景图片是网上找的,这个模板也不是很满意,接着再搞。
body, html {
background: url(http://www.donews.net/images/www_donews_net/dodo/24872/o_bg.gif) #ccc fixed center top;
color: #444444;
font-family:ms shell dlg;
font-size:12px;
margin: 0;
padding: 0;
line-height:150%;text-align:center
}
form{
margin-right: auto;
margin-left: auto;
font-size:14px;
}
.pagelayout{
background: #fff;
margin: auto;
padding: 0;
width: 735px;
font-size:14px;text-align:left
}
a:visited, a:active, a:link {
color : #355EA0;
text-decoration : none;
}
a:hover {
color: #FF6600;
text-decoration : underline;
}
blockquote {
font-style : italic;
}
#header {
background: url(http://www.donews.net/images/www_donews_net/dodo/49134/o_bg.gif);
background-repeat: no-repeat;
height:130px;
text-align:center;
color: #444444;
font-size:12px;
font-family:ms shell dlg;
padding:0px;
}
#header span{line-height:400%}
#header #Header1_HeaderTitle{
color: #000000;
font-size:20px;font-family:黑体;line-height:300%
}
#main {float:left;
padding: 30px 0px 0px 15px;width:560px
}
#menu {clear:both;padding:0px;
float:left;
width: 140px;
background:#ffffff;word-wrap:break-word;
}
#menu h1 {
color: #555555;padding:0px 0px 0px 5px;
font-size: 12px;
font-weight: bold;
margin: 0px;
border-bottom:0px dashed #c0c0c0;
background:#F4F6F4;
}
#menu h3 {
color: #555555;padding:0px 0px 0px 5px;
font-size: 12px;
font-weight: bold;
margin: 0px;
border-bottom:0px dashed #c0c0c0;
background:#F4F6F4;
}
#menu ul {
list-style: none;
padding: 0px;
margin: 0px 0px 15px 5px;
font-size: 12px;
}
.listitem img {
margin-left: 5px;
}
a.listitem:visited, a.listitem:active, a.listitem:link {
color : #355EA0;
text-decoration : none;
}
a.listitem:hover {
color: #FF6600;
text-decoration : underline;
}
#LoginForm {
color: #808080;
font-size: 12px;
font-weight: bold;
text-align: justify;
}
#LoginForm input.text {
border: 1px dashed #C0C0C0;
font-size: 12px;
width: 180px;
}
h1.block_title {
background-image: url(images/day_header.gif);
background-position: top left;
background-repeat: no-repeat;
color: #FF6600;
font-size: 12px;
font-weight: bold;
height: 59px;
margin: 10px 0px 0px 0px;
padding: 20px 0px 3px 20px;
text-transform: uppercase;
}
h1.block_title img {
vertical-align: middle;
}
h1.block_title a:visited, h1.block_title a:active, h1.block_title a:link {
color: #FF6600;
}
div,select,input{font-size:12px;word-wrap:break-word;}
div.block {
background-image: url(images/main_background.gif);
background-position: top left;
background-repeat: repeat-y;
font-size: 12px;
text-align: justify;
}
div.block_footer {
background-image: url(images/day_footer.gif);
background-position: top left;
background-repeat: no-repeat;
height: 67px;
}
div.post {
padding-left: 0px;
}
.dateTitle{font-size:12PX;color:#000000;line-height:280%}
div.posttitle {
color: #355EA0;
font-family: "ms shell dlg";
font-size: 14px;
font-weight: bold;
}
div.postText{line-height:150%}
.posttitle a:visited, .posttitle a:active, .posttitle a:link {
color:#355EA0;
text-decoration : none;
border-bottom:1px solid ##355EA0
}
.posttitle a:hover {
color: #FF6600;
text-decoration : underline;
}
.postFoot{line-height:120%;border-bottom:1px dashed #808080;font-size:12px;}
div.itemdesc {
color: #808080;
font-size: 12px;
text-transform: uppercase;
}
div.seperator {
background-image: url(images/post_footer.gif);
background-position: top left;
background-repeat: no-repeat;
margin: 15px 0px 10px 0px;
}
div.entrylistitem {
padding-left: 20px;
padding-bottom: 10px;
}
a.entrylisttitle, a.entrylisttitle:visited, a.entrylisttitle:link, a.entrylisttitle:active {
color: #FF6600;
font-size: 14px;
font-weight: bold;
}
div.moreinfo {
font-size: 12px;
text-align: justify;
}
div.moreinfotitle {
color: #FF2a00;
font-size: 12px;
font-weight: bold;
}
div.comments {
font-size: 12px
}
div.comment {
background-color: #FBFBFB;font-size:12px;
border: 1px dashed #DDDDDD;
margin: 10px 0px 10px 0px;
padding: 10px;
}
div.comment_author {
margin: 5px 0px 5px 0px;font-size:12px;
}
div.comment_content {
margin: 5px 0px 5px 0px;font-size:12px;
}
#postcomment {
border: 1px solid #DDDDDD;
background-color: #FBFBFB;
font-size: 12px;
padding: 10px;
text-align: justify;
margin-top: 15px;
width: 435px;
}
#postcomment div {
color: #808080;
font-size: 12px;
font-weight: bold;
margin: 5px 0px 5px 0px;
}
#postcomment input.text, textarea {
border: 1px solid #DDDDDD;
font-size: 12px;
}
#footer {
border-top: 1px solid #E4E5E5;
clear: both;
margin : 0px;
padding-top : 5px;font-size:12px;
text-align : center;
}
input.text {
width : 300px;
}
textarea {
width : 300px;
height : 200px;
}
#relatedlinks ul {
list-style : none;
margin-left : 10px;
padding : 0px;
}
span.highlight
{
background-color:Yellow;
}
#nadframe{display:none}
.block_title{font-size:14px;font-weight:bold}
.code{float:left;width:90%;padding:10px;border:1px dotted #d9d9d9;background:#f4f4f4;}
.postFoot{clear:both;padding-top:6px}
br{clear:both;}
http://www.aimi.cn这个网站有点意思。它是这样介绍的:
爱米网是一个可以分享你目标的地方.
爱米网最有趣的地方并不在于记下要做的。而在于它能根据您所写的,为您聚合出一类人来。聚合出这些想做相同事情的人来后,剩下的就由用户自己去发挥了。比如大家可以相互鼓励,可以互相帮助,互相建议,甚至可以一同完成,总之,人们会发现自己朝向一个目标前行的时候不再孤独了。
不过它有一个外国爸爸
http://www.43things.com。
Discover what’s important, make it happen, share your progress. Find your 43 things.
Learn more…
这些小TIPS,在CSS手册或者HTML手册里是看不到的,不记得是在那里看到的,不过我一直用着。虽然标准校验通不过,如果不追求标准校验的话,还是可以用用的,因为在IE和Firefox里能显示的很好。
1。是不是经常会遇到小图片和文字一行排列不齐的尴尬?
img的align属性有一个这样的,align="absmiddle",可以试试,不过要是校验的时候,会提示错误。
2。字体
写一行中英文混在一起的内容,然后分别用font-family:宋体,font-family:Arial,font-family:"ms shell dlg"定义,看看效果。
这个IDEA来自KESO。
今天KESO说,对于一个左中右3栏布局的页面,比如home.donews.com,用户最想看到的是中栏的信息,左右2栏其实网站的相关信息的导航入口,所以中栏信息是最重要的,应该在页面显示顺序上优先于左右2栏。或者也可以这么说就是要将一个页面的最重要的信息优先于页面其他元素显示,无论是3栏还是2栏布局,说得很对。
浏览器显示页面是一行一行的按顺序执行代码,也就是说写在前面的先执行显示,而对于左中右3栏布局的设计,代码要么是从左–>中–>右来书写,要么就是到过来从右–>中–>左来书写,要做到KESO说的效果,那首先要书写的是中栏的代码。所以我首先定义了一个id=m的DIV,并且padding-left:150px,定义这个是为了给左栏留出140PX的显示位置,然后再在这个DIV里面嵌套定义一个id=middle的DIV,我用position:absolute的属性(绝对定位);然后再定义左栏left和右栏right。用position:absolute的属性有一个不好的地方就是它象photoshop里的层一样,它的自动延伸并不会带动整个布局的延伸,所以会遮住一些页面元素,比如我们通常会在网站的最下面写上一些copyright的信息,如果用先显示中栏的这种方法,如果不做处理的话,这些信息会被遮盖住。处理的办法就是使用javascript,让左右2栏的高度随中栏一起自动延伸。
下面是这个实现的代码,有兴趣的朋友可以COPY回去试试,也欢迎留言交流。
BTW:这次和刘韧,KESO改版DONEWS.COM,获益菲浅,他们才是真正懂用户需求,懂网站的人。
补充:
最近做一些试验的时候,发现本文代码最后的JS不是很好,想了个新的
这个是旧的
<script language="javascript">
if(document.getElementById("left").scrollHeight<document.getElementById("middle").scrollHeight
||
document.getElementById("right").scrollHeight<document.getElementById("middle").scrollHeight){
document.getElementById("left").style.height=document.getElementById("middle").scrollHeight+"px"
document.getElementById("right").style.height=document.getElementById("middle").scrollHeight+"px"
}
</script>
这是新的
<script language="javascript">
var l=document.getElementById("left").scrollHeight
var m=document.getElementById("middle").scrollHeight
var r=document.getElementById("right").scrollHeight
layoutHeight=Math.max(l,m,r)
document.getElementById("left").style.height=layoutHeight+"px"
document.getElementById("right").style.height=layoutHeight+"px"
document.getElementById("middle").style.height=layoutHeight+"px"
</script>
试验了3栏布局的切换,比这个复杂,过段时间会把代码放上来SHARE
完全代码:
<!DOCTYPE html PUBLIC "-//W。3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="gb2312">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<meta content="all" name="robots" />
<meta name="author" content="designed by dodo at donews.com" />
<title>WEB标准网站设计实例:左中右3栏布局中最先显示中栏内容的方法</title>
</head>
<style>
body{font-size:12px;}
div{color:#fff}
#m{padding-left:150px}
#middle{position:absolute;
background:red;width:468px;
margin-right: auto;
margin-left: auto;
padding: 0px;
}
#left{float:left;background:green;width:140px;height:30px}
#right{float:right;background:blue;width:140px}
#all{width:770px;
margin-right: auto;
margin-left: auto;
padding: 0px;
color: #000;
background:#ffa200;}
#footer{clear:both;background:#808080;color:#fff}
</style>
<body>
<div id="all">
<div id="m">
<div id="middle">
中栏<br />
·IT人的出路系列思考(三): 提升学习能力与可持 .. [陈国华] 11日
·alexa上,黑客的下一个目标是谁? [阮颖] 11日
·IT人的出路系列思考(二):思维创新战略与谋定 .. [陈国华] 11日
·IT人的出路系列思考(一):项目与打工 [陈国华] 11日
·希捷加入后的新一代笔记本选购规则 [新华美通] 11日
·木子美:挣扎出历史的海面透一口气 [周晶波] 11日
·首家推出出租房源、二手房源的RSS订阅服务 [鳖兔鳖] 11日
·TOM 在线公布二○○五年第一季度之业绩报告 [新华美通] 11日
·黄华:我们有必要开会吗? [黄华] 11日
·IT人的出路系列思考(三): 提升学习能力与可持 .. [陈国华] 11日
·alexa上,黑客的下一个目标是谁? [阮颖] 11日
·IT人的出路系列思考(二):思维创新战略与谋定 .. [陈国华] 11日
·IT人的出路系列思考(一):项目与打工 [陈国华] 11日
·希捷加入后的新一代笔记本选购规则 [新华美通] 11日
·木子美:挣扎出历史的海面透一口气 [周晶波] 11日
·首家推出出租房源、二手房源的RSS订阅服务 [鳖兔鳖] 11日
·TOM 在线公布二○○五年第一季度之业绩报告 [新华美通] 11日
·黄华:我们有必要开会吗? [黄华] 11日
</div>
</div>
<div id="left">左栏</div>
<div id="right">右栏<br>
</div>
<div id="footer">网页底部</div>
</div>
<script language="javascript">
var l=document.getElementById("left").scrollHeight
var m=document.getElementById("middle").scrollHeight
var r=document.getElementById("right").scrollHeight
layoutHeight=Math.max(l,m,r)
document.getElementById("left").style.height=layoutHeight+"px"
document.getElementById("right").style.height=layoutHeight+"px"
document.getElementById("middle").style.height=layoutHeight+"px"
</script>
</body>
</html>