由于HTML5 ASP.net中的DOCTYPE,100%高度无法正常工作

时间:2022-04-16 08:27:50

I am trying to make a Asp.net website, The homepage design is a single page portfolio style; by having each or "projects" as 100% height of the view port underneath each other allowing me to use anchor tags. My problem is that when I am using the tag it messes up my css and does not work properly so how can I fix this?

我正在尝试建立一个Asp.net网站,主页设计是单页组合风格;通过将每个或“项目”作为视图端口的100%高度在彼此之下允许我使用锚标签。我的问题是,当我使用标签时,它会弄乱我的CSS并且无法正常工作,所以我该如何解决这个问题呢?

I have tried the following:

我尝试过以下方法:

/* in CSS*/
html, body{
height:100%;
width:100%;
}

And I have added the height 100% tag to each of the parent divs and or elements of the divs I want to be 100% but still no luck. I am out of options! I can't post the full code because it is way to long and I am on a different computer to my one with code.

我已经为每个父div和/或div的元素添加了高度100%标签我想要100%但仍然没有运气。我没有选择!我无法发布完整的代码,因为它是很长的方式,我在与我的代码不同的计算机上。

1 个解决方案

#1


1  

I think I understand what you're asking, but I'm not completely sure, nor am I sure where the DOCTYPE, anchors or ASP.NET come into play.

我想我理解你在问什么,但我不完全确定,也不确定DOCTYPE,锚点或ASP.NET在哪里发挥作用。

Here's a demo of a full page document, with a few full screen child divs.

这是一个完整页面文档的演示,带有一些全屏子div。

html,
body {
  height: 100%;
  width: 100%;
}

body {
  overflow: auto;
}

div {
  width: 100%;
  height: 100%;
}

Please keep in mind that percentage heights can become a headache really fast, so you need to understand exactly what you are doing.

请记住,百分比高度可能会变得非常快,所以你需要准确理解你在做什么。

Also note, this page is running Normalize.css which fixes browser discrepancies.

另请注意,此页面正在运行Normalize.css,它修复了浏览器差异。

#1


1  

I think I understand what you're asking, but I'm not completely sure, nor am I sure where the DOCTYPE, anchors or ASP.NET come into play.

我想我理解你在问什么,但我不完全确定,也不确定DOCTYPE,锚点或ASP.NET在哪里发挥作用。

Here's a demo of a full page document, with a few full screen child divs.

这是一个完整页面文档的演示,带有一些全屏子div。

html,
body {
  height: 100%;
  width: 100%;
}

body {
  overflow: auto;
}

div {
  width: 100%;
  height: 100%;
}

Please keep in mind that percentage heights can become a headache really fast, so you need to understand exactly what you are doing.

请记住,百分比高度可能会变得非常快,所以你需要准确理解你在做什么。

Also note, this page is running Normalize.css which fixes browser discrepancies.

另请注意,此页面正在运行Normalize.css,它修复了浏览器差异。