站长资源网页制作

CSS3中新增的对文本和字体的设置

整理:jimmy2024/10/6浏览2
简介文字阴影text-shadow: 水平偏移 垂直偏移 模糊 颜色兼容性:IE10+Document</t</div> <div class="news_infos"><div id="MyContent"><p>文字阴影</p> <p>text-shadow: 水平偏移 垂直偏移 模糊 颜色</p> <p>兼容性:IE10+</p> <div class="htmlcode"> <pre class="brush:css;"> <!DOCTYPE html> <html lang="en" manifest="index.manifest"> <head> <meta charset="UTF-8"> <title>Document</title> <style> p{ color:blue; text-shadow: 3px 3px 3px black; } </style> </head> <body> <p>这是一段测试文本鸭</p> </body> </html></pre> </div> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309214930.jpg');"><img src="/UploadFiles/2021-03-30/2020020309214930.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <p>css3 换行</p> <p>word-break: normal | break-all | keep-all</p> <p>对于英文文本:normal 和 keep-all 效果相同;break-all 即字母和字母见换行,不考虑单词的影响</p> <p>对于中文文本:normal 和 break-all 效果相同;keep-all 即根据标点符号换行</p> <div class="htmlcode"> <pre class="brush:css;"> <!DOCTYPE html> <html lang="en" manifest="index.manifest"> <head> <meta charset="UTF-8"> <title>Document</title> <style> p{width:500px;} span{background:#abcdef;} p:nth-child(1){word-break:normal;} p:nth-child(2){word-break:break-all;} p:nth-child(3){word-break:keep-all;} p:nth-child(5){word-break:normal;} p:nth-child(6){word-break:break-all;} p:nth-child(7){word-break:keep-all;} </style> </head> <body> <p><span>[word-break:normal]</span> I have a dream that one day on the red hills of Georgia, the sons of former slaves and the sons of former slave owners will be able to sit down together at the table of brotherhood.</p> <p><span>[word-break:break-all]</span> I have a dream that one day on the red hills of Georgia, the sons of former slaves and the sons of former slave owners will be able to sit down together at the table of brotherhood.</p> <p><span>[word-break:keep-all]</span> I have a dream that one day on the red hills of Georgia, the sons of former slaves and the sons of former slave owners will be able to sit down together at the table of brotherhood.</p> <hr> <p><span>[word-break:normal]</span> 我梦想有一天,这个国家会站立起来,真正实现其信条的真谛:“我们认为人人生而平等的真理不言而喻。”我梦想有一天,在佐治亚的红山上,从前奴隶的后嗣将能够和奴隶主的后嗣坐在一起,共叙兄弟情谊。</p> <p><span>[word-break:break-all]</span> 我梦想有一天,这个国家会站立起来,真正实现其信条的真谛:“我们认为人人生而平等的真理不言而喻。”我梦想有一天,在佐治亚的红山上,从前奴隶的后嗣将能够和奴隶主的后嗣坐在一起,共叙兄弟情谊。.</p> <p><span>[word-break:keep-all]</span> 我梦想有一天,这个国家会站立起来,真正实现其信条的真谛:“我们认为人人生而平等的真理不言而喻。”我梦想有一天,在佐治亚的红山上,从前奴隶的后嗣将能够和奴隶主的后嗣坐在一起,共叙兄弟情谊。</p> </body> </html></pre> </div> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309214931.jpg');"><img src="/UploadFiles/2021-03-30/2020020309214931.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <p>word-wrap 针对连续的英文长单词或者url网址(中文无效)</p> <p>word-wrap:normal | break-word;</p> <div class="htmlcode"> <pre class="brush:css;"> <!DOCTYPE html> <html lang="en" manifest="index.manifest"> <head> <meta charset="UTF-8"> <title>Document</title> <style> p{width:200px;} span{background:#abcdef;} p:nth-child(1){word-wrap:normal;} p:nth-child(2){word-wrap:break-word;} </style> </head> <body> <p><span>[word-wrap:normal]</span> <br>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p> <p><span>[word-wrap:break-word]</span> <br>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p> </body> </html></pre> </div> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309214932.jpg');"><img src="/UploadFiles/2021-03-30/2020020309214932.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <p>text-align-last 文本最后一行如何对齐</p> <p>只有IE支持,火狐需要加-moz-前缀,谷歌50+支持</p> <div class="htmlcode"> <pre class="brush:css;"> <!DOCTYPE html> <html lang="en" manifest="index.manifest"> <head> <meta charset="UTF-8"> <title>Document</title> <style> p{width:800px;} span{background:#abcdef;} p:nth-child(1){text-align-last:auto;} p:nth-child(2){text-align-last:left;} p:nth-child(3){text-align-last:right;} p:nth-child(4){text-align-last:center;} p:nth-child(5){text-align-last:justify;} p:nth-child(6){text-align-last:start;} p:nth-child(7){text-align-last:right;} p:nth-child(8){text-align-last:initial;} p:nth-child(9){text-align-last:inherit;} </style> </head> <body> <p><span>auto</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</p> <p><span>left</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</p> <p><span>right</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</p> <p><span>center</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</p> <p><span>justify</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</p> <p><span>start</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</p> <p><span>end</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</p> <p><span>initial</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</p> <p><span>inherit</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</p> </body> </html></pre> </div> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309215033.jpg');"><img src="/UploadFiles/2021-03-30/2020020309215033.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <p>text-align-last 只在text-align:justify 时才有效</p> <p>text-overflow</p> <p>使用时需要设置元素为overflow:hidden;</p> <p>中文无效,英文短单词无效,只对英文长单词有效</p> <div class="htmlcode"> <pre class="brush:css;"> <!DOCTYPE html> <html lang="en" manifest="index.manifest"> <head> <meta charset="UTF-8"> <title>Document</title> <style> div{width:800px;overflow:hidden;} span{background:#abcdef;} div:nth-child(1){text-overflow:clip;} div:nth-child(2){text-overflow:ellipsis;} div:nth-child(3){text-overflow:"";} div:nth-child(4){text-overflow:clip;} div:nth-child(5){text-overflow:ellipsis;} div:nth-child(6){text-overflow:"";} div:nth-child(7){text-overflow:clip;} div:nth-child(8){text-overflow:ellipsis;} div:nth-child(9){text-overflow:"";} </style> </head> <body> <div><span>clip</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</div> <div><span>ellipsis</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</div> <div><span>string</span>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。</div> <div><span>clip</span>I have a dream that one day on the red hills of Georgia, the sons of former slaves and the sons of former slave owners will be able to sit down together at the table of brotherhood.</div> <div><span>ellipsis</span>I have a dream that one day on the red hills of Georgia, the sons of former slaves and the sons of former slave owners will be able to sit down together at the table of brotherhood.</div> <div><span>string</span>I have a dream that one day on the red hills of Georgia, the sons of former slaves and the sons of former slave owners will be able to sit down together at the table of brotherhood.</div> <div><span>clip</span>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> <div><span>ellipsis</span>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> <div><span>string</span>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> </body> </html></pre> </div> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309215034.jpg');"><img src="/UploadFiles/2021-03-30/2020020309215034.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <p>text-overflow:clip; 隐藏</p> <p>text-overflow:ellipsis; 省略号</p> <p>text-overflow:string; 指定字符,只在火狐浏览器有效</p> <div class="htmlcode"> <pre class="brush:css;"> <!DOCTYPE html> <html lang="en" manifest="index.manifest"> <head> <meta charset="UTF-8"> <title>Document</title> <style> div{width:800px;overflow:hidden;} span{background:#abcdef;} div:nth-child(1){text-overflow:clip;} div:nth-child(2){text-overflow:ellipsis;} div:nth-child(3){text-overflow:"";} div:nth-child(4){text-overflow:clip;} div:nth-child(5){text-overflow:ellipsis;} div:nth-child(6){text-overflow:"";} div:nth-child(7){text-overflow:clip;} div:nth-child(8){text-overflow:ellipsis;} div:nth-child(9){text-overflow:"";} </style> </head> <body> <div><span>clip</span>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> <div><span>ellipsis</span>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> <div><span>string</span>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> </body> </html></pre> </div> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309215035.jpg');"><img src="/UploadFiles/2021-03-30/2020020309215035.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <p>overflow: visible | hidden | scroll | auto | inherit</p> <p>鼠标悬浮时显示隐藏的文字</p> <div class="htmlcode"> <pre class="brush:css;"> <!DOCTYPE html> <html lang="en" manifest="index.manifest"> <head> <meta charset="UTF-8"> <title>Document</title> <style> div{width:800px;overflow:hidden;text-overflow:ellipsis;} div:hover{overflow:visible;} </style> </head> <body> <div>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> </body> </html></pre> </div> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309215036.jpg');"><img src="/UploadFiles/2021-03-30/2020020309215036.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <p>@font-face 兼容性 IE9+</p> <p>字体格式</p> <p>TrueType .ttf 无优化 兼容性IE9+</p> <p>OpenType .otf 是ttf的升级版,不兼容IE</p> <p>.woff web版本最佳字体格式 是TrueType/OpenType的压缩格式 兼容性IE9+ 但是不能兼容手机端!</p> <p>.eot IE专用字体格式</p> <p>.svg svg字体格式 IE和火狐都不兼容</p> <p>自定义字体通用模板</p> <div class="htmlcode"> <pre class="brush:css;"> <!DOCTYPE html> <html lang="en" manifest="index.manifest"> <head> <meta charset="UTF-8"> <title>Document</title> <style> @font-face{ font-family:"myFont"; src:url('font/myFont.eot'),/*兼容IE9+*/ url('font/myFont.eot?#iefix') format('embedded-opentype'),/*兼容IE6-8*/ url('font/myFont.ttf') format('truetype'),/*兼容手机端*/ url('font/myFont.woff') format('woff'),/*兼容所有浏览器*/ url('font/myFont.svg#myFont') format('svg');/*针对ios开发*/ } p{font-family: 'myFont';} </style> </head> <body> <p>这是我的自定义字体呀~</p> </body></html></pre> </div> <p>获取特殊字体的网站:https://www.fontsquirrel.com/tools/webfont-generator</p> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309215037.jpg');"><img src="/UploadFiles/2021-03-30/2020020309215037.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309215038.jpg');"><img src="/UploadFiles/2021-03-30/2020020309215038.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <p>由于是国外服务器,因此下载速度比较慢</p> <p>注意:经我个人发现,这个软件转换出来的字体格式,都只支持英文版</p> <p>建议还是使用其他国内的在线转换工具或者网址</p> <p>字体文件</p> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309215139.jpg');"><img src="/UploadFiles/2021-03-30/2020020309215139.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <div class="htmlcode"> <pre class="brush:css;"> <!DOCTYPE html> <html lang="en" manifest="index.manifest"> <head> <meta charset="UTF-8"> <title>Document</title> <style> @font-face { font-family: '杨任东竹石体'; src:url('myfont/杨任东竹石体.eot'),/*兼容IE9+*/ url('myfont/杨任东竹石体.eot?#iefix') format('embedded-opentype'),/*兼容IE6-8*/ url('myfont/杨任东竹石体.ttf') format('truetype'),/*兼容手机端*/ url('myfont/杨任东竹石体.woff') format('woff'),/*兼容所有浏览器*/ url('myfont/杨任东竹石体.svg#杨任东竹石体') format('svg');/*针对ios开发*/ } p{font-family: '杨任东竹石体';font-size:24px;} </style> </head> <body> <p>HELLO THIS IS MY FONT~这是我的自定义字体~</p> </body> </html></pre> </div> <p><a href="javascript:;" onclick="showimg('/UploadFiles/2021-03-30/2020020309215140.jpg');"><img src="/UploadFiles/2021-03-30/2020020309215140.jpg" alt="CSS3中新增的对文本和字体的设置" onmousewheel="return bbimg(this)" onload="javascript:resizepic(this)" border="0"/></a></p> <p>成功~~~</p> <p><strong>总结</strong></p> <p>以上所述是小编给大家介绍的CSS3中新增的对文本和字体的设置,希望对大家有所帮助!</p></div> </div> </div> <div class="share"> </div> <div class="nextinfo"> <p>上一篇:<a href="http://m.paidiu.com/show/1/70595.html" title="Css和JS实现下划线动效的方法示例">Css和JS实现下划线动效的方法示例</a></p> <p>下一篇:<a href="http://m.paidiu.com/show/1/70597.html" title="通过css3背景控制属性+使用颜色过渡实现渐变效果">通过css3背景控制属性+使用颜色过渡实现渐变效果</a></p> </div> <div class="otherlink"> <h2>最新资源</h2> <ul> <li><a href="/show/1/615856.html" title="何洛洛.2024-别叫醒我(EP)【光羽】【FLAC">何洛洛.2024-别叫醒我(EP)【光羽】【FLAC</a></li> <li><a href="/show/1/615855.html" title="林忆莲.1996-爱莲说2CD【华纳】【WAV+CUE">林忆莲.1996-爱莲说2CD【华纳】【WAV+CUE</a></li> <li><a href="/show/1/615854.html" title="黄妃.2005-红【亚律】【WAV+CUE】">黄妃.2005-红【亚律】【WAV+CUE】</a></li> <li><a href="/show/1/615853.html" title="刘美麟《同生》[FLAC/分轨][161.95MB]">刘美麟《同生》[FLAC/分轨][161.95MB]</a></li> <li><a href="/show/1/615852.html" title="群星《前途海量 电影原声专辑》[320K/MP3">群星《前途海量 电影原声专辑》[320K/MP3</a></li> <li><a href="/show/1/615851.html" title="群星《前途海量 电影原声专辑》[FLAC/分轨">群星《前途海量 电影原声专辑》[FLAC/分轨</a></li> <li><a href="/show/1/615850.html" title="张信哲.1992-知道新曲与精丫巨石】【WAV+">张信哲.1992-知道新曲与精丫巨石】【WAV+</a></li> <li><a href="/show/1/615849.html" title="王翠玲.1995-ANGEL【新艺宝】【WAV+CUE】">王翠玲.1995-ANGEL【新艺宝】【WAV+CUE】</a></li> <li><a href="/show/1/615848.html" title="景冈山.1996-我的眼里只有你【大地唱片】">景冈山.1996-我的眼里只有你【大地唱片】</a></li> <li><a href="/show/1/615847.html" title="群星《八戒 电影原声带》[320K/MP3][188.">群星《八戒 电影原声带》[320K/MP3][188.</a></li> </ul> </div> </div> <div class="sidebar"> <div class="cloud"><h2 class="hometitle">一句话新闻</h2><a href="/show/1/603537.html"><ul>Windows上运行安卓你用过了吗<br><br>在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。</ul></a></div> </div> </article> <footer> <p style="font-size: 14px;">友情链接:<a href="http://www.imxmx.com/" title="杰晶网络" target="_blank">杰晶网络</a> <a href="http://www.ddrfans.com/" title="DDR爱好者之家" target="_blank">DDR爱好者之家</a> <a href="http://www.nqxw.com/" title="南强小屋" target="_blank">南强小屋</a> <a href="/" title="黑松山资源网" target="_blank">黑松山资源网</a> <a href="http://www.dyhadc.com/" title="白云城资源网" target="_blank">白云城资源网</a> <a href="/sitemap.xml">SiteMap</a></p> <p>Design by <a href="http://m.paidiu.com">黑松山资源网</a> <a href="/">http://m.paidiu.com</a></p> </footer> <script src="/images/nav.js"></script> <script type="text/javascript"> jQuery.noConflict(); jQuery(function() { var elm = jQuery('#left_flow2'); var startPos = jQuery(elm).offset().top; jQuery.event.add(window, "scroll", function() { var p = jQuery(window).scrollTop(); jQuery(elm).css('position', ((p) > startPos) ? 'fixed' : ''); jQuery(elm).css('top', ((p) > startPos) ? '0' : ''); }); }); </script> </body> </html>