首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

求好手帮忙布局下

2012-06-20 
求高手帮忙布局下对页面实在是不精通,求高手帮忙看一下 谢谢了http://www.myfxbook.com/members/EA5918/fo

求高手帮忙布局下
对页面实在是不精通,求高手帮忙看一下 谢谢了
http://www.myfxbook.com/members/EA5918/forex-envy-v2-livelong-cycle/260594
上面的是想要实现的页面,只要上面的2个并列的 TAB选项DIV内容 已实现了一个

下面是我的页面代码,希望能够平行2个DIV 第一个DIV 有3个选项 第二个代码我已经实现了

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="n2.aspx.cs" Inherits="DWQHpro.n2" %>

<!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/xml;charset=utf-8" />
 <style type="text/css">
  *{margin:0;padding:0;font-size:13px;line-height:1.5; }
 body{padding:20px;}
 .cur{color:#f60;border-bottom:1px solid #fff;font-weight:bold;background:#fff;cursor:default;}
 #tab_,dl{position:relative;float:left;height:355px;width:900px;}
 h4,dt{float:left;height:20px;margin:0 0 0 8px;display:inline;line-height:20px;width:102px;
border:1px solid #ccc;position:relative;z-index:11;text-align:center;font-weight:normal;cursor:pointer;background:#eee;
  top: 0px;
  left: 7px;
  }
 .c,dd{position:absolute;top:21px;border:1px solid #ccc;left:0;width:939px;
padding:20px;overflow:hidden;display:block;
  height: 355px;
  }
 #tab_{clear:left;
  top: 0px;
  left: 0px;
  }
 h1{clear:left;padding:10px 0}
 #tab_1.cur{color:#f60}
 #tab_2.cur{color:blue}
 #tab_3.cur{color:green}
 </style>
 
 <title></title>
</head>
<body>
<script>
  HideWait();
</script>
  <form id="form1" runat="server">
   
  <%--<div id ="tab" >
  <h4>1</h4>
  <div class="c">1</div>
  <h4>2</h4>
  <div class="c">2</div>
  <h4>3</h4>
  <div class="c">3</div>
  </div>--%>

  <div id="tab_" >
 
  <h4>平仓盈亏</h4>
  <div class="c"><%= FQueryrecover()%></div>
  <h4>持仓盯市盈亏</h4>
  <div class="c"><%= FQueryPositionMTM()%></div>
  <h4>持仓金额</h4>
  <div class="c"><%= FQueryPriceMTM()%></div>
  <h4>持仓金额/当日权益</h4>
  <div class="c"><%= FQueryPriceMTMPer()%></div>
  <h4>收益率</h4>
  <div class="c"><%= FQueryDayProfit()%></div>
  <h4>净收益率</h4>
  <div class="c"><%= FQueryDayROR()%></div>
  <h4>资本金频繁度</h4>
  <div class="c"><%= FQueryDayfreIn()%></div>
  </div>

<script type="text/javascript">
  function id(elem) { return document.getElementById(elem) }
  function show(elem) { elem.style.display = ""; }
  function hide(elem) { elem.style.display = "none"; }
  function next(elem) {
  do {
  elem = elem.nextSibling;
  } while (elem && elem.nodeType != 1);
  return elem;
  }
  function tab(a, p) {

  var p = (p === undefined) ? { e: "onclick", n: 1} : p,


  node = id(a).firstChild,

  x = [];
  p.e = (p.e === undefined) ? "onclick" : p.e;
  p.n = (p.n === undefined) ? 1 : p.n;
  node = (node.nodeType !== 1) ? next(node) : node;
  for (var i = 1, node; node; i++, node = next(node)) {
  x[i] = node;
  }
  for (var i = 1; x[i]; i++) {
  if (i % 2 == 0) { hide(x[i]); x[i - 1].id = a + (i / 2) }
  x[p.n * 2 - 1].className = "cur";
  show(x[p.n * 2]);
  temp = function (i) {
  if (i % 2 == 1) {
  x[i][p.e] = function () {
  for (var j = 1; x[j]; j++) {
  if (j % 2 == 0) {
  hide(x[j]);
  x[j - 1].className = ""
  }
  }
  show(x[i + 1]);
  x[i].className = "cur"
  }
  } else {
  return null
  }
  } (i)
  }
  }
  //tab("tab", { e: "onmouseover", n: 2 });
  tab("tab_")
  //tab("tab")
</script>
  </form>

</body>
</html>


[解决办法]
因为你的tab 标签块 有多个,所以要统一设置tab的样式,宽高度的话再独自调整,使用两个class就可以
如:
<div class="tab tab1">tab11111</div>
<div class="tab tab2">tab11111</div>

.tab{设置所有tab的样式}

.tab1{设置个别tab的样式:主要是宽高度,浮动}
.tab2{设置个别tab的样式:主要是宽高度,浮动}



两个tab在同一行,要设置浮动 float

如:
<div style="容器的宽度...">
<div style="flaot:left">这是tab一</div>
<div style="flaot:right">这是tab二</div>
</div>

热点排行