Html Div-won';不要向右浮动
我有一个潜水器不能正常漂浮。当您切换可见性时,它会覆盖当前的一些文本,但我可以稍后移动它。只是好奇为什么它不能正确浮动Html Div-won';不要向右浮动,html,css,Html,Css,我有一个潜水器不能正常漂浮。当您切换可见性时,它会覆盖当前的一些文本,但我可以稍后移动它。只是好奇为什么它不能正确浮动 <!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>
<!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 http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Simple Tabs with CSS & jQuery</title>
<style type="text/css">
.hidden{
background-color:#ccc;
position:absolute;
clear:both;
width:300px;
float:right;
border:1px black inset;
height:300px;
text-decoration:none;
font-size:14px;
padding: 1em 1em 1em 1em;
border:2px black double;
list-style-type:none;
display:none;
top:330px;
}
.hidden1{
background-color:#ccc;
position:absolute;
float:right;
width:100px;
border:1px black inset;
height:100px;
text-decoration:none;
font-size:14px;
padding: 1em 1em 1em 1em;
border:2px black double;
list-style-type:none;
display:none;
}
body {
margin:1em;
padding:0;
height:100%;
background-color:#cbcbcb;
color:#000000;
text-align:center;
font-family:Arial, Helvetica, sans-serif;
border-style: thin;
}
h1 {font-size: 3em; margin: 20px 0;}
#centerColumn {
margin: 0 auto;
padding: 1em;
width: 1000px;
height:1200px;
text-align: left;
vertical-align: bottom;
background-color: #ffffff;
border: 1px solid #999999;}
ul.tabs {
margin: 0;
list-style: none;
height: 32px;
float:left;
width:200px;
padding:0 0 0 0;
}
ul.tabs li {
margin: 0;
padding: 0;
height: 31px;
line-height: 31px;
border: 1px solid #999;
border-left: none;
margin-bottom: -1px;
background: #e0e0e0;
overflow: hidden;
position: relative;
}
ul.tabs li a {
text-decoration: none;
color: #000;
display: block;
font-size: 1.2em;
padding: 0 20px;
border: 1px solid #fff;
outline: none;
}
ul.tabs li a:hover {
background: #eee;
font-size:1.25em;
}
html ul.tabs li.active, html ul.tabs li.active a:hover {
background: #fff;
border-bottom: 1px solid #fff;
}
table {
background-color: black;
border: 1px black solid;
border-collapse: collapse;
}
th {
border: 1px outset silver;
background-color: silver;
color: white;
}
tr {
background-color: white;
margin: 10px;
}
tr.striped {
background-color:silver ;
}
td {
padding: 1px 8px;
}
.tab_container {
border: 1px solid #999;
border-top: none;
clear: both;
float: right;
width: 99%;
background: #fff;
-moz-border-radius-bottomright: 5px;
-khtml-border-radius-bottomright: 5px;
-webkit-border-bottom-right-radius: 5px;
-moz-border-radius-bottomleft: 5px;
-khtml-border-radius-bottomleft: 5px;
-webkit-border-bottom-left-radius: 5px;
}
</style>
<script type="text/javascript"
src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("table tr:nth-child(even)").addClass("striped");
//Default Action
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
return false;
});
$("#agebutton").hover(function(){
$(".hidden1").fadeIn(200);
},
function(){
$(".hidden1").fadeOut(200);
});
$("#button").hover(function(){
$(".hidden").fadeIn(200);
},
function(){
$(".hidden").fadeOut(200);
});
});
</script>
</head>
<body>
<div id="centerColumn">
<div id="header"></div>
<h2 style="float:right; color:silver ">KARRN Spinal Cord Injury Registry</h2>
<br/><br/><br/><br/>
<ul class="tabs">
<li><a href="#tab1">Personal</a></li>
</ul><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/>
<div class="hidden"><p>Resident County Stats
</p>
<p>Top three counties:<br/></p>
<ul style="list-style:none; padding: 0;">
<li style="border-bottom:1px">Johnson</li>
<li>Perry</li>
<li>Pike</li>
</ul>
</div>
<div class="hidden1">Average age: </div>
<div class="tab_container">
<div id="tab1" class="tab_content">
<table style="width: 100%" cellspacing="1" >
<tr>
<td >Username</td>
<td >Last Name</td>
<td >First Name</td>
<td >MI</td>
<td >Address</td>
<td >Email</td>
<td id="agebutton" class="style1" ><strong><a href="javascript:;">Age</a></strong></td>
<td id="button" class="style1" ><strong><a href="javascript:;">Resident County</a></strong></td>
</tr>
<tr>
<td >ww</td>
<td >Wilson</td>
<td >Woodrow</td>
<td >I</td>
<td >Penn Ave.</td>
<td ><a href="mailto:a@a.com">a@a.com</a></td>
<td >112</td>
<td > </td>
</tr>
<tr>
<td >othername</td>
<td >Last</td>
<td >First Name</td>
<td > </td>
<td >None</td>
<td ><a href="mailto:other@other.com">other@other.com</a></td>
<td >56</td>
<td >Fayette</td>
</tr>
<tr>
<td >Jr</td>
<td >Routen</td>
<td >Johnny</td>
<td >R</td>
<td >1 St.</td>
<td > </td>
<td >23</td>
<td >Hart</td>
</tr>
<tr>
<td >Jackson</td>
<td >Jackson</td>
<td >Smith</td>
<td >I</td>
<td >123 Address St.</td>
<td ><a href="mailto:jackson@ebay.com">jackson@ebay.com</a></td>
<td >34</td>
<td >Pike</td>
</tr>
<tr>
<td >roquefort</td>
<td >Head</td>
<td >Cheese</td>
<td >M</td>
<td >green bay</td>
<td ><a href="mailto:cheese@cheese.com">cheese@cheese.com</a></td>
<td >19</td>
<td >Menifee</td>
</tr>
<tr>
<td >Greenstein</td>
<td >Green</td>
<td >Up</td>
<td >C</td>
<td >1 Holler Road</td>
<td > </td>
<td >55</td>
<td >Greenup</td>
</tr>
<tr>
<td >Mwb</td>
<td >Merriwether</td>
<td >Brandon</td>
<td >R</td>
<td >Drive</td>
<td > </td>
<td >29</td>
<td >Rockcastle</td>
</tr>
</table>
<br/>
</div>
</div>
</div>
</body>
</html>
简单的标签与CSS&;jQuery
.隐藏{
背景色:#ccc;
位置:绝对位置;
明确:两者皆有;
宽度:300px;
浮动:对;
边框:1件黑色插图;
高度:300px;
文字装饰:无;
字体大小:14px;
填料:1米1米1米1米1米;
边框:2件黑色双人;
列表样式类型:无;
显示:无;
顶部:330px;
}
.希登1{
背景色:#ccc;
位置:绝对位置;
浮动:对;
宽度:100px;
边框:1件黑色插图;
高度:100px;
文字装饰:无;
字体大小:14px;
填料:1米1米1米1米1米;
边框:2件黑色双人;
列表样式类型:无;
显示:无;
}
身体{
边缘:1米;
填充:0;
身高:100%;
背景色:#CBCB;
颜色:#000000;
文本对齐:居中;
字体系列:Arial、Helvetica、无衬线字体;
边框样式:薄;
}
h1{字体大小:3em;边距:20px 0;}
#中心柱{
保证金:0自动;
填充:1em;
宽度:1000px;
高度:1200px;
文本对齐:左对齐;
垂直对齐:底部对齐;
背景色:#ffffff;
边框:1px实心#999999;}
ul标签{
保证金:0;
列表样式:无;
高度:32px;
浮动:左;
宽度:200px;
填充:0;
}
李先生{
保证金:0;
填充:0;
高度:31px;
线高:31px;
边框:1px实心#999;
左边界:无;
边缘底部:-1px;
背景:#e0;
溢出:隐藏;
位置:相对位置;
}
ul.lia{
文字装饰:无;
颜色:#000;
显示:块;
字体大小:1.2米;
填充:0 20px;
边框:1px实心#fff;
大纲:无;
}
ul.a:悬停{
背景:#eee;
字号:1.25em;
}
html ul.tabs li.active,html ul.tabs li.active a:悬停{
背景:#fff;
边框底部:1px实心#fff;
}
桌子{
背景色:黑色;
边框:1px黑色实心;
边界塌陷:塌陷;
}
th{
边框:1件银色;
背景颜色:银色;
颜色:白色;
}
tr{
背景色:白色;
利润率:10px;
}
条纹的{
背景颜色:银色;
}
运输署{
填充:1px8px;
}
.tab_容器{
边框:1px实心#999;
边界顶部:无;
明确:两者皆有;
浮动:对;
宽度:99%;
背景:#fff;
-moz边框半径右下角:5px;
-khtml边界半径右下角:5px;
-webkit边框右下半径:5px;
-moz边框半径左下角:5px;
-khtml边界半径左下角:5px;
-webkit边框左下半径:5px;
}
$(文档).ready(函数(){
$(“表tr:n子级(偶数)”).addClass(“条带化”);
//默认动作
$(“.tab_content”).hide();//隐藏所有内容
$(“ul.tabs li:first”).addClass(“active”).show();//激活第一个选项卡
$(“.tab_content:first”).show();//显示第一个选项卡内容
//点击事件
$(“ul.tabs li”)。单击(函数(){
$(“ul.tabs li”).removeClass(“active”);//删除任何“active”类
$(this).addClass(“active”);//将“active”类添加到所选选项卡
$(“.tab_content”).hide();//隐藏所有选项卡内容
var activeTab=$(this).find(“a”).attr(“href”);//查找rel属性值以标识活动选项卡+内容
$(activeTab).fadeIn();//淡入活动内容
返回false;
});
$(“#agebutton”).hover(函数(){
$(“.hidden1”).fadeIn(200);
},
函数(){
$(“.hidden1”)。淡出(200);
});
$(“#按钮”).hover(函数(){
$(“.hidden”).fadeIn(200);
},
函数(){
$(“.hidden”).fadeOut(200);
});
});
KARRN脊髓损伤登记处
常住县统计
前三名县:
约翰逊
- 佩里
- 梭子鱼
平均年龄:
用户名
姓
名字
医疗保险
地址
电子邮件
栈单
威尔逊
伍德罗
我
宾州大道。
112
其他名称
最后
名字
没有一个
56
费耶特
年少者
鲁唐
约翰尼
R
第一。
23
雄鹿
杰克逊
杰克逊
史密斯
我
123地址街。
34
梭子鱼
罗克福特
头
奶酪
M
绿湾
19
梅尼菲
格林斯坦
绿色
向上的
C
霍勒道1号
55
绿化
Mwb
梅里韦瑟
布兰登
R
驱力
29
洛克城堡
您将绝对定位与浮动相结合。如果要使用绝对定位,只需使用right:0
而不是浮动:右
浮动和绝对定位往往会相互争斗。尝试移除绝对定位。特别是哪个div,您真的需要我们的帮助并提供一些细节。啊,谢谢。这很有效。当我这么做的时候,虽然隐藏的元素在IE和Firefox页面上的不同位置。你知道如何修复吗?@corybranan位置:相对于第一个定位的父元素的绝对位置,你需要给它一个顶部
或底部
。