28172 sujets

CSS et mise en forme, CSS3

Bonjour à tous,
Je ne sais que dire de plus... je n'ai pas d'overflow vertical dans ma fenêtre modale.
Si vous pouviez jeter un œil sur les CSS, je vous les donne toutes (désolé) :
.cd-section {
  padding: 0;
  text-align: center;
  background-color: white;
}
.cd-section p {
  margin: 2em 0;
  line-height: 1.6;
  color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@media only screen and (min-width: 768px) {
  .cd-section {
    padding: 4em 10%;
  }
  .cd-section p {
    font-size: 1.8rem;
    line-height: 2;
  }
}
@media only screen and (min-width: 1170px) {
  .cd-section {
    padding: 4em 20%;
  }
}

.cd-modale {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  -webkit-transition: visibility 0s 0.3s, opacity 0.3s 0s, z-index 0s 0.3s;
  -moz-transition: visibility 0s 0.3s, opacity 0.3s 0s, z-index 0s 0.3s;
  transition: visibility 0s 0.3s, opacity 0.3s 0s, z-index 0s 0.3s;
}
.cd-modale::after {
  /* gradient overlay at bottom of modal window */
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 60px;
  pointer-events: none;
  background: transparent;
  background: -webkit-linear-gradient( bottom , #34383c, rgba(52, 56, 60, 0));
  background: linear-gradient(to top, #34383c, rgba(52, 56, 60, 0));
}
.cd-modale .cd-modale-content {
  height: 100%;
  width: 100%;
  padding: 3em 5%;
  text-align: left;
  overflow-y: vi;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.cd-modale p {
  color: #ffffff;
  line-height: 1.6;
  margin: 2em 0;
}
.modale-is-visible .cd-modale {
  z-index: 1;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  -webkit-transition: visibility 0s 0s, opacity 0.3s 0s, z-index 0s 0s;
  -moz-transition: visibility 0s 0s, opacity 0.3s 0s, z-index 0s 0s;
  transition: visibility 0s 0s, opacity 0.3s 0s, z-index 0s 0s;
}
.modale-is-visible .cd-modale .cd-modale-content {
  -webkit-overflow-scrolling: touch;
}
@media only screen and (min-width: 768px) {
  .cd-modale .cd-modale-content {
    padding: 4em 10%;
  }
}
@media only screen and (min-width: 1170px) {
  .cd-modale .cd-modale-content {
    padding: 6em 20%;
  }
  .cd-modale p {
    font-size: 2rem;
    line-height: 2;
  }
}

.cd-modale-action {
  position: relative;
}
.cd-modale-action .btn, .cd-modale-action .cd-modale-bg {
	display: inline-block;
	height: 4em;
	background-color: #0099CC;
}
.cd-modale-action .btn {
  width: 12.5em;
  color: #ffffff;
  line-height: 3em;
  white-space: nowrap;
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-transition: color 0.2s 0.3s, width 0.3s 0s;
  -moz-transition: color 0.2s 0.3s, width 0.3s 0s;
  transition: color 0.2s 0.3s, width 0.3s 0s;
}
.btn:hover {
    background-color: white;
    color: black;
	text-decoration: none !important;
}
.cd-modale-action .btn.to-circle {
  width: 4em;
  color: transparent;
  -webkit-transition: color 0.2s 0s, width 0.3s 0.2s;
  -moz-transition: color 0.2s 0s, width 0.3s 0.2s;
  transition: color 0.2s 0s, width 0.3s 0.2s;
}
.cd-modale-action .cd-modale-bg {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 0;
  width: 4em;
  border-radius: 50%;
  opacity: 0;
  visibility: hidden;
  -webkit-transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -o-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-transform: translateX(-2em);
  -moz-transform: translateX(-2em);
  -ms-transform: translateX(-2em);
  -o-transform: translateX(-2em);
  transform: translateX(-2em);
  -webkit-transition: visibility 0s 0.5s;
  -moz-transition: visibility 0s 0.5s;
  transition: visibility 0s 0.5s;
}
.cd-modale-action .cd-modale-bg.is-visible {
  opacity: 1;
  visibility: visible;
}

.cd-modale-close {
  position: fixed;
  z-index: 1;
  top: 20px;
  right: 5%;
  height: 50px;
  width: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3) url(../imgs/cd-icon-close.svg) no-repeat center center;
  /* image replacement */
  overflow: hidden;
  text-indent: 100%;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  -webkit-transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -o-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-transform: scale(0);
  -moz-transform: scale(0);
  -ms-transform: scale(0);
  -o-transform: scale(0);
  transform: scale(0);
  -webkit-transition: -webkit-transform 0.3s 0s, visibility 0s 0.3s, opacity 0.3s 0s;
  -moz-transition: -moz-transform 0.3s 0s, visibility 0s 0.3s, opacity 0.3s 0s;
  transition: transform 0.3s 0s, visibility 0s 0.3s, opacity 0.3s 0s;
}
.no-touch .cd-modale-close:hover {
  background-color: rgba(0, 0, 0, 0.5);
}
.modale-is-visible .cd-modale-close {
  visibility: visible;
  opacity: 1;
  -webkit-transition: -webkit-transform 0.3s 0s, visibility 0s 0s, opacity 0.3s 0s;
  -moz-transition: -moz-transform 0.3s 0s, visibility 0s 0s, opacity 0.3s 0s;
  transition: transform 0.3s 0s, visibility 0s 0s, opacity 0.3s 0s;
  -webkit-transform: scale(1);
  -moz-transform: scale(1);
  -ms-transform: scale(1);
  -o-transform: scale(1);
  transform: scale(1);
}
@media only screen and (min-width: 768px) {
  .cd-modale-close {
    top: 70px;
  }
}

J'ai aussi un problème de z-index sur cette modale, j'ai beau le mettre à 999999999999 (etc Smiley cligne le menu et un btn_up restent en premier plan.
C'était la question du jour Smiley lol
Merci à vous,
ED
Administrateur
Bonjour,

perso j'ai fini par reproduire le comportement de la modale de Bootstrap (4 ou 5) qui a l'avantage d'être déboguée suite à des dizaines d'issues… Un overflow-y suffit (une fois que tout le reste est implémenté).

z-index : il te faut remonter aux 2 éléments parents de chacun (modale d'une part, menu et bouton d'autre part) qui soient frères. C'est là que ça se joue. Le formatting context qui est établi là ne peut ensuite PAS être "écrasé" par un descendant.
Bonjour Felipe,
Merci beaucoup pour ton aide.
Ce code provient d'une démo, je ne connais rien à Bootstrap Smiley decu
Pour ce qui est du z-index, je comprends mal la notion de parents/frères. Enfin, je comprends la logique mais pas dans ce cas.
C'est dommage car la solution doit être là Smiley confused
Encore merci et bonne journée,
ED
Bonjour Felipe,
Bonne année !!!! Smiley cligne
J'ai maintenant Bootstrap5. Pour le z-index, il est bon mais le problème perdure.
Ci-dessous (toutes Smiley ohwell ) mes CSS :
.cd-section {
  padding: 0;
  text-align: center;
  background-color: black;
}
.cd-section p {
  margin: 2em 0;
  line-height: 1.6;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@media only screen and (min-width: 768px) {
  .cd-section {
    padding: 4em 10%;
  }
  .cd-section p {
    font-size: 1.8rem;
    line-height: 2;
  }
}
@media only screen and (min-width: 992px) {
  .cd-section {
    padding: 4em 20%;
  }
}
/* -------------------------------------- */
/* SECTION 6 - ME - CD MODAL */
.cd-modale {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  -webkit-transition: visibility 0s 0.3s, opacity 0.3s 0s, z-index 0s 0.3s;
  -moz-transition: visibility 0s 0.3s, opacity 0.3s 0s, z-index 0s 0.3s;
  transition: visibility 0s 0.3s, opacity 0.3s 0s, z-index 0s 0.3s;
}
.cd-modale .cd-modale-content {
  min-height: 100vh;
  padding: 3em 5%;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

}
.cd-modale p {
  color: #fff;
  line-height: 1.6;
  text-align: left;
  
}
.cd-modale h1 {
	font-size: 6vw;
	color: #fff;
	line-height: 1;
	text-align: left;
}
/* ------------ */
/* photos */
.cd-modale img.photodemoi { 
	width:100%;
	max-width:700px;
}
.cd-modale img.logo_lddc { 
	width:100%;
	max-width:500px;
	margin-top:20px;
}
/* -------------------------------------- */
.modale-is-visible .cd-modale {
	background: #008CBA; /* BLEU moyen */
	z-index:999 !important; 
	overflow-y:auto !important;
  -webkit-overflow-scrolling: touch;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  -webkit-transition: visibility 0s 0s, opacity 0.3s 0s, z-index 0s 0s;
  -moz-transition: visibility 0s 0s, opacity 0.3s 0s, z-index 0s 0s;
  transition: visibility 0s 0s, opacity 0.3s 0s, z-index 0s 0s;
}

@media only screen and (min-width: 768px) {
  .cd-modale .cd-modale-content {
    padding: 4em 10%;
  }
}
@media only screen and (min-width: 992px) {
  .cd-modale .cd-modale-content {
    padding: 6em 20%;
  }
  .cd-modale p {
    font-size: 2rem;
    line-height: 1;
  }
}

.cd-modale-action {
  position: relative;
}
.cd-modale-action .btn, .cd-modale-action .cd-modale-bg {
	display: inline-block;
	height: 4em;
	background-color: #008CBA; /* BLEU moyen */
	border-radius: 0;
}
.cd-modale-action .btn {
  width: 12.5em;
  line-height: 3em;
  white-space: nowrap;
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-transition: color 0.2s 0.3s, width 0.3s 0s;
  -moz-transition: color 0.2s 0.3s, width 0.3s 0s;
  transition: color 0.2s 0.3s, width 0.3s 0s;
  margin-bottom: 20px;
}

.cd-modale-action .btn.to-circle {
  width: 4em;
  color: transparent;
  -webkit-transition: color 0.2s 0s, width 0.3s 0.2s;
  -moz-transition: color 0.2s 0s, width 0.3s 0.2s;
  transition: color 0.2s 0s, width 0.3s 0.2s;
}
.cd-modale-action .cd-modale-bg {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 0;
  width: 4em;
  border-radius: 50%;
  opacity: 0;
  visibility: hidden;
  -webkit-transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -o-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-transform: translateX(-2em);
  -moz-transform: translateX(-2em);
  -ms-transform: translateX(-2em);
  -o-transform: translateX(-2em);
  transform: translateX(-2em);
  -webkit-transition: visibility 0s 0.5s;
  -moz-transition: visibility 0s 0.5s;
  transition: visibility 0s 0.5s;
}
.cd-modale-action .cd-modale-bg.is-visible {
  opacity: 1;
  visibility: visible;
}
/* ------------ */
.cd-modale-close {
  position: fixed;
  z-index: 1;
  top: 10px;
  right: 30px;
  height: 50px;
  width: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3) url(../imgs/cd-icon-close.svg) no-repeat center center;
  /* image replacement */
  overflow: hidden;
  text-indent: 100%;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  -webkit-transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -o-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-transform: scale(0);
  -moz-transform: scale(0);
  -ms-transform: scale(0);
  -o-transform: scale(0);
  transform: scale(0);
  -webkit-transition: -webkit-transform 0.3s 0s, visibility 0s 0.3s, opacity 0.3s 0s;
  -moz-transition: -moz-transform 0.3s 0s, visibility 0s 0.3s, opacity 0.3s 0s;
  transition: transform 0.3s 0s, visibility 0s 0.3s, opacity 0.3s 0s;
}
.no-touch .cd-modale-close:hover {
  background-color: rgba(0, 0, 0, 0.5);
}
.modale-is-visible .cd-modale-close {
  visibility: visible;
  opacity: 1;
  -webkit-transition: -webkit-transform 0.3s 0s, visibility 0s 0s, opacity 0.3s 0s;
  -moz-transition: -moz-transform 0.3s 0s, visibility 0s 0s, opacity 0.3s 0s;
  transition: transform 0.3s 0s, visibility 0s 0s, opacity 0.3s 0s;
  -webkit-transform: scale(1);
  -moz-transform: scale(1);
  -ms-transform: scale(1);
  -o-transform: scale(1);
  transform: scale(1);
}

As-tu une idée ?
Merci beaucoup et encore tous mes vœux,
ED
Hello,
Il suffisait de donner une hauteur à la modale (par défaut, elle est à 100%).
Bonne journée,
ED