图片与文字的排版比例要遵循黄金分割原理1:0.618黄金分割比是我们很早的时候就有学习到的,这也是目前在世界范围内都公认的最好构图比例,黄金分割率的页面比例可以给人带来视觉上的美感。这个是css图文混排的关键核心。
图文混排是版式设计中最常见的情况,图片与文字在传达版面信息上具有不同的特点,图片在视觉传达上可以辅助文字。
用CSS让文字在一行内显示不换行的方法:
一般的文字截断(适用于内联与块):
.text-overflow{
display:block /*内联对象需加*/
width:31em
word-break:keep-all /* 不换行 */
white-space:nowrap /* 不换行 */
overflow:hidden /* 内容超出宽度时隐藏超出部分的内容 */
text-overflow:ellipsis /*溢出时显示省略标记...;需与overflow:hidden一起使用*/
}
对于表格,定义有点不一样:
table{
width:30em
table-layout:fixed /*只有定义了表格的布局算法为fixed,下面td的定义才能起作用*/
}
td{
width:100%
word-break:keep-all /* 不换行 */
white-space:nowrap /* 不换行 */
overflow:hidden /* 内容超出宽度时隐藏超出部分的内容 */
text-overflow:ellipsis /* 溢出时显示省略标记...;需与overflow:hidden一起使用*/
}
注:这个只对单行的文字的效,如果你想把它用在多行上,也只有第一行有作用的。 这个写法只有IE会有"...",其它的浏览器文本超出指定宽度时会隐藏。
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。CSS不仅可以静态地修饰网页,还可以配合各种脚本语言动态地对网页各元素进行格式化。
CSS 能够对网页中元素位置的排版进行像素级精确控制,支持几乎所有的字体字号样式,拥有对网页对象和模型样式编辑的能力。
你需要写一个CSS样式文件,后缀名称就是CSS,我这里正好写了一个CSS样式表,用于定义网站显示文字的格式,然后你复制这个代码将这个代码保存格式为:comman.css
/*------reset------*/body,dl,dd,ul,ol,h1,h2,h3,h4,h5,h6,p,form{
margin:0
color: #000
font-size: 12px
font-family: "微软雅黑"
text-align: center
}
body,button,input,select,textarea{font:12px/1.5 tahoma,'\5b8b\4f53',sans-serifcolor:#6c6c6c}
body{padding-top:42px}
h1,h2,h3,h4,h5,h6{font-size:100%}
em,i,b{font-style:normal}
ul,ol{list-style:none}
a{color:#6c6c6ctext-decoration:none}
a:hover{
color:#330033
font-size: 12px
text-align: left
}
img{border:0}
button,input,select,textarea{font-size:100%outline:nonevertical-align:middle}
textarea{resize:none}
table{
border-collapse:collapse
border-spacing:0
text-align: center
}
td,th,ul,ol{
padding:0
color: #000
text-align: center
font-family: "微软雅黑"
font-size: 12px
}
/*------common------*/
.pr{position:relative}
.pa{position:absolute}
.fl{float:left}
.fr{float:right}
.fl,.fr{display:inline}
.bc{margin-left:automargin-right:auto}
.cb{clear:both}
.db{display:block}
.clearfix{*zoom:1}
.clearfix:after{content:'\20'display:blockheight:0line-height:0visibility:hiddenclear:both}
.tc{text-align:center}
.tr{text-align:right}
.fb{font-weight:bold}
.fn{font-weight:normal}
.f16{font-size:16px}
.f14{font-size:14px}
.f_yh{font-family:'\5FAE\8F6F\96C5\9ED1'}
.ell{text-overflow:ellipsiswhite-space:nowrapoverflow:hidden}
.none{display:none}
.hidden{visibility:hidden}
.ht{overflow:hiddentext-indent:-9999pxtext-decoration:none}
.unl{text-decoration:underline}
.bd1{border:1px solid #d8d8d8}
.bd1-t{border-top:1px solid #d8d8d8}
.bd1-b{border-bottom:1px solid #d8d8d8}
.bd3{border:3px solid #d8d8d8}
.hlh30{height:30pxline-height:30px}
.hlh24{height:24pxline-height:24px}
.lh22{line-height:22px}
.hlh20{height:20pxline-height:20px}
.c1{color:#5d5d5d}/*积齥*/
.c2{color:#8f8f8f}/*k*/
.c3{color:#e44cea}/*a?k*/
.c4{color:#f49bff}/*toplink*/
.c5{color:#ff0000}
.bc1{background:#f3f3f3}/*积sk*/
.bc2{background:#f8f8f8}/*齭k*/
.bc3{background:#ffffff}
.mt10{margin-top:10px}
.mb10{margin-bottom:10px}
.mr9{margin-right:9px}
.ml7{margin-left:7px}
.ml89{margin-left:89px}
.p20{padding:20px}
.p10{padding:10px}
.pt1{padding-top:1px}
.pr6{padding-right:6px}
.pl6{padding-left:6px}
.w230{width:230px}
.spr{background:url(http://ossweb-img.qq.com/images/ktv/web201206/spr.png) no-repeatoverflow:hidden}
.ico{width:8pxheight:8pxline-height:8pxmargin:10px 8px 0 8px}
/*--notice--*/
.game-notice{width:1000pxpadding:60px 0 30px 0}
.game-notice em{padding:0 4pxcolor:#6c6c6c}
/*--footer--*/
.footer{
background:#19001a
color: #FFF
}
.foot-con{width:915pxpadding:20px 0 30px 85px}
.foot-logo{width:216pxheight:45pxborder-right:1px solid #3a173b}
.game-logo{width:107pxheight:35pxbackground-position:0 -232px}
.kaige-logo{width:93pxheight:35pxbackground-position:-107px -232pxcursor:default}
.foot-list{padding-left:15pxcolor:#673768}
.foot-list a{color:#673768}
.foot-list a:hover{text-decoration:underline}
.foot-link{width:578px}
.foot-link span{padding:0 5pxcolor:#3A173B}
.copy{width:576px}/* |xGv00|8d5f9fb42d5dc8f4155bd7ed0d0073ae */