z索引上下文

时间:2019-01-27 00:50:06

标签: css z-index

这是简化的标记:

<div id="container">
        <div id="top" style="position:fixed">
            <div class="header-top" style="z-index:100"></div>
            <div id="access" style="z-index:100"></div>
            <div id="image" style="z-index:50"></div>
        </div><!--end top-->
        <div id="main" style="z-index:75"></div>
    </div>

#main在固定的#top元素上方滚动时,我希望它显示在#image之上,但在#access.header-top之下。 / p>

由于#top的固定位置创建了上下文,因此似乎有问题。

有什么想法吗?

1 个答案:

答案 0 :(得分:-1)

您最终需要将public JsonResult SendMailToManager() { string name = Session["Name"].ToString(); var AreaManagerEmailCatch = db.Employees.Where(s => s.Email.Equals(name)).Select(s => s.AreaManagerEmail); var ManagerEmailCatch = db.Employees.Where(s => s.Email.Equals(name)).Select(s => s.ManagerEmail); var StartDateCatch = db.HolidayRequestForms.Where(s => s.Employee.Email.Equals(name)).Select(s => s.StartDate); var des = (from a in db.Employees where a.Email == name select a.AreaManagerEmail); var ManEmail = (from b in db.Employees where b.Email == name select b.ManagerEmail); var SD = (from c in db.HolidayRequestForms.OrderByDescending(c => c.RequestID) where (c.Employee.Email == name) && (c.Employee.EmployeeID == c.EmployeeID) select c.StartDate); DateTime StartDate = SD.FirstOrDefault(); string ManagerEmail = ManEmail.FirstOrDefault(); string AreaManagerEmail = des.FirstOrDefault(); bool result = false; result = SendEmail(AreaManagerEmail, "LotusWorks Holiday Request", "Hi there " + AreaManagerEmail + ",<br><br>[EmployeeEmail] has requested a holiday<br><br>The Employee will not be available to work From: <b>" + StartDate + "</b> to <b>[FinishDate]</b>.<br><br>Please forward this email to " + ManagerEmail + " with a response of Accept or Reject<br><br><br>Kind Regards,<br><br>LotusWorks Holiday Tracker"); return Json(result, JsonRequestBehavior.AllowGet); 插入<div id="main">内。 您可以为固定的元素创建特定的类。

<div id="top">
#access, #main, #image {
            width:200px;
            height: 200px;                
}
.fixed {
            position:fixed;
    }
#access {
            background-color:red;
            margin: 100px 0 0 100px;
    }
#main {
            background-color:blue;
            margin: 50px 0 0 50px;
            position:absolute;        
    }
#image {
       background-color:green;
}