HTML& CSS布局流程问题

时间:2012-04-13 09:08:46

标签: html css

我的流程布局有以下两个对齐问题

  1. 参考图1:当我更改动物园时,标题信息与徽标重叠。

  2. 参考图2:绿框应该是蓝框的右侧;目前它已经到了最低点。

  3. 我该如何纠正?该代码在this fiddle中提供。也发表在这里。

    我确信这是一个非常基本的对齐课程;但是,即使经过几个小时,我也无法弄明白?你能看一看并回答吗?

    图片1 enter image description here

    图片2 enter image description here

    <!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 id="Head1">
    <title>Support Site </title>
    <link href="Styles/MasterStyle.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="wrapper">
        <div id="container">
            <div id="header">
                <div id="logo">
                    <img alt="logo" src="Images/Logo.bmp" />
                </div>
                <div id="titleInfo">
                    <a href="#">Admin XXXXXXXX Support Site</a>
                    <div id="signOut">
                        <a id="logOnStatus" class="signOut" >
                            Logout</a>
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
            <div id="centralContainer">
                <div id="leftNavContainer">
                    <div id="subContainerForLeftNav">
                        <div id="adminDiv">
                            <div class="backgroundButton" id="adminButton">
                                <p class="buttonText">
                                    The Admin</p>
                            </div>
                        </div>
                        <div class="clear">
                        </div>
                        <div id="vendorDiv">
                            <div class="menuTextHeading">
                                <a class="menuText">The Management</a>
                            </div>
                            <div class="buttonAlign">
                                <div class="backgroundButton" id="connectivityButton">
                                    <p class="buttonText">
                                        Test</p>
                                </div>
                                <div class="backgroundButton" id="vendorsButton">
                                    <p class="buttonText">
                                        Test</p>
                                </div>
                            </div>
                        </div>
                        <div class="clear">
                        </div>
                        <div id="monitoringDiv">
                            <div class="menuTextHeading">
                                <a class="menuText">Test</a>
                            </div>
                            <div class="buttonAlign">
                                <div class="backgroundButton" id="transactionsButton">
                                    <p class="buttonText">
                                        Test</p>
                                </div>
                                <div class="backgroundButton" id="logsButton">
                                    <p class="buttonText">
                                        Test</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="mainContainer">
                    <div id="transactionContentHolder" class="transactionContentHolder">
                        A
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
    </div>
    </body>
    </html>
    

    CSS

    body
    {
       margin: 0px;
       padding: 0px;
       text-align: center;
       background: Yellow;
    }
    
    #wrapper
    {
       width: 100%;
       height: auto;
       text-align:left;
       margin: 0 auto;
       /*background: #FFBA31;*/
       background: #FFBA31;
    }
    
    #container
    {
       width: 100%;
       height: auto;
       margin: 0 auto;
       background: white;
    
    }
    
    #header
    {
       width: 100%;
       height: 70px;
       background: white;
       padding: 0 0 10px 0;
       border:1px solid Red;
    
    }
    
    #titleInfo
    {
    font:bold 18pt Arial;
    color:#2377D1; 
    width:80%;
       height:35px;
       float:right;
       margin:10px 0 0 10px;
       border-bottom:3px solid #fcda55;
       padding: 10px 0 0 0;
       display:inline;
    
    }
    
    #signOut
    {
    font:bold 9pt Arial;
       float:right;
       border-bottom:none;
       padding: 0px 10px 0 0;
       margin: 0px 0px 30px 0;
       display:inline;
    }
    
    
    
    #logo
    {
      width:15%;
      height:60px;
      float:left;
      margin:0 0 0 20px;
      display:inline;
      padding: 10px 0 30px 0;
    }
    
    #centralContainer
    {
       width: 100%;
       height:auto;
       margin: 0 auto;
       background: white;
    }
    
    #leftNavContainer
    {
       width: 20%;
       height: 700px;
       /*float: left;*/
       margin: 0 0 0 10px;
       display: inline;
       background: white;
       border:1px solid Blue;   
    }
    
    #subContainerForLeftNav
    {
     width: 190px; 
     height: auto;
    
    }
    
    #mainContainer
    {
       width: 75%;
       height: 700px;
       float: left;
       margin: 0 0 0 30px;
       display: inline;
       background:white;
       border:1px solid Green;
    }
    
    
    
    
     .menuText
     {
        font:bold 13pt Arial;
       line-height:15pt;
        color:#00A6B5;
     }
    
    .menuTextHeading
    {
       height:20px;
       border-bottom:3px solid #fcda55;
       padding:10px 0 10px 0;
       margin:0 0 10px 0;
    }
    
    .buttonAlign
    {
      height:auto;
      width:auto;
      float: right;
      padding:0 0 0 0;
       margin:0 0 0 0;
    }
    
    
    .backgroundButton
    {      
       width:150px;
       height:86px;
       display: block;
        margin: 0px 0px 5px 0px;
       background-image:url('../Images/ButtonBackground.bmp');
    }
    
    .buttonText
    {
    
       font:bold 15pt Arial;
       line-height:18pt;
       color:#ffffff;
       padding:40px 15px 0 15px;
       margin:0 0 0 0;
       text-align:center;
    
    }
    
    .clear
    {
       clear: both;
    }
    

2 个答案:

答案 0 :(得分:2)

查看代码和演示的小提琴

小提琴:http://jsfiddle.net/L3And/3/

演示:http://jsfiddle.net/L3And/3/embedded/result/

屏幕截图:

enter image description here

答案 1 :(得分:1)

body {
  margin: 0px;
  padding: 0px;
  text-align: center;
  background: Yellow;
}
#wrapper {
  width: 100%;
  height: auto;
  text-align: left;
  margin: 0 auto;
  /*background: #FFBA31;*/
  background: #FFBA31;
}
#container {
  width: 100%;
  height: auto;
  margin: 0 auto;
  background: white;
}
#header {
  background: none repeat scroll 0 0 white;
  border: 1px solid Red;
  height: 70px;
  margin-bottom: 20px;
  padding: 0 0 10px;
  width: 100%;
}
#titleInfo {
  border-bottom: 3px solid #FCDA55;
  color: #2377D1;
  float: right;
  font: bold 18pt Arial;
  height: 35px;
  margin: 10px 0 0 10px;
  overflow: hidden;
  padding: 10px 0 0;
  width: 55%;
}
#signOut {
  font: bold 9pt Arial;
  float: right;
  border-bottom: none;
  padding: 0px 10px 0 0;
  margin: 0px 0px 30px 0;
  display: inline;
}
#logo {
  border: 1px solid orange;
  float: left;
  height: 32px;
  margin: 03px 0 0 20px;
  padding: 10px 0 30px;
  width: 15%;
}
#centralContainer {
  width: 100%;
  height: auto;
  margin: 0 auto;
  background: white;
}
/*Elements within centralContainer*/

#leftNavContainer {
  background: none repeat scroll 0 0 #CCCCCC;
  border: 1px solid Blue;
  float: left;
  height: 700px;
  margin: 0 0 0 10px;
  width: 20%;
}
#subContainerForLeftNav {
  width: 190px;
  height: auto;
  /*border:1px solid green;*/
}
#mainContainer {
  background: none repeat scroll 0 0 white;
  border: 1px solid Green;
  height: 700px;
  margin: 0 0 0 219px;
  width: 76%;
}
.menuText {
  font: bold 13pt Arial;
  line-height: 15pt;
  color: #00A6B5;
}
.menuTextHeading {
  height: 20px;
  border-bottom: 3px solid #fcda55;
  padding: 10px 0 10px 0;
  margin: 0 0 10px 0;
}
.buttonAlign {
  height: auto;
  width: auto;
  float: right;
  padding: 0 0 0 0;
  margin: 0 0 0 0;
}
.backgroundButton {
  width: 150px;
  height: 86px;
  display: block;
  margin: 0px 0px 5px 0px;
  background-image: url('../Images/ButtonBackground.bmp');
}
.buttonText {
  font: bold 15pt Arial;
  line-height: 18pt;
  color: #ffffff;
  padding: 40px 15px 0 15px;
  margin: 0 0 0 0;
  text-align: center;
}
.clear {
  clear: both;
}
<!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 id="Head1">
  <title>Support Site</title>
  <link href="Styles/MasterStyle.css" rel="stylesheet" type="text/css" />
</head>

<body>
  <div id="wrapper">
    <div id="container">
      <div id="header">
        <div id="logo">
          <img alt="logo" src="Images/Logo.bmp" />
        </div>
        <div id="titleInfo">
          <a href="#">Admin XXXXXXXX Support Site</a>
          <div id="signOut">
            <a id="logOnStatus" class="signOut">
                            Logout</a>
          </div>
        </div>
        <div class="clear">
        </div>
      </div>
      <div id="centralContainer">
        <div id="leftNavContainer">
          <div id="subContainerForLeftNav">
            <div id="adminDiv">
              <div class="backgroundButton" id="adminButton">
                <p class="buttonText">
                  The Admin</p>
              </div>
            </div>
            <div class="clear">
            </div>
            <div id="vendorDiv">
              <div class="menuTextHeading">
                <a class="menuText">The Management</a>
              </div>
              <div class="buttonAlign">
                <div class="backgroundButton" id="connectivityButton">
                  <p class="buttonText">
                    Test</p>
                </div>
                <div class="backgroundButton" id="vendorsButton">
                  <p class="buttonText">
                    Test</p>
                </div>
              </div>
            </div>
            <div class="clear">
            </div>
            <div id="monitoringDiv">
              <div class="menuTextHeading">
                <a class="menuText">Test</a>
              </div>
              <div class="buttonAlign">
                <div class="backgroundButton" id="transactionsButton">
                  <p class="buttonText">
                    Test</p>
                </div>
                <div class="backgroundButton" id="logsButton">
                  <p class="buttonText">
                    Test</p>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div id="mainContainer">
          <div id="transactionContentHolder" class="transactionContentHolder">
            A
          </div>
        </div>
        <div class="clear">
        </div>
      </div>
    </div>
  </div>
</body>

</html>

这可能对您有所帮助fiddle