本文介绍了HTML& CSS布局流问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


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


  2. 请参阅图片2:绿色框应该位于蓝色框的右侧;


如何更正?该代码位于



演示:



屏幕截图:




I have a flow layout with following two alignment issues

  1. Refer Image 1: When I change the zoo, the title info overlaps the logo.

  2. Refer Image 2: The green box should come as right side of the blue box; currently it is coming on bottom.

How can I correct it? The code is available in this fiddle . Posted here also.

I am sure it is a very basic alignment lesson; however I am not able to figure it out even after many hours? Can you please take a look at it and answer?

Image 1

Image 2

<!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;
}
解决方案

see fiddle for code and demo

fiddle: http://jsfiddle.net/L3And/3/

demo: http://jsfiddle.net/L3And/3/embedded/result/

Screen Shot:

这篇关于HTML&amp; CSS布局流问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 02:39