Adjust CSS on browser-independent page

Asked

Viewed 53 times

0

I have a function on one page (Asp.net) that calls another as a popup:

Btnfinalizar.Onclientclick = "javascript:Exibirpopupmobile('/Shoppingcart/Formulario.aspx', 900,580); Return false;";

Using Chrome is coming right, centered on the page, more if using Firefox is different, is being applied to a div that controls all ID="colorbox"

How could I set a browser-independent default value

element.style {
    display: block;
    visibility: visible;
    top: 42px;
    left: 502px;
    position: fixed;
    width: 900px;
    height: 580px;
    overflow: hidden;
}

1 answer

0

if all you want is to center the element on the page, then a value in px to the top and the left is not the best option.

then try to use the following css: top: 50%; left: 50%; transform: translate(-50%, -50%);

.centro {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

html, body {
  position: fixed;
  width: 100%;
  height: 100%;
  background-color: whitesmoke;
  padding: 0px;
  margin: 0px;
}

.bloco {
  background-color: white;
  box-shadow: 0px 0px 10px black;
  width: 240px;
  height: 180px;
  border-radius: 5px;
}
<div class="bloco centro">
</div>

  • Friend, very grateful for your contribution!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.