Css does not work in firefox

0

I'm starting to study css for a certain need. I'm trying to develop a project for learning purposes, but css is crashing in firefox. I have the following html code:

  <!DOCTYPE html>
  <html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="style.css" type="text/css" media="all" />
    <title>Home</title>
  </head>
  <body>
      <div id="main-container" class="main-container">
        <p class="main-title">Drag and Drop mode are aviable</p>
        <input type="text" name="txtNome" id="txtNome" placeholder="Nome" class="input-text">
        <button id="btnAdicionar">Adicionar</button>
      </div>

     <div id="sub-container" class="sub-container">
  </body>
  </html>

CSS:

  body{
    background-color: #DFDFDF;
  }

  .main-container{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    margin-left: 40%;
    margin-top: 20%;

    width: 20%;
    padding: 20px;
    background-color: #4DB6AC;
    border-radius: 3px;
  }

  .main-title{
    color: #FFF;
    font-weight: lighter;
  }
  .input-text{
    border: 1px solid #E0E0E0;
    width: 30%;
    height: 3vh;
    font-size: 1em;
    margin-top: 15%;
  }
  .input-text:focus {
    border: 1px solid #E0E0E0;
    outline: 0;
  }

In the class .input-text I have a margin-top attribute: 15%, in google chrome this attribute is respected however in firefox the same is not respected and the margin is not assigned breaking my css.

    
asked by anonymous 24.11.2017 / 13:40

1 answer

0

The margin-top attribute is as a percentage, this means that it is relative to its parent element (in this case, the div # main-container).

Try placing a fixed value in pixels.

Remembering that the margin, when specified in percent, is relative to width of the parent element, see: CSS Margin .

    
24.11.2017 / 13:58