Welcome page in HTML

Asked

Viewed 740 times

2

Good.

Before developing a website in C# Asp.net I created a sketch on Wix. Only now I don’t know how to put the first page of this kind, that is, a small window (with the index behind it) before entering the site. Can anyone help? I have to create a new view?

  • Why not a popup? You use bootstrap?

  • A little work with this. How the popup works?

  • is a html which is opened as if it were a window, like the example you placed. Libraries/frameworks like boostratp, jQuery or Material general a modal popup, Already ready to use very easy. Here are some examples: https://getbootstrap.com/docs/4.0/components/modal/ and https://material.io/design/components/dialogs.html

1 answer

1


Dude I don’t know exactly what the structure you want etc is like, but here’s a very simple CSS that can help you. The principle here is that btn Close is actually a label linked in a input:radio that when checkadomakes the div downhill disappear with this CSS rule input[id="rd"]:checked + div.bg { }

Note that it has an animation that when entering the site takes 1 second for modal to appear. But if you want to take just remove the animation from the CSS, I left everything commented. Note also that when it is active you cannot select anything below, nor click anything (this for the layman).

I tried to make the model as simple as possible to make it easier to understand.

Take the example.

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
#rd {
  display: none;
}
input[id="rd"]:checked + div.bg {
  display: none;
  z-index: -1000;
  opacity: 0;
}
.bg {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  /* remover animação se quiser que ele aparece direto sem delay  */
  -webkit-animation: tempo 500ms ease-in 1s forwards;
          animation: tempo 500ms ease-in 1s forwards;
}
.box {
  background-color: red;
  width: 100px;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.box label {
  background-color: #fff;
  width: 50px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  display: inline-block;
  cursor: pointer;
}
/* remover se remover a animação do modal  */
@-webkit-keyframes tempo {
  to {
    opacity: 1;
  }
}
@keyframes tempo {
  to {
    opacity: 1;
  }
}
<!-- modal -->
<input type="radio" id="rd">
<div class="bg">
  <div class="box">
    <label for="rd">fechar</label>
  </div>
</div>
  
<!-- conteudo -->
<table border="1">
  <tr>
    <td>100px</td>
    <td>200px</td>
  </tr>
</table>
<input type="submit">
<input type="text">

  • @-Webkit-keyframes tempo { to { opacity: 1; } } @keyframes tempo { to { opacity: 1; } } these fields do not work if you put the "@"

  • @M.Career is actually a prefix "vendor" for animation to work on older browsers with -Webkit- Note on this link that there are still other variations like "@-Moz-keyframes" and "@-Moz-keyframes" https://css-tricks.com/snippets/css/keyframe-animation-syntax/

  • You have the option not to use the animation if it is not compatible with your project or some compiler is giving error because of @. In this case you take the @keyframes and when the user enters the site the modal will already be there instantly without delay, without the fadein...

  • I took it but it’s still not working, I don’t know why..

  • I can’t explain why it doesn’t work in your project. It could be because of the position, or maybe the order of the z-index... As I said this is a basic example. Maybe you can use the concept to apply in your view. Except animation has nothing ai of CSS other than crossbrowser etc.

  • already discovered.. is because of the "opacity"! Thank you @hugocsl!

  • 1

    Oops, good boy! I hope now to use the example. But if you don’t, there are several examples of modals out there, some more complex and with JS, others just with CSS as this humble example. But good luck there, when problem tells me that if it is of my reach I help you with CSS

Show 3 more comments

Browser other questions tagged

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