Click here to Skip to main content
15,867,308 members

Content moves over header when zooming

JacoBosch asked:

Open original thread
Good day

I have created a ASP.net website for IE9 using CSS3 and HTML5. It works for IE9, Firefox, Google Chrome and Safari.

I made some modifications in my stylesheet that it can work for IE8. When I tested the website in IE8 (changing screen resolution, zooming in and out etc) the main content moves over the header. The menu, main content and footer stays together when zooming in and out.

When I zoom out, the menu + main content moves over the header. When I zoom in, the menu + main content moves away from the header and leaves a white space between the header and menu.

I used some css3 coding in the stylesheet that is not ompatible with IE8.

Here is my css code

//stylesheet

CSS
html, body, #main{ height: 100%; margin: 0; padding: 0;}

 #form1
 {
  height:100%;
  margin:0;
 }

 #UpdatePanel1
 {
  height:100%;
  margin:0;
 }

#header
 {
  -moz-background-size: cover; //css3
  background-size: cover; //css3
  background-image:url(/Images/header.gif);
  background-size:100% 100%; //css3
  background-repeat:no-repeat;
  clear:both;
  background-color:#585858;
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:25%;
  z-index:-1;
  background-position:center;
 }

  #menu
 {
  background-color :#7C7C7C;
  height:auto;
  text-decoration : none;
  margin:150px 0px 0px 0px;
  padding:0px 40px 0px 40px;
  width:100% auto;
  border-bottom:3px solid #B1ABAB;
  min-height: 2%;
  bottom:-200px;
  position:relative;
 }

#main
 {
 margin-right:60px;
 margin-left:60px;
 margin-top:200px;
 height:auto;
 background-color: #ECECEC;
 width :100% auto;
 padding:40px 40px 0px 40px;
 overflow:auto;
 min-height:100%;
 }

#footerbottom {
 clear: both;
 position: relative;
 z-index: 0;
 height: 3em;
 margin-top: -3em;
 background-color: #585858;
 border-top:3px solid #B1ABAB;
 overflow:hidden;
}

#main { padding-bottom: 4em; }
#contactus { padding-bottom: 20em; }
#applications { padding-bottom: 20em; }


//master page
XML
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="site.master.cs" Inherits="site" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head runat="server">

<title>TsogoSafe</title>
<link href="Styles/main.css" rel="stylesheet" type="text/css" />
  <asp:ContentPlaceHolder ID="HeadContent" runat="server">
</head>
<body>
 <form id = "form1" runat="server" autocomplete="off">
 <asp:ScriptManager ID="ScriptManager1" runat="server">
 </asp:ScriptManager>
   <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
  <ContentTemplate>
 <div id = "header">
 <h1><br /><br /><br /></h1>
 </div>

<div id = "menu">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<a href = "Default.aspx">&nbsp;Home</a><span class="style1"></span>&nbsp;|&nbsp;
<a href ="Applications.aspx">Applications</a><span class="style1"></span>
&nbsp;|&nbsp;<a href ="Contact.aspx">Contact Us</a></div>
<div id = "main">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id = "footerbottom"></div>
</ContentTemplate>
 </asp:UpdatePanel>
</form>
</body>
</html>


My problem is, that my menu with the main content and footer is not "sticking" to my header.

What am I doing wrong in my stylesheet?
Tags: CSS, HTML, CSS3, HTML5, ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900