How to do "position: Fixed;" on top of everything?

Asked

Viewed 1,604 times

3

I need to put a fixed div at the top of the screen (until then, just use the position: fixed), but not superimposed by other Ivs and images. It has to be on top of everything.

"Organizing":

<html>
<head>
[brain]
</head>
<body>
<div class="a div que precisa estar no topo, fixa e por cima de tudo"></div>
[resto do site, que quando há scroll, sobrepõe a div acima]
</body>
</html>

CSS:

 .beta-info {
    background: #fff;
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #FF016D;
    position: fixed;
   }
<div id="site">
  
<div class="beta-info">O SITE ESTÁ EM FASE BETA, BUGS SÃO COMUNS!</div>
[resto do site, sobrepõe a div acima]

</div>

1 answer

5


Put a z-index on it, larger than any of its z-index elements.

  • That’s right, but it would be nice to include an example. And I recommend using a high value for the z-index, because other elements without explicit z-index have a z-index implicit.

  • I was going to post an example but besides being something very simple is very unpleasant codar on the mobile inside the train rs.

  • Include the example later then, because I’m sure there will be people wanting to have your answer deleted because it’s too short/too simple. And good riddance! :)

  • 1

    ôxente, Danylo, you’re on the train, you signed up at [pt.so], you responded and you’ve already earned 15 points, ¡Olé!

  • I did it, thank you. The result is on this link: http://centerload.partica.com/

Browser other questions tagged

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