-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzadatak12prof.html
66 lines (55 loc) · 1.81 KB
/
zadatak12prof.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="hr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zadatak 12 - pseudo klase i pseudo elementi</title>
<style>
html, body {
font-family: Arial, Helvetica, sans-serif;
overflow-x: hidden;
}
body {
background-color: #ccc;
}
section {
box-sizing: border-box;
margin: 0 auto;
width: 25rem;
background: white;
padding: 30px;
padding-bottom: 60px;
}
.full-width {
position: relative;
margin: 0 -30px;
padding: .25rem 30px;
background: black;
color: white;
font-size: 1.125rem;
}
.full-width::before, .full-width::after {
content: "";
position: absolute;
top: 0;
bottom: 0;
width: 960px;
right: 100%;
background: red;
}
.full-width::after {
width: 960px;
left: 100%;
background-color: green;
}
</style>
</head>
<body>
<section>
<h2 class="full-width">Traka pune širine s pseudo elementima</h2>
<p>Koristeći pseudoelemente :before i :after, možemo proširiti prividnu pozadinu elementa h2 izvan <section> u kojem se nalazi.</p>
<p>Nažalost, ovo pokreće horizontalnu traku za pomicanje, tako da moramo postaviti i html i body elemente na overflow-x hidden.</p>
<p>Osim ako vam nije potrebna dodatna fleksibilnost oblikovanja obje strane (različite boje, visine, širine, gradijenti itd.), postoji jednostavniji pristup koji koristi negativne margine i ispune.</p>
</section>
</body>
</html>