28172 sujets

CSS et mise en forme, CSS3

Bonjour à tous,
voici mon problème ... :

j'ai codé ma page html/css et mon client souhaite ce bout de code qui provient de codrops (demo 1) https://tympanus.net/Development/SVGImageHover/#

 <main>
<div class="content">
				<svg class="distort" width="350" height="450" viewBox="0 0 350 450">
					<filter id="distortionFilter">
						<feTurbulence type="turbulence" baseFrequency="0.07 0.01" numOctaves="5" seed="2" stitchTiles="stitch" x="0%" y="0%" width="500%" height="100%" result="noise"/>
						<feDisplacementMap in="SourceGraphic" in2="noise" scale="0" xChannelSelector="R" yChannelSelector="B" x="0%" y="0%" width="100%" height="100%" filterUnits="userSpaceOnUse"/>
					</filter>
					<g filter="url(#distortionFilter)">
						<image class="distort__img" x="50" y="50" xlink:href="img/1.jpg" height="350" width="250"/>
						<image class="distort__img" x="50" y="50" xlink:href="img/2.jpg" height="350" width="250"/>
						<image class="distort__img" x="50" y="50" xlink:href="img/3.jpg" height="350" width="250"/>
						<image class="distort__img" x="50" y="50" xlink:href="img/4.jpg" height="350" width="250"/>
					</g>
				</svg>
				<nav class="menu">
					<a href="#" class="menu__link">Shanghai</a>
					<a href="#" class="menu__link">Taipei</a>
					<a href="#" class="menu__link">Bangkok</a>
					<a href="#" class="menu__link">Kyoto</a>
				</nav>
			</div></main>


article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}audio,canvas,video{display:inline-block;}audio:not([controls]){display:none;height:0;}[hidden]{display:none;}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body{margin:0;}a:focus{outline:thin dotted;}a:active,a:hover{outline:0;}h1{font-size:2em;margin:0.67em 0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}pre{white-space:pre-wrap;}q{quotes:"\201C" "\201D" "\2018" "\2019";}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:0;}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend{border:0;padding:0;}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;}button,input{line-height:normal;}button,select{text-transform:none;}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0;}
*,
*::after,
*::before {
	box-sizing: border-box;
}

:root {
	font-size: 14px;
}

body {
    overflow-x: hidden;
	--color-text: #272222;
	--color-bg: #faf6f1;
	--color-link: #e2af68;
	--color-link-hover: #333;
	--color-content-link: #000;
	--color-content-link-hover: #000;
	--color-heading: #d1cfcf;
	--font-content: Cardo;
	color: var(--color-text);
	background-color: var(--color-bg);
	font-family: Futura, 'Nunito Sans', sans-serif;
}

.demo-2 {
	--color-text: #faf6f1;
    --color-bg: #191817;
    --color-link: #c3846e;
    --color-link-hover: #fff;
    --color-content-link: #FAF6F1;
    --color-content-link-hover: #FAF6F1;
    --color-heading: #4c4742;
    --font-content: 'Antic Didone';
}

.demo-3 {
	--color-text: #191a1b;
    --color-bg: #c5a98a;
    --color-link: #3c49b2;
    --color-link-hover: #191b1b;
    --color-content-text: #191b1b;
    --color-content-link: #191b1b;
    --color-content-link-hover: #191b1b;
   	--color-content-secondary: #9f8465;
    --font-content: Prata;
}

/* Page Loader */
.js .loading::before {
	content: '';
	position: fixed;
	z-index: 100000;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: var(--color-bg);
}

.js .loading::after {
	content: '';
	position: fixed;
	z-index: 100000;
	top: 50%;
	left: 50%;
	width: 60px;
	height: 60px;
	margin: -30px 0 0 -30px;
	pointer-events: none;
	border-radius: 50%;
	opacity: 0.4;
	background: var(--color-link);
	animation: loaderAnim 0.7s linear infinite alternate forwards;
}

@keyframes loaderAnim {
	to {
		opacity: 1;
		transform: scale3d(0.5,0.5,1);
	}
}

a {
	text-decoration: none;
	color: var(--color-link);
	outline: none;
}

a:hover,
a:focus {
	color: var(--color-link-hover);
	outline: none;
}

.message {
	background: var(--color-text);
	color: var(--color-bg);
	padding: 1rem;
	text-align: center;
}

.frame {
	padding: 3rem 5vw;
	text-align: center;
	position: relative;
	z-index: 1000;
}

.frame__title {
	font-size: 1rem;
	margin: 0 0 1rem;
	font-weight: normal;
}

.frame__links {
	display: inline;
}

.frame__links a:not(:last-child),
.frame__demos a:not(:last-child) {
	margin-right: 1rem;
}

.frame__links a:not(:last-child)::after {
	content: '|';
	margin: 0 0 0 1rem;
}

.frame__links a:hover:not(:last-child)::after {
	color: var(--color-link);
}

.frame__demos {
	margin: 1rem 0;
}

.frame__demo--current,
.frame__demo--current:hover {
	color: var(--color-text);
	text-decoration: line-through;
}

.frame__heading {
	font-weight: normal;
	margin: 0;
	color: var(--color-heading);
}

.frame__text + .frame__heading {
	margin: 2rem 0 0 0;
}

.frame__text + .frame__text {
	display: block;
}

.frame__photography {
	color: var(--color-heading);
}

.content {
	display: flex;
	flex-direction: column;
	/*width: 100vw; 
	height: calc(100vh - 13rem);*/
	position: relative;
	justify-content: flex-start;
	align-items: center;
}

.distort {
	position: absolute;
	pointer-events: none;
	will-change: transform;
}

.distort__img {
	opacity: 0;
}

.content {
	font-family: var(--font-content), serif;
	color: var(--color-content-text);
}

.menu {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	text-align: center;
	font-size: 10vh;
	font-weight: normal;
}

.demo-2 .menu {
	line-height: 1.5;
}

.quote {
	display: block;
	width: 90%;
	max-width: 1200px;
	margin: 0 auto;
	font-size: 2rem;
	z-index: 999;
	font-weight: normal;
}

.quote__author {
	margin: 2rem 0 0 0;
	display: block;
	font-size: 1rem;
	color: var(--color-content-secondary);
}

.quote__author::before {
	content: '\2014';
	margin-right: 1rem;
}

.menu__link,
.quote__link {
	z-index: 999;
	color: var(--color-content-link);
	position: relative;
	white-space: nowrap;
}

.menu__link:hover,
.quote__link:hover {
	color: var(--color-content-link-hover);
}

.menu__link span,
.quote__link span {
	display: inline-block;
}

.quote__link::after {
	content: '';
	position: absolute;
	height: 5px;
	border-width: 1px 0;
	border-style: solid;
	width: 100%;
	left: 0;
	top: calc(100% - 0.25rem);
	border-color: currentColor;
}



	.message {
		display: none;
	}
	.frame {
		position: fixed;
		text-align: left;
		z-index: 10000;
		top: 0;
		left: 0;
		display: grid;
		align-content: space-between;
		width: 100%;
		max-width: none;
		height: 100vh;
		padding: 2rem;
		pointer-events: none;
		grid-template-columns: 20% 80%;
		grid-template-rows: 2rem auto auto;
		grid-template-areas: 'credits demos'
							 'credits photography'
							 'contact title';
	}
	.frame__title-wrap {
		grid-area: title;
		display: flex;
		justify-content: flex-end;
		align-self: end;
	}
	.frame__title {
		margin: 0 2rem 0 0;
	}
	.frame__photography {
		grid-area: photography;
		align-self: center;
		justify-self: end;
		writing-mode: vertical-lr;
	}
	.frame__credits {
		grid-area: credits;
	}
	.frame__contact {
		grid-area: contact;
	}
	.frame__demos {
		margin: 0;
		grid-area: demos;
		justify-self: end;
	}
	.frame a {
		pointer-events: auto;
	}
	.content {
		height: 100vh;
		justify-content: center;
	}
	.quote {
		font-size: 9vh;
	}
	.quote__author {
		font-size: 2.5vh;
	}
	.quote__link::after {
		top: calc(100% - 1vh);
	}
}


Lorsque je place ce code avant ma section <!-- A PROPOS --> (disponible ci dessous) les images sont plus ou moins bien placées derrière les liens, et dès que je déplace ce code sous ma section A propos les images se décalent d'un coup hors de la fenêtre, bien trop bas. J'ai modifié quelques trucs dans le css, comme overflow: hidden par overflow-x:hidden, pour pouvoir scroller a nouveau. Mais je n'ai rien touché qui concerne l'emplacement des images... je crois que ça a peut être à voir avec "transform/translateX" ce sont des infos qui apparaissent dans "inspecter" mais pas dans mes fiches html/css...?

Voici les deux codes ensemble a la suite tels qu'ils sont dans mon fichier :

<section class="container-fluid description mb-5">
    <div class="container marginsection">
    <h2>Bonjour,<br> Vincent Le Pottier. <br> 1m79, 73 kg, <br> designer graphique.</h2>
    
    </div>
    </section>


Voici du coup ma construction :

<!DOCTYPE html>

<html>
    <head>
        <meta charset="utf-8">
    <title></title>
        
        <!-- CSS -->
        
        
              <link rel="stylesheet" type="text/css" href="css/base.css" />
    <link href="css/bootstrap.min.css" rel="stylesheet">
         <link href="css/styles.css" rel="stylesheet">

       <!-- CSS -->
        
        
    </head>
    
<body>
    
    
       <!-- A PROPOS -->
   <section class="container-fluid description mb-5">
    <div class="container marginsection">
    <h2>A PROPOS</h2>
    
    </div>
    </section>
      <!-- FIN A PROPOS -->
    
    <main>
<div class="content">
				<svg class="distort" width="350" height="450" viewBox="0 0 350 450">
					<filter id="distortionFilter">
						<feTurbulence type="turbulence" baseFrequency="0.07 0.01" numOctaves="5" seed="2" stitchTiles="stitch" x="0%" y="0%" width="500%" height="100%" result="noise"/>
						<feDisplacementMap in="SourceGraphic" in2="noise" scale="0" xChannelSelector="R" yChannelSelector="B" x="0%" y="0%" width="100%" height="100%" filterUnits="userSpaceOnUse"/>
					</filter>
					<g filter="url(#distortionFilter)">
						<image class="distort__img" x="50" y="50" xlink:href="img/1.jpg" height="350" width="250"/>
						<image class="distort__img" x="50" y="50" xlink:href="img/2.jpg" height="350" width="250"/>
						<image class="distort__img" x="50" y="50" xlink:href="img/3.jpg" height="350" width="250"/>
						<image class="distort__img" x="50" y="50" xlink:href="img/4.jpg" height="350" width="250"/>
					</g>
				</svg>
				<nav class="menu">
					<a href="#" class="menu__link">Shanghai</a>
					<a href="#" class="menu__link">Taipei</a>
					<a href="#" class="menu__link">Bangkok</a>
					<a href="#" class="menu__link">Kyoto</a>
				</nav>
			</div></main>


Merci d'avance, j'y suis depuis cette après midi je comprend pas...