html - contert_placeholder 上的内容与页脚重叠

标签 html css asp.net

我正在使用 asp.net 并且我的 content_place 持有者的内容重叠在我的页脚之外

这是页脚

enter image description here

这是我的CSS:

.footer {
   background-color: orange;
position: absolute;
left: 0;
bottom: 0;
width: 100%;
text-align:center;
clear:both;
 height: 50px;
}

这里是 content_place holder css

#content_area
{

       width:80%; 
            margin-left:10%; 
            margin-right:10%;
            height:100%;
}

我怎样才能让我的页脚粘在底部?或者让我的内容停止重叠?

最佳答案

给出 <body> CSS position:relative;

添加到你的CSS:

body {
   position:relative;
   min-height:100%;
   margin:0px;
   padding:0px;
}
html {
   height:100%;
   margin:0px;
   padding:0px;
}

制作.footer的绝对位置是相对于 body 的。

如果这对您没有帮助:

保持正文 css 和:

您不能使用 <asp:ContentPlaceHolder> 的 ID您的 css 设计的元素。原因是 <asp:ContentPlaceHolder>永远不会进入客户端的浏览器。这个元素只存在于服务器端,它的目的就像它的名字一样——被你给它的内容替换。

设计您的 <asp:ContentPlaceHolder> 的内容用 <div> 包围它元素,然后在 <div> 上应用 css 样式.

看例子:

<div id="content_area_div">
   <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
      <%--Placeholder for the pages--%>
   </asp:ContentPlaceHolder>
</div>

还有你的CSS:

#content_area_div
{
   width:80%; 
   margin-left:10%; 
   margin-right:10%;
   height:100%;
}

在客户端,唯一保留的是周围的 div 和您将插入 <asp:ContentPlaceHolder> 的内容。

希望对您有所帮助!

关于html - contert_placeholder 上的内容与页脚重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37225719/

相关文章:

c# - 我可以在不使用查询字符串或 session 的情况下将值传递给页面吗?

javascript - 如何使用 jQuery 在同一个父 div 中有效地选择元素

html - 按钮在所有浏览器中呈现的效果不一样

html - 在容器边缘定位元素

css - Firefox 无法从 Google Font API 渲染字体

c# - 获取当前正在访问的 "row"中的Repeater Label

jquery - SimpleWeather.js - 仅在互联网可用时加载

javascript - 使用 CSS、HTML 和 Javascript 在随机图像的页面上调整图像大小

html - 添加背景图像后,部分 CSS 将不起作用

c# - GetRequestStream 随机抛出超时异常