查看效果: http://www.neixun360.com/eg/eg1/demo.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta content="div,先浮动,后固定" name="description">
<meta content="div,先浮动,后固定" name="keywords">
<title>div,先浮动,后固定</title>
<style>
*{margin:0;padding:0;}html,body{_height:100%;_overflow:hidden;}body{_overflow:auto;font-family:Arial,sans-serif;font-size:14px;background:#f4f4f4;color:#333;text-shadow:1px 1px 1px #fff;}#header{position:fixed;_position:absolute;left:0px;text-align:center;display:block;height:35px;clear:both;background:#000;margin-bottom:30px;border-bottom:7px solid #ccc;font-size:14px;line-height:35px;text-align:right;font-style:italic;width:100%;}#header a{color:#aaa;text-shadow:1px 1px 1px #000;padding:0px 20px;outline:none;}#header a:hover{color:#fff;}#header a.back{color:#1B80B5;font-weight:bold;display:block;float:right;}#header a.back:hover{color:#fff;}.left{float:left;}.right{float:right;}h1{font-size:42px;font-family:'Cantarell';font-weight:100;letter-spacing:-1px;}h2{font-size:20px;text-indent:4px;font-weight:normal;font-style:italic;color:#a1a1a1;padding:5px 0px 20px 0px;}h2 span{color:#444;}a{color:#777;text-decoration:none;}a:hover{color:#222;}p{padding:5px 0px;}.content{padding:70px;padding-top:200px;width:80%;margin:0 auto;}#footer{position:fixed;_position:absolute;background:#eee;left:0px;width:100%;height:50px;line-height:50px;bottom:0;background:#f0f0f0;border-top:7px solid #ccc;text-align:center;text-shadow:1px 1px 1px #000;color:#fff;background:#000;}
#footer a{color:#aaa;padding:0px 10px;text-shadow:1px 1px 1px #000;}#footer a:hover{color:#fff;text-shadow:0px 0px 1px #fff;}#header{top:0;}#wrapper {overflow: hidden;}
#contentn {width:555px; margin-right:10px; float:left; min-height:1200px;}#sidebar {width:284px; padding:10px; background: #ccc; float:right; height:400px;}
#portamento_container {float:right; position:relative;} /* take the positioning of the sidebar, and become the start point for the sidebar positioning */
#portamento_container #sidebar {float:none; position:absolute;} /* no need to float anymore, become absolutely positoned */
#portamento_container #sidebar.fixed {position:fixed;} /* if the panel is sliding, it needs position:fixed */
</style>
</head>
<body>
<div class="content">
<div id="wrapper">
<div id="contentn">
<h2><a href="http://site518.net/dd/"><b>div,先浮动,后固定</b></a></h2>
<br/><br/>
<p><img src="g.jpg"></p>
<p><img src="n.jpg"></p>
</div>
<div id="sidebar">
<p><img src="360.jpg"></p>
</div>
</div>
</div>
<div id="footer">
</div>
<script src="jquery.min.js"></script>
<script src="portamento.js"></script>
<script>
$('#sidebar').portamento();
</script>
</body>
</html>
查看效果: http://www.neixun360.com/eg/eg1/demo.htm
分享到:
相关推荐
jquery.floatdiv 浮动层固定位置 /*说明:可以让指定的层浮动到网页上的任何位置,当滚动条滚动时它会保持在当前位置不变,不会产生闪动*/ /*调用: 1 无参数调用:默认浮动在右下角 $("#id").floatdiv(); 2 内置...
很好的div浮动层显示,一些下拉改为透明的浮动层,便于做查询等功能
附带完整的例子,对js完全不会的人也可以轻松使用,只要把例子中的js引用语句复制过去(地址当然要重新设定),然后把函数 ... $("#compore").floatdiv({left:"10px",top:"100px"}); }); 中10px和100px改成想要的数字就ok
DIV可固定到页面的固定位置,不随页面的滚动而变化,还可以拖动DIV重新固定位置
div跟随固定在浏览器左边,上下拉动浏览器滚动条时div固定在左边,横向拉动滚动条时DIV会跟随主体而改变位置。
NULL 博文链接:https://luanxiyuan.iteye.com/blog/1874189
利用css和jquery实现table表头固定(浮动)显示,不复制表格内容,不更改页面元素,完全通过js设置样式来实现。
比如做购物车的时候,提示用户购买状况,东西很好用
我一直以为是某个div或层随屏幕滚动,遇顶则固定,离开浏览器顶部又还原这样的例子其实不少,其实它的名字叫“层的智能浮动效果”。目前我们在国内的商业网站上就常常看到这样的效果了。例如淘宝网的搜索结果页的...
当N个元素浮动后,会导致错位的问题。一般给元素一个固定的height就没有这个现象。 但是当高度不一致时,就需要想别的办法来解决了: 1、给父元素定义font-size:0; 浮动子元素定义需要的font-size, 再定义display...
jquery右固定div,无延时,浮动的,可以用,简单
浮动文字下拉左侧固定文字用于为网页添加一个浮动面板。当网页滚动时,面板也会随着滚动。
基于jquery的滚动固定位置广告位插件,支持自定义偏移量。 用法: window.onscroll=function(){floatWin("branding","right","top")} window.onscroll=function(){floatWin("branding","left","top")} window....
div的position属性详细讲解 1.流动模型 (块元素,内联元素) 2.浮动模型 (float:) 块状元素这么霸道都是独占一行,如果现在我们想让两个块状元素并排显示,怎么办呢?不要着急,设置元素浮动就可以实现这一愿望。...
用css实现div固定在屏幕底部,不随垂直滚动条接动而闪动,很好的实现在ie下的浮动效果,IE6 position:fixed
场景:在一个固定高度的div中,有一个浮动的元素,需要将这个浮动元素垂直居中。 原始代码如下: 复制代码代码如下:<!DOCTYPE html><html> <head> <title></title> <style type=”text...
4.本例子只解决了页面不满一屏时的页底浮动问题,如果你的页面撑满一页有竖滚动条时,页底是固定不变的。 5.关于第4点本人认为,并不是这个解决方案有缺陷。因为你不应该用这个例子解决你的既要满屏居低又要超一屏还...
/*任意位置浮动固定层*/ /*没剑(http://regedit.cnblogs.com) 08-03-11*/ /*说明:可以让指定的层浮动到网页上的任何位置,当滚动条滚动时它会保持在当前位置不变,不会产生闪动*/ /*调用: 1 无参数调用:默认浮动...
关于在html中浮动层是众多网页爱好者刚开始的难点,... 2、在身的左右分别放置两个垂直居中的div,类似浮动广告条,位置固定,不随滚动条的滚动和滚动; 【问题】: 1、如何固定层? 复制代码代码如下:/* 全局浮动层
CSS基础声明定位定位简介流定位浮动定位相对定位绝对定位固定定位粘性定位堆叠顺序定位属性总结 定位 定位简介 定位:定义元素框相对于其正常位置应该出现的位置,或者相对于父元素、另一个元素甚至浏览器窗口本身的...