Musisz wstawić i ten kod i ten kod ale pytanie czy masz pisane html'a i css'a w jednym pliku czy w oddzielnych i później importujesz w html'u css'a?
Jeśli piszesz wszystko w jednym pliku to powinieneś zroboć tak, że w sekcji head twojego szkieletu strony dodaj:
<style> *, *:after, *:before { box-sizing: border-box; margin: 0; padding: 0; } body { background: url(https://cdn.mediacru.sh/WkaUlplLEqUQ.jpg) fixed center black; font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', 'Helvetica', 'Arial', 'Lucida Grande', sans-serif; } @keyframes fade { from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } } .confirm { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80%; min-width: 280px; max-width: 500px; height: auto; background: #E2E2E2; border-radius: 10px; padding: 0; margin: 0; border-top: 1px solid white; animation: fade 1s ease 1 forwards; } .confirm h1 { text-align: center; font-size: 1.2rem; margin: 1.5rem 1rem 0.5rem; } .confirm p { text-align: center; font-size: 1rem; margin: 0 2rem 4.5rem; } .confirm button { background: transparent; border: none; color: #1678E5; height: 3rem; font-size: 1rem; width: 50%; position: absolute; bottom: 0; cursor: pointer; } .confirm button:nth-of-type(1) { border-top: 1px solid #B4B4B4; border-right: 1px solid #B4B4B4; left: 0; border-radius: 0 0 0 10px; } .confirm button:nth-of-type(2) { border-top: 1px solid #B4B4B4; right: 0; border-radius: 0 0 10px 0; } .confirm button:focus, .confirm button:hover { font-weight: bold; background: #EFEFEF; } .confirm button:active { background: #D6D6D6; } </style>
a w sekcji body:
<div class="confirm"> <h1>Confirm your action</h1> <p>Are you really <em>really</em> <strong>really</strong> sure that you want to exit this awesome application?</p> <button>Cancel</button> <button autofocus>Confirm</button> </div>
------
Dla sposobu drugiego, w którym masz oddzielny plik css'a zrób tak:
w sekcji head dodaj (ale pamiętaj że w tym "twój_plik.css" musisz wstawić ten dłuższy kod [ten css]):
<link rel="stylesheet" type="text/css" href="twój_plik.css">
a w sekcji body
Myślę, że chyba o to chodziło ?
93,456 zapytań
142,452 odpowiedzi
322,722 komentarzy
62,837 pasjonatów
Motyw:
Pajacyk od wielu lat dożywia dzieci. Pomóż klikając w zielony brzuszek na stronie. Dziękujemy! ♡
Oto polecana książka warta uwagi.Pełną listę książek znajdziesz tutaj