English 中文(简体)
适合所有屏幕的百分比定位
原标题:Percentage positioning to fit in all screens

我正在制作一个网页的布局, 我希望它在所有屏幕上都有一个相同的外观。 我正在制作的页面有三个部分, 页眉、页眉、主页眉和页脚, 我想在屏幕上页眉上。 主页眉和页脚钉到页面底部。

我想做的是:

  1. I made the header to in the top but I couldn t add percentage to the main and footer section.
  2. 信头里还有一个叫做 div5 的 div, 我希望它能粘在父 div 的底部, 母 div 是主框或中框 。

  3. 在页脚里,我有三个箱子, 想要把它们放在左边,右边和中间。

请查看",让我知道如何解决这些问题。

问题回答

只有当您设定父元素为高度时, 百分比高度才有效 。

(这些要素将问“什么的百分比?” )

我们在这里设定身体的高度

<强 > cs

<style type="text/css">

      html,body { height:100%;}

      #header { display:block; height:10%; }
      #main   { display:block; height:80%; }
      #footer { display:block; height:10%; }

</style>

< 强 > 标记

   <body>
    <div id="header"></div>
    <div id="main"></div>
    <div id="footer"></div>
   </body>

通过做这些, 您正在使您 div 23 & amp; 4 重叠 。 确保即使这样也得到处理 。 是的 您也必须考虑 Cs 媒体查询的选项 。 请通过演示 < a href=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签