|
1 | 1 | body {
|
2 |
| - background-color: #f9f9f9; /* Sets the background color of the body element to a light gray */ |
3 |
| - font-family: Arial, sans-serif; /* Sets the font family of the text inside the body to Arial or a generic sans-serif font */ |
4 |
| - font-size: 16px; /* Sets the font size of the text inside the body to 16 pixels */ |
5 |
| - line-height: 1.6; /* Sets the line height of the text inside the body to 1.6 times the font size */ |
6 |
| - color: #333; /* Sets the color of the text inside the body to a dark gray */ |
| 2 | + background-color: #f9f9f9; |
| 3 | + font-family: Arial, Helvetica, sans-serif; |
| 4 | + line-height: 1.6; |
| 5 | + margin: 0; |
7 | 6 | }
|
8 | 7 |
|
9 | 8 | h1 {
|
10 |
| - font-size: 36px; /* Sets the font size of the h1 heading to 36 pixels */ |
11 |
| - font-weight: bold; /* Makes the h1 heading bold */ |
12 |
| - text-align: center; /* Centers the h1 heading horizontally within its container */ |
13 |
| - margin-top: 40px; /* Adds a top margin of 40 pixels to the h1 heading */ |
14 |
| - margin-bottom: 60px; /* Adds a bottom margin of 60 pixels to the h1 heading */ |
| 9 | + font-size: 36px; |
| 10 | + font-weight: bold; |
| 11 | + text-align: center; |
| 12 | + margin-top: 40px; |
| 13 | + margin-bottom: 60px; |
15 | 14 | }
|
16 | 15 |
|
17 |
| -#search-form { |
18 |
| - display: flex; /* Set the display property of the element to flex */ |
19 |
| - justify-content: center; /* Center the child elements horizontally */ |
20 |
| - align-items: center; /* Center the child elements vertically */ |
21 |
| - margin-bottom: 60px; /* Add a bottom margin of 60 pixels to the element */ |
| 16 | +form { |
| 17 | + display: flex; |
| 18 | + justify-content: center; |
| 19 | + align-items: center; |
| 20 | + margin-bottom: 60px; |
22 | 21 | }
|
23 | 22 |
|
24 | 23 | #search-input {
|
25 |
| - width: 60%; /* Set the width of the element to 60% of its container */ |
26 |
| - max-width: 400px; /* Set the maximum width of the element to 400 pixels */ |
27 |
| - padding: 10px 20px; /* Add 10 pixels of padding to the top and bottom and 20 pixels of padding to the left and right of the element */ |
28 |
| - border: none; /* Remove the border from the element */ |
29 |
| - border-radius: 5px; /* Add a 5-pixel radius to the element's border corners */ |
30 |
| - box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2); /* Add a 5-pixel box shadow to the element */ |
31 |
| - font-size: 18px; /* Set the font size of the element to 18 pixels */ |
32 |
| - color: #333; /* Set the text color of the element to #333 */ |
| 24 | + width: 60%; |
| 25 | + max-width: 400px; |
| 26 | + padding: 10px 20px; |
| 27 | + border: none; |
| 28 | + box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); |
| 29 | + border-radius: 5px; |
| 30 | + font-size: 18px; |
| 31 | + color: #333; |
33 | 32 | }
|
34 | 33 |
|
35 | 34 | #search-button {
|
36 |
| - padding: 10px 20px; /* Sets the padding of the button */ |
37 |
| - background-color: #4caf50; /* Sets the background color of the button */ |
38 |
| - color: white; /* Sets the text color of the button */ |
39 |
| - font-size: 18px; /* Sets the font size of the button text */ |
40 |
| - border: none; /* Removes the border of the button */ |
41 |
| - border-radius: 5px; /* Sets the border radius of the button */ |
42 |
| - box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2); /* Sets the box shadow of the button */ |
43 |
| - cursor: pointer; /* Changes the cursor to pointer when hovering over the button */ |
44 |
| - transition: background-color 0.3s ease-in-out; /* Sets the transition effect when the background color changes */ |
| 35 | + padding: 10px 20px; |
| 36 | + background-color: #4caf50; |
| 37 | + color: white; |
| 38 | + border: none; |
| 39 | + font-size: 18px; |
| 40 | + box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); |
| 41 | + cursor: pointer; |
| 42 | + border-radius: 5px; |
| 43 | + transition: background-color 0.3s ease-in-out; |
45 | 44 | }
|
46 | 45 |
|
47 | 46 | #search-button:hover {
|
48 |
| - background-color: #3e8e41; /* Changes the background color when hovering over the button */ |
| 47 | + background-color: #3e8e41; |
49 | 48 | }
|
50 | 49 |
|
51 |
| -#search-results { |
52 |
| - display: flex; /* sets the display type of the element to flex*/ |
53 |
| - flex-wrap: wrap; /* allows the flex items to wrap to multiple lines*/ |
54 |
| - justify-content: space-between; /* aligns the flex items along the main axis with equal spacing between them*/ |
55 |
| - margin: 0 auto; /* sets the top and bottom margins to 0 and the left and right margins to auto*/ |
56 |
| - max-width: 1200px; /* sets the maximum width of the element to 1200 pixels*/ |
| 50 | +.search-results { |
| 51 | + display: flex; |
| 52 | + flex-wrap: wrap; |
| 53 | + justify-content: space-between; |
| 54 | + max-width: 1200px; |
| 55 | + margin: 0 auto; |
| 56 | + padding: 20px; |
57 | 57 | }
|
58 | 58 |
|
59 |
| -/* Sets the styles for an individual search result element */ |
60 | 59 | .search-result {
|
61 |
| - /* Adds 60px margin to the bottom of each search result element */ |
62 | 60 | margin-bottom: 60px;
|
63 |
| - |
64 |
| - /* Sets the width of the search result element to 30% of the parent container */ |
65 | 61 | width: 30%;
|
66 |
| - |
67 |
| - /* Adds rounded corners to the search result element */ |
68 | 62 | border-radius: 5px;
|
69 |
| - |
70 |
| - /* Adds a box shadow to the search result element */ |
71 |
| - box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2); |
72 |
| - |
73 |
| - /* Hides any content that overflows the search result element */ |
| 63 | + box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); |
74 | 64 | overflow: hidden;
|
75 | 65 | }
|
76 | 66 |
|
| 67 | +.search-result:hover img { |
| 68 | + transform: scale(1.05); |
| 69 | +} |
| 70 | + |
77 | 71 | .search-result img {
|
78 |
| - /* Sets the width of the image to 100% of its container element */ |
79 | 72 | width: 100%;
|
80 |
| - |
81 |
| - /* Sets the height of the image to 200 pixels */ |
82 | 73 | height: 200px;
|
83 |
| - |
84 |
| - /* Determines how the image should be resized to cover its container without distorting its aspect ratio */ |
85 | 74 | object-fit: cover;
|
86 |
| - |
87 |
| - /* Specifies that any changes to the transform property of the image should be transitioned over a duration of 0.3 seconds with an easing function */ |
88 | 75 | transition: transform 0.3s ease-in-out;
|
89 | 76 | }
|
90 |
| - |
91 |
| -.search-result:hover img { |
92 |
| - transform: scale(1.05); |
93 |
| - /* The transform property scales the image by 1.05, making it 5% larger than its original size. This creates a zoom effect when the user hovers over the image. */ |
94 |
| -} |
95 |
| - |
96 | 77 | .search-result a {
|
97 |
| - display: block; /* sets the display type to block */ |
98 |
| - padding: 10px; /* adds padding to the top and bottom of the element */ |
99 |
| - color: #333; /* sets the text color to dark gray */ |
100 |
| - text-decoration: none; /* removes any text decoration */ |
101 |
| - transition: background-color 0.3s ease-in-out; /* sets a transition effect when the background color changes */ |
| 78 | + padding: 10px; |
| 79 | + display: block; |
| 80 | + color: #333; |
| 81 | + text-decoration: none; |
| 82 | + transition: background-color 0.3s ease-in-out; |
102 | 83 | }
|
103 | 84 |
|
104 |
| -.search-result a:hover { |
105 |
| - background-color: rgba( |
106 |
| - 0, |
107 |
| - 0, |
108 |
| - 0, |
109 |
| - 0.1 |
110 |
| - ); /* changes the background color to a light gray when the element is hovered over */ |
| 85 | +.search-result:hover a { |
| 86 | + background-color: rgba(0, 0, 0, 0.1); |
111 | 87 | }
|
112 | 88 |
|
113 | 89 | #show-more-button {
|
114 |
| - background-color: #008cba; /* Sets the background color of the button to a shade of blue */ |
115 |
| - border: none; /* Removes the border around the button */ |
116 |
| - color: white; /* Sets the font color of the button text to white */ |
117 |
| - padding: 10px 20px; /* Sets the padding of the button to 10px on the top and bottom, and 20px on the left and right */ |
118 |
| - text-align: center; /* Centers the button text horizontally */ |
119 |
| - text-decoration: none; /* Removes any text decoration such as underlining */ |
120 |
| - display: inline-block; /* Displays the button as an inline-level block container */ |
121 |
| - font-size: 16px; /* Sets the font size of the button text to 16px */ |
122 |
| - border-radius: 5px; /* Rounds the corners of the button to 5px */ |
123 |
| - margin-top: 20px; /* Adds a 20px margin on the top of the button */ |
124 |
| - transition: background-color 0.3s ease; /* Specifies a transition effect for the background color when hovering over the button */ |
125 |
| - display: none; /* Hides the button */ |
126 |
| - margin: 0 auto; /* Centers the button horizontally */ |
127 |
| - margin-bottom: 40px; /* Adds a 40px margin on the bottom of the button */ |
128 |
| - cursor: pointer; /* Sets the cursor to a pointer when hovering over the button */ |
| 90 | + background-color: #008cba; |
| 91 | + border: none; |
| 92 | + color: white; |
| 93 | + padding: 10px 20px; |
| 94 | + display: block; |
| 95 | + margin: 20px auto; |
| 96 | + text-align: center; |
| 97 | + border-radius: 5px; |
| 98 | + cursor: pointer; |
| 99 | + transition: background-color 0.3s ease-in-out; |
| 100 | + display: none; |
129 | 101 | }
|
130 | 102 |
|
131 | 103 | #show-more-button:hover {
|
132 |
| - background-color: #0077b5; /* Changes the background color of the button to a darker shade of blue when hovering over it */ |
| 104 | + background-color: #0077b5; |
133 | 105 | }
|
134 | 106 |
|
135 |
| -/* This is a CSS media query, which applies different styles based on the size of the screen. |
136 |
| -
|
137 |
| -The first media query applies when the screen width is a maximum of 768px. In this case, it changes the justify-content property of #search-results to center the search results horizontally. It also changes the width of .search-result to 45%. |
138 |
| -
|
139 |
| -The second media query applies when the screen width is a maximum of 480px. In this case, it changes the flex-direction property of #search-form to column, which stacks the search input and button vertically. It also adds a margin bottom to #search-input and changes the width of .search-result to 100%, making each search result take up the full width of the screen. */ |
140 |
| - |
141 |
| -/* The following styles will apply when the screen size is 768px or smaller */ |
142 | 107 | @media screen and (max-width: 768px) {
|
143 |
| - /* Centers the search result items */ |
144 |
| - #search-results { |
145 |
| - justify-content: center; |
146 |
| - } |
147 |
| - |
148 |
| - /* Decreases the width of each search result item */ |
149 | 108 | .search-result {
|
150 | 109 | width: 45%;
|
151 | 110 | }
|
152 | 111 | }
|
153 |
| - |
154 |
| -/* The following styles will apply when the screen size is 480px or smaller */ |
155 | 112 | @media screen and (max-width: 480px) {
|
156 |
| - /* Changes the direction of the search form to be vertical */ |
157 |
| - #search-form { |
| 113 | + .search-result { |
| 114 | + width: 100%; |
| 115 | + } |
| 116 | + |
| 117 | + form { |
158 | 118 | flex-direction: column;
|
159 | 119 | }
|
160 | 120 |
|
161 |
| - /* Adds margin to the bottom of the search input */ |
162 | 121 | #search-input {
|
163 | 122 | margin-bottom: 20px;
|
164 |
| - } |
165 |
| - |
166 |
| - /* Makes each search result item full width */ |
167 |
| - .search-result { |
168 |
| - width: 100%; |
| 123 | + width: 85%; |
169 | 124 | }
|
170 | 125 | }
|
0 commit comments