Altjen B. Altjen B. - 1 month ago 5
ASP.NET (C#) Question

how to make a website go to full width and height in asp.net

I am trying to understand how to make a web page which will go in full height and width in asp.net. I know to use width: 100% for the background but I am not understanding how to change the width and height of other buttons, , and other stuff..

I search on google and youtube for that but I am not getting a good tutorial to explain how I should make it.

Should I use jquery or javascript? I'm trying to stay far from those at the moment.

Can any one please give me a simple explanation about this?

Answer

Best way to control ui styles, should be CSS.

For example, setting a element to full width and height

.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;
}
<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>

But it uses absolute position.

You could use something like this too.

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;
}
<div class="full_width">
  full width container
</div>

Comments