Website koji ćemo napraviti: vidi LIVE . Preuzmite website besplatno i koristi bez obveze DOWNLOAD.
U novom fajlu “index.html” pohranimo Bootstrap Starter Template. U starter templejtu učitali smo neophodne JS i CSS kodove.
<!doctype html> <html lang="hr"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <title>Turistička Agencija!</title> <style> </style> </head> <body> <h1>Hello, world!</h1> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"> </script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"> </script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"> </script> </body> </html>
Sekcija: Osnovna CSS pravila
Definirajmo osnovna CSS pravila za našu temu:
h1 { text-shadow: 3px 2px 9px rgba(0, 0, 0, 0.61); } h2 { font-size: 2.5rem; font-weight: 300; padding-bottom: 80px; } h2, p { color: #5b5f6b !important; } section { padding-top: 100px; padding-bottom: 100px; }
U ovom dijelu ćemo izmjeniti dafaultni prikaz btn-primary gumba.
.btn-primary { background-color: rgb(6, 105, 109); border: rgb(59, 188, 192); } .btn-primary:hover, .btn-primary:active { background-color: rgb(38, 156, 160); border: rgb(59, 188, 192); } .btn-primary:not(:disabled):not(.disabled).active, .btn-primary:not(:disabled):not(.disabled):active, .show>.btn-primary.dropdown-toggle { color: #fff; background-color: rgb(38, 156, 160); border: rgb(59, 188, 192); }
U našoj temi koristimo font Pacifico koji smo preuzali sa fonts.google.com. Kako bi mogli upotrebljavati ovaj font na našoj stranici moramo ga prvobitno učitati dodavajući ovaj code između <head> </head> elementa.
<link href=”https://fonts.googleapis.com/css2?family=Pacifico&display=swap” rel=”stylesheet”>
Odjeljak: Navigacija
Koristimo svijetlu bootstrap navigaciju . Gumb, button je hamburger element koji se pojavljuje na malim ekranima, i omogućava otvaranje navigacionog panela.
<div class="collapse navbar-collapse justify-content-md-center" id="navbarsExample10"> <ul class="navbar-nav"> <li class="nav-item active"> <a class="nav-link" href="#o-nama">O nama</a> </li> <li class="nav-item"> <a class="nav-link" href="#ponuda">Ponuda</a> </li> <li class="nav-item"> <a class="nav-link" href="#kontakt">Kontakt</a> </li> </ul> </div>
.nav-item a:link, .nav-item a:visited, .nav-item a:active { margin-left: 1.5rem; font-size: 1.5rem; font-family: 'Pacifico', cursive; color: #009c87 !important; } .nav-item a:hover { color: #11b39d !important; text-decoration: underline; }
Odjeljak: Jumbotron
Meni smo smjestili unutar Jumbotrona kako bi navigacija bila iznad slike koju koristimo za Jumbotron.
<div class="jumbotron text-center"> <nav class="navbar navbar-expand-lg navbar-light rounded"> ... </nav> <div class="container "> <div class="row justify-content-center jumbtext"> <h1 class="display-2 mb-4 text-white pb-5">Turistička agencija</h1> <div class="col-12 col-md-8"> <p class="tour-text"> Lorem, ipsum dolor sit amet consectetur adipisicing elit. Praesentium ipsum corporis porro nam cumque perferendis officia dignissimos! Blanditiis, nostrum, dicta deleniti, vel neque iusto laudantium molestiae tempora ab eum praesentium? </p> </div> </div> <div class="row justify-content-center"> <p> <a href="ponuda" class="btn btn-primary btn-lg mt-5 my-3 mx-2 px-4 shadow-lg">PONUDA</a> </p> </div> </div> </div>
.jumbotron { background-image: url(http://mozak.org/img-bt-sites/more.png); background-position: top right; background-repeat: no-repeat; background-size: cover; padding-top: 30px; min-height: 700px; background-color: rgb(6, 105, 109); margin-top: 100px; margin-bottom: 100px; }
Odjeljak: O nama
<section id="o-nama"> <div class="container"> <div class="row text-center justify-content-center"> <div class="col-12"> <h2>O Nama</h2> </div> <div class="col-12 col-md-6 "> <p class="lead">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Perspiciatis voluptate beatae tenetur maxime, sint excepturi quo totam vitae atque, voluptatum quaerat reiciendis animi suscipit veniam optio consequatur distinctio. Nemo, pariatur! </p> </div> </div> </div> </section>
Sekcija: Ponuda
Za kreiranje panela ponude koristili smo Bootstrap kartice. Svaki od njih ima definiran donji razmak pb-5, što pomaže kod mobilnog prikaza. Kartični elementi su skladišteni u kolone čija je veličina definirana sa col-12 col-md-6 col-lg-4. Na ovaj način kod malih ekrana jedna ponuda zauzima 100% širine ekrana. Kod srednjih ekrana imamo 2 ponude u redu, a kod velikih ekrana 4 ponude u jednome redu.
<div class="col-12 col-md-6 col-lg-4 text-center pb-5 "> <div class="card mx-5 border-0"> <img src="http://mozak.org/img-bt-sites/nyc.png" class="card-img-top" alt="NYC"> <div class="card-body"> <h5 class="card-title">NYC</h5> <a href="https://mozak.org/napravite-sajt-za-turisticku-agenciju/" class="btn btn-primary bg-blue px-5">Vidi</a> </div> </div> </div>
Efekat povećavanja ponude na klik postigli smo sledećim CSS pravilom.
.card:hover{ transform: scale(1.03); }
Sekcija: Kontakt
Bootstrap posjeduje predefinisane izglede za html forme kao i klase koje pomažu prilikom upravljanja sa njima (BT forme). Klasa form-row omogućava nam da forme raspoređujemo pomoću standardnih bootstrap kolona.
Sekcija: Footer
U footeru imamo jednu cover sliku. Kako bi tekst nad njom bio vidljiv obojili smo ga korištenjem izvorne bootstrap klase text-white.
<footer> <div class="container"> <div class="row"> <div class="col-4"> <h3 class="text-white">O nama</h3> <p class="text-white">Fugiat reprehenderit nostrum unde corporis voluptatem in vel dolor commodi a, sit impedit ratione porro praesentium possimus laudantium voluptatibus totam quis? Dolorem!</p> </div> <div class="col-4"> <h3 class="text-white">Menu</h3> <div class=" navbar-nav"> <a class="p-1 text-white" href="#o-nama">O nama</a> <a class="p-1 text-white" href="#ponuda">Ponuda</a> <a class="p-1 text-white" href="#kontakt">Kontakt</a> </div> </div> <div class="col-4"> <h3 class="text-white">Kontakt</h3> <p class="text-white"> Ulica: Lorem Ipsum Dolor</p> <p class="text-white"> Tel: +123-456-789</p> <p class="text-white"> Email: info@turisticka-angcja.com</p> </div> </div> </div> </footer>
footer { background-image: url(http://mozak.org/img-bt-sites/more-footer.png); background-position: top; background-repeat: no-repeat; background-size: cover; padding-top: 70px; padding-bottom: 30px; background-color: rgb(6, 105, 109); } footer h3 { padding-bottom: 30px; font-family: 'Pacifico', cursive; }
Ovo je bio primjer toka izrade web stranice korištenjem Bootstrap framework-a. Detaljan opis svih bootstrap elemenata pronađite u bootstrap dokumentaciji.
Hvala na čitanju.