如何使网站在asp.net中达到全宽和高度

时间:2016-10-25 17:43:50

标签: javascript jquery css asp.net

我正在尝试了解如何制作一个在asp.net中全高度和宽度的网页。我知道使用宽度:100%的背景,但我不明白如何更改其他按钮的宽度和高度,以及其他东西..

我在google和youtube上搜索但是我没有得到一个很好的教程来解释我应该如何制作它。

我应该使用jquery还是javascript?我正试图远离那些目前。

任何人都可以给我一个简单的解释吗?

2 个答案:

答案 0 :(得分:0)

为按钮使用不同的css容器类。对于前者;

.body{
width: 100%
}

button {
color: #666;
border-color: #EBEBEB;
background-color: #EBEBEB;
text-align: center;
height:200px;
width:200px;
}

然后使用按钮,

<button class="button">Button</button>

答案 1 :(得分:0)

控制ui样式的最佳方法应该是CSS。

例如,将元素设置为全宽和高度

&#13;
&#13;
foo-mode-map
&#13;
.full_width {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  }

.element_inside {
  width: 100px;
  border: 1px solid red;
}

.button_inside {
  width: 125px;
  height: 60px;
  line-height: 60px;
}
&#13;
&#13;
&#13;

但它使用绝对位置。

你也可以使用这样的东西。

&#13;
&#13;
<div class="full_width">
  I am full width element
  
  <div class="element_inside">
    Low width
  </div>
  
  <button class="button_inside">
    Button
  </button>
  
  <button style="width: 100%;">
    Button full width
  </button>
</div>
&#13;
html {
  display: table;
  width: 100%;
  min-height: 100%;
}

body {
  display: table-row;
}

.full_width {
  width: 250px;
  display: table-cell;
  vertical-align: top;
  min-height: 100%;
}

.full_width {
  border: 1px solid #f00;
}
&#13;
&#13;
&#13;

对于响应式布局和不同大小的屏幕,您可以使用以下代码:

<div class="full_width">
  full width container
</div>