1、我想在我设计好的网页中添加一个浮动框,怎么弄啊???
在百度查找浮动框代码,加到网页中即可!
2、网页制作,div浮动/间距 怎么弄
第一种方法:设置标题float:left;more的float:right。
第二种方法调整more的margin-left属性
3、html如何让其中一个div浮在另一个div上面
1、设置div样式 z-index:auto,auto可定义为一个值(整数数字),越大代表越置前,如可定义为: z-index:999。前提是div是定位元素。
2、可以使用float元素进行实现该效果。代码实例如下:
效果如下:
例子代码:
重叠样式需要主要CSS样式解释
1、z-index 重叠顺序属性。
2、position:relative和position:absolute设置对象属性为可定位(可重叠)。
3、left right top bottom绝对定位具体位置设置。
配合的样式
1、css width
2、css height
3、background 为了观察效果,我们对不同DIV设置不同背景颜色进行区别。
z-index的值为正整数值,数字越大对应对象层越浮上层越靠前。
以上实例默认顺序是“.div-c”浮在最上层(蓝色背景层)、“.div-b”浮在中层(黄色背景层)、“.div-a”排最底层(红色背景层)。我们接下来使用z-index样式在不改变html代码情况下实现顺序颠覆。
“.div-b”浮在中层(黄色背景层)排序不变,实现“.div-a”浮在最上层(红色背景层)、“.div-c”排最底层(蓝色背景层)。
4、网页设计浮动的问题
把你的背景图片加引号background-image:url("images/header.jpg");
另外content层高度你可以不设,现在你里面只放了一个left层,如果内容多的话它可以自动撑开的.
5、网页设计,DIV+CSS问题,浮动问题
浮动最直接 最根本的原因就是两个float的宽度和 大于总宽度。注意 IE下的偏移和margin在浮动下值的变化
6、html中浮动窗口怎么做啊?就是一个小窗口飘在在页面上那种
浮动窗口可以用js实现。带关闭窗口的简单全屏浮动代码如下:
<html>粘贴到本地一个记事本,保存为HTML格式打开即可看见。
如果只是固定在一个位置不动,可以在div的style设置‘position:fixed;’即可。
7、html(网页)浮动窗口,如何制作html(网页)浮动窗口?
浮动窗口可以很简单的弄个,就是一个div 样式<div style=" position:fixed; top:50%; left:50%; width:100px; height:50px; margin:-25px 0 0 -50px; ">内容</div>
8、div+css设计页面的时候不清楚浮动会有什么影响?请大侠详细讲一下,谢谢
浮动了那元素就不占文抄档流(普通流),不清除浮动布局会错位或其他。问题挺多(你试下不同浏览器,如火狐),div1(没设高度,有高度……即有布局,另论) div2(垂直排列,浮动div1不清除,即div1不占文档)
那么div2是在div2它该在的位置,它不受div1内容的影响,当然如果你的主容器用了浮动(或overflow属性)那里面的div浮动是可以不清除的。
一般是用overflow属性,用clear不好,因为要清除的东西太多,这样有用到clear的太多,用clear还要做相应处理,不处理clear还要占地盘。overflow比如你子要在content里用了就行了,里面东西偶配合clear就行了,overflow在主元素里基本要设的。
9、怎样制作网页中的浮动层效果?
<!-- 完整的HTML代码如下 -->
1.首先在<head>和</head>之间插入下列代码
<br>
<style type="text/css">
#floater {
position: absolute;
left: 500;
top: 146;
width: 176;
visibility: visible;
z-index: 10;
}
-->
</style>
<br>
<br>
2.在body中的任意位置插入下列代码
<div ID="floater" style="left: 590px; top: 158px">
<p align="center">
<img src="http://cfan.net.cn/tutu/200406301.jpg" width="127" height="150"><br>
<font color="#FF8040">欢迎光临</font></p>
</div><script LANGUAGE="JavaScript">
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
<!-- STALKER CODE -->
function heartBeat() {
if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY) {
percent = .1 * (diffY - lastScrollY);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelTop += percent;
if(NS) document.floater.top += percent;
lastScrollY = lastScrollY + percent;
}
if(diffX != lastScrollX) {
percent = .1 * (diffX - lastScrollX);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelLeft += percent;
if(NS) document.floater.left += percent;
lastScrollX = lastScrollX + percent;
}
}
<!-- /STALKER CODE -->
<!-- DRAG DROP CODE -->
function checkFocus(x,y) {
stalkerx = document.floater.pageX;
stalkery = document.floater.pageY;
stalkerwidth = document.floater.clip.width;
stalkerheight = document.floater.clip.height;
if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;
else return false;
}
function grabIt(e) {
if(IE) {
whichIt = event.srcElement;
while (whichIt.id.indexOf("floater") == -1) {
whichIt = whichIt.parentElement;
if (whichIt == null) { return true; }
}
whichIt.style.pixelLeft = whichIt.offsetLeft;
whichIt.style.pixelTop = whichIt.offsetTop;
currentX = (event.clientX + document.body.scrollLeft);
currentY = (event.clientY + document.body.scrollTop);
} else {
window.captureEvents(Event.MOUSEMOVE);
if(checkFocus (e.pageX,e.pageY)) {
whichIt = document.floater;
StalkerTouchedX = e.pageX-document.floater.pageX;
StalkerTouchedY = e.pageY-document.floater.pageY;
}
}
return true;
}
function moveIt(e) {
if (whichIt == null) { return false; }
if(IE) {
newX = (event.clientX + document.body.scrollLeft);
newY = (event.clientY + document.body.scrollTop);
distanceX = (newX - currentX); distanceY = (newY - currentY);
currentX = newX; currentY = newY;
whichIt.style.pixelLeft += distanceX;
whichIt.style.pixelTop += distanceY;
if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;
if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;
if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;
event.returnValue = false;
} else {
whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);
if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
return false;
}
return false;
}
function dropIt() {
whichIt = null;
if(NS) window.releaseEvents (Event.MOUSEMOVE);
return true;
}
<!-- DRAG DROP CODE -->
if(NS) {
window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
window.onmousedown = grabIt;
window.onmousemove = moveIt;
window.onmouseup = dropIt;
}
if(IE) {
document.onmousedown = grabIt;
document.onmousemove = moveIt;
document.onmouseup = dropIt;
}
if(NS || IE) action = window.setInterval("heartBeat()",1);
</script>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br>
<p></p>