-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImprovedStylingwithCSS.html
1402 lines (1394 loc) · 105 KB
/
ImprovedStylingwithCSS.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Improved styling with CSS</title>
<link rel="stylesheet" href="resources/css/courses.css">
<link href="https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Merriweather:ital@0;1&family=Work+Sans:wght@400;500;800&display=swap"
rel="stylesheet">
<script src="https://kit.fontawesome.com/0196cd3152.js" crossorigin="anonymous"></script>
<script src="./resources/script.js" defer></script>
</head>
<body>
<button class="openbtn" onclick="openNav()">☰</button>
<header>
<p id="mainPage"><a href="index.html">Main page </a></p>
<h1>Improves Styling With CSS</h1>
</header>
<nav>
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#1" class="dropdown-btn">Color <i class="fa-solid fa-caret-down"></i> </a>
<div class="dropdown-container">
<ul>
<li> <a href="#1a">Introduction to Color</a> </li>
<li><a href="#1b">Foreground vs Background</a> </li>
<li><a href="#1c">Hue, Saturation, and Lightness</a>
</li>
<li><a href="#1d">Opacity and Alpha</a> </li>
<li><a href="#1e">Review</a> </li>
</ul>
</div>
<a href="#2" class="dropdown-btn"> Typography <i class="fa-solid fa-caret-down"></i></a>
<div class="dropdown-container">
<ul>
<li> <a href="#2a">Font Family </a> </li>
<li> <a href="#2b">Multi-Word Values </a> </li>
<li> <a href="#2c"> Web Safe Fonts</a> </li>
<li> <a href="#2d"> Fallback Fonts and Font Stacks </a>
</li>
<li> <a href="#2e"> Serif and Sans-Serif </a> </li>
<li> <a href="#2f"> Font Weight </a> </li>
<li> <a href="#2g"> Font Style </a> </li>
<li> <a href="#2h"> Text Transformation </a> </li>
<li> <a href="#2i"> Text Layout </a> </li>
<li> <a href="#2j"> Text Alignment </a> </li>
<li> <a href="#2k"> Web Fonts </a> </li>
<ul>
<li> <a href="#2ka">Web Fonts Using
<link>
</a> </li>
<li><a href="#2kb">Web Fonts Using
@font-face</a> </li>
</ul>
<li> <a href="#2l"> Review </a> </li>
</ul>
</div>
<a href="#3" class="dropdown-btn">Links and Buttons <i class="fa-solid fa-caret-down"></i></a>
<div class="dropdown-container">
<ul>
<li> <a href="#3a">Tooltips and Titles </a> </li>
<li> <a href="#3b">Hover States and Cursors </a> </li>
<li> <a href="#3c"> Link States </a> </li>
<li> <a href="#3d"> Skeuomorphism and Flat Design </a>
</li>
<li> <a href="#3e"> Buttons: Skeuomorphic styling </a>
</li>
<li> <a href="#3f"> Buttons: Flat Design </a> </li>
<li> <a href="#3g"> Buttons: Hover States </a> </li>
<li> <a href="#3h"> Review </a> </li>
</ul>
</div>
<a href="#4" class="dropdown-btn">Secondary navigation <i class="fa-solid fa-caret-down"></i></a>
<div class="dropdown-container">
<ul>
<li> <a href="#4a">What is primary vs secondary
navigation? </a> </li>
<li> <a href="#4b">Why do we call them breadcrumbs? </a>
</li>
<li> <a href="#4c">Benefit of using breadcrumbs </a>
</li>
<li> <a href="#4d"> Simple Example of Breadcrumbs </a>
</li>
<li> <a href="#4e"> Where do Breadcrumbs Lead </a> </li>
<li> <a href="#4f"> CSS set up of a basic breadcrumb
</a> </li>
<li> <a href="#4g"> Review </a> </li>
</ul>
</div>
</nav>
<main>
<ul class="c4 lst-kix_v9q81ew640pv-0 start">
<li class="c27 c7 li-bullet-0"><span class="c5">Apply more
custom colors and fonts</span></li>
<li class="c27 c7 li-bullet-0"><span class="c5">Style navigation
elements like links and buttons</span></li>
<li class="c27 c7 li-bullet-0"><span class="c5">Create secondary
(breadcrumb) navigation</span></li>
</ul>
<h2 id="1"><span class="c13">Color</span></h2>
<p class="c3 c8"><span class="c15"></span></p>
<h3 id="1a"><span class="c12">Introduction to
Color</span></h3>
<p class="c3 c8"><span class="c31"></span></p>
<ul class="c4 lst-kix_mn8lnnsfkqlp-0 start">
<li class="c7 c27 li-bullet-0"><span class="c20">Named
colors</span><span> — English words
that
describe colors, also called </span><span class="c20 c33">keyword
colors</span></li>
<li class="c27 c7 li-bullet-0"><span class="c20">RGB</span><span class="c5"> —
numeric values that
describe a mix of red, green, and blue</span>
</li>
<li class="c27 c7 li-bullet-0"><span class="c20">HSL</span><span class="c5"> —
numeric values that
describe a mix of hue, saturation, and
lightness</span></li>
</ul>
<h3 id="1b"><span class="c12">Foreground vs
Background</span></h3>
<p class="c3 c8"><span class="c31"></span></p>
<ul class="c4 lst-kix_strthem4osbn-0 start">
<li class="c27 c7 li-bullet-0"><span class="c5">color - this
property styles an element’s foreground
color.</span></li>
<li class="c27 c7 li-bullet-0"><span class="c5">background-color
- this property styles an element’s
background color.</span></li>
</ul>
<p class="c3 c8"><span class="c15"></span></p>
<h3 id="1c"><span class="c12">Hue, Saturation,
and Lightness</span></h3>
<p class="c0"><span>The RGB color scheme is convenient because
it’s very close to how computers represent
colors internally. There’s another equally
powerful system in CSS called the
hue-saturation-lightness
color scheme, abbreviated as </span><span class="c20">HSL</span><span
class="c5">.</span></p>
<p class="c0"><span class="c5">The syntax for HSL is similar to the
decimal form of RGB, though it differs in
important ways. The first number represents the degree
of the hue, and can be between 0 and 360. The second
and third numbers are percentages representing
saturation and lightness respectively. Here is an
example:</span></p>
<p class="c3"><span class="c5">color: hsl(120, 60%, 70%);</span></p>
<p class="c0"><span class="c20">Hue</span><span class="c5"> is the
first number. It refers to an angle on a
color wheel. Red is 0 degrees, Green is 120 degrees,
Blue is 240 degrees, and then back to Red at 360. You
can see an example of a color wheel below.</span></p>
<p class="c0 c8"><span class="c5"></span></p>
<p class="c0"><span class="c20">Saturation</span><span class="c5"> refers to the intensity
or purity of
the
color. The saturation increases towards 100% as the
color becomes richer. The saturation decreases towards
0% as the color becomes grayer.</span></p>
<p class="c0"><span class="c20">Lightness</span><span class="c5"> refers to how light or
dark the color
is.
Halfway, or 50%, is normal lightness. Imagine a sliding
dimmer on a light switch that starts halfway.
Sliding the dimmer up towards 100% makes the color
lighter, closer to white. Sliding the dimmer down
towards
0% makes the color darker, closer to black.</span></p>
<p class="c0"><span class="c5">HSL is convenient for adjusting colors.
In RGB, making the color a little darker may
affect all three color components. In HSL, that’s
as easy as changing the lightness value. HSL is also
useful for making a set of colors that work well
together by selecting various colors that have the same
lightness and saturation but different hues.</span></p>
<p class="c3 c8"><span class="c31"></span></p>
<h3 id="1d"><span class="c12">Opacity and
Alpha</span></h3>
<p class="c0"><span>All of the colors we’ve seen so far have been
opaque, or non-transparent. When we overlap
two opaque elements, nothing from the bottom element
shows through the top element. In this exercise,
we’ll change the </span><span class="c20">opacity</span><span class="c5">,
or the
amount of
transparency, of some colors so that some or all of the
bottom elements are visible through a covering
element.</span></p>
<p class="c0"><span class="c5">To use opacity in the HSL color scheme,
use hsla instead of hsl, and four values
instead of three. For example:</span></p>
<p class="c3"><span class="c5">color: hsla(34, 100%, 50%, 0.1);</span>
</p>
<p class="c0"><span>The first three values work the same as hsl. The
fourth value (which we have not seen before) is
the </span><span class="c20">alpha</span><span class="c5">. This last value is
sometimes called
opacity.</span></p>
<p class="c0"><span class="c5">Alpha is a decimal number from zero to
one. If alpha is zero, the color will be
completely transparent. If alpha is one, the color will
be opaque. The value for half-transparent would be
0.5.</span></p>
<p class="c0"><span class="c5">You can think of the alpha value as,
“the amount of the background to mix with
the foreground”. When a color’s alpha is
below one, any color behind it will be blended in. The
blending happens for each pixel; no blurring
occurs.</span></p>
<p class="c0"><span class="c5">The RGB color scheme has a similar syntax
for opacity, rgba. Again, the first three
values work the same as rgb and the last value is the
alpha. Here’s an example:</span></p>
<p class="c3"><span class="c5">color: rgba(234, 45, 98, 0.33);</span>
</p>
<p class="c0"><span class="c5">A little unconventional, but still worth
mentioning is how hex colors can also have
an alpha value. By adding a two-digit hexadecimal value
to the end of the six-digit representation
(#52BC8280), or a one-digit hexadecimal value to the end
of the three-digit representation (#F003), you can
change the opacity of a hexadecimal color. Hex opacity
ranges from 00 (transparent) to FF (opaque).</span>
</p>
<p class="c0"><span class="c5">Alpha can only be used with HSL, RGB, and
hex colors; we cannot add the alpha value
to name colors like green.</span></p>
<p class="c0"><span class="c5">There is, however, a named color keyword
for zero opacity, transparent. It’s
equivalent to rgba(0, 0, 0, 0), and it’s used like
any other color keyword:</span></p>
<p class="c3"><span class="c5">color: transparent;</span></p>
<p class="c3 c8"><span class="c15"></span></p>
<p class="c3 c8"><span class="c15"></span></p>
<h3 id="1e"><span class="c12">Review</span></h3>
<p class="c0"><span class="c5">There are four ways to represent color in
CSS:</span></p>
<ul class="c4 lst-kix_umsf5tgtjegd-0 start">
<li class="c0 c7 li-bullet-0"><span>Named colors—there are
more than 140 named colors, which you can
review</span><span><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/CSS/color_value&sa=D&source=editors&ust=1659358834343174&usg=AOvVaw17xk4RPa21uj8mJ-KGbcvV"> </a></span><span
class="c30"><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/CSS/color_value&sa=D&source=editors&ust=1659358834343509&usg=AOvVaw3hcRP6Kv9VODJOL-BBl_-9">here</a></span><span
class="c5">.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">Hexadecimal or
hex colors</span></li>
</ul>
<ul class="c4 lst-kix_umsf5tgtjegd-1 start">
<li class="c0 c36 li-bullet-0"><span class="c5">Hexadecimal is a
number system with has sixteen digits, 0 to 9
followed by “A” to
“F”.</span></li>
<li class="c0 c36 li-bullet-0"><span class="c5">Hex values
always begin with # and specify values of red,
blue,
and green using hexadecimal numbers such as
#23F41A.</span></li>
<li class="c0 c36 li-bullet-0"><span class="c5">Six-digit hex
values with duplicate values for each RGB value
can be shorted to three digits.</span></li>
</ul>
<ul class="c4 lst-kix_umsf5tgtjegd-0">
<li class="c0 c7 li-bullet-0"><span class="c5">RGB</span></li>
</ul>
<ul class="c4 lst-kix_umsf5tgtjegd-1 start">
<li class="c0 c36 li-bullet-0"><span class="c5">RGB colors use
the rgb() syntax with one value for red, one
value for blue and one value for green.</span>
</li>
<li class="c0 c36 li-bullet-0"><span class="c5">RGB values range
from 0 to 255 and look like this: rgb(7, 210,
50).</span></li>
</ul>
<ul class="c4 lst-kix_umsf5tgtjegd-0">
<li class="c0 c7 li-bullet-0"><span class="c5">HSL</span></li>
</ul>
<ul class="c4 lst-kix_umsf5tgtjegd-1 start">
<li class="c0 c36 li-bullet-0"><span class="c5">HSL stands for
hue (the color itself), saturation (the
intensity
of the color), and lightness (how light or dark
a color is).</span></li>
<li class="c0 c36 li-bullet-0"><span class="c5">Hue ranges from
0 to 360 and saturation and lightness are both
represented as percentages like this: hsl(200,
20%, 50%).</span></li>
</ul>
<ul class="c4 lst-kix_umsf5tgtjegd-0">
<li class="c0 c7 li-bullet-0"><span class="c5">You can add
opacity to color in RGB and HSL by adding a
fourth
value, a, which is represented as a
percentage.</span></li>
</ul>
<p class="c3 c8"><span class="c15"></span></p>
<p class="c3 c8"><span class="c15"></span></p>
<h2 id="2"><span class="c13">Typography</span>
</h2>
<p class="c0"><span class="c5">the art of arranging text on a page.
We’ll look at:</span></p>
<ul class="c4 lst-kix_9exeb3nixkva-0 start">
<li class="c0 c7 li-bullet-0"><span class="c5">How to style and
transform fonts.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">How to lay text
out on a page.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">and how to add
external fonts to your web pages.</span></li>
</ul>
<p class="c0"><span class="c5">Some of the most important information a
user will see on a web page will be textual.
Styling text to make page content accessible and
engaging can significantly improve user experience.
Let’s begin!</span></p>
<h3 id="2a"><span class="c12">Font Family</span>
</h3>
<p class="c0"><span>You may remember from the</span><span><a class="c29"
href="https://www.google.com/url?q=https://www.codecademy.com/content-items/1368d1ea90382cbe44b60eeac19e9573/exercises/font-family&sa=D&source=editors&ust=1659358834345627&usg=AOvVaw2o0veZ2ick_gscUQxYMIC4"> </a></span><span
class="c30"><a class="c29"
href="https://www.google.com/url?q=https://www.codecademy.com/content-items/1368d1ea90382cbe44b60eeac19e9573/exercises/font-family&sa=D&source=editors&ust=1659358834345974&usg=AOvVaw3FgNejNxqVQG5INJ82sF3z">Visual
Rules</a></span><span class="c5"> lesson
that the font of an element can be changed using the
font-family property.</span></p>
<p class="c3"><span class="c14">h1 {</span></p>
<p class="c3"><span class="c14"> font-family: Arial;</span></p>
<p class="c3"><span class="c14">}</span></p>
<p class="c0"><span class="c5">In the example above, the font family for
all <h1> heading elements have been
set to Arial.</span></p>
<p class="c0 c8"><span class="c5"></span></p>
<h3 id="2b"><span class="c12">Multi-Word
Values</span></h3>
<p class="c0"><span class="c5">When specifying a typeface with multiple
words, like Times New Roman, it is
recommended to use quotation marks (' ') to
group the words together, like so:</span></p>
<p class="c3"><span class="c14">h1 {</span></p>
<p class="c3"><span class="c14"> font-family: 'Times New
Roman';</span></p>
<p class="c3"><span class="c14">}</span></p>
<h3 id="2c"><span class="c12">Web Safe
Fonts</span></h3>
<p class="c0"><span>There is a selection of fonts that will appear the
same across all browsers and operating
systems. These fonts are referred to as </span><span class="c20">web safe
fonts</span><span>. You can check
out a complete list of web safe fonts</span><span><a class="c29"
href="https://www.google.com/url?q=https://www.cssfontstack.com/&sa=D&source=editors&ust=1659358834347369&usg=AOvVaw1Y0RVutNNg6GedPfBsDdO-"> </a></span><span
class="c30"><a class="c29"
href="https://www.google.com/url?q=https://www.cssfontstack.com/&sa=D&source=editors&ust=1659358834347658&usg=AOvVaw15yMuTzotRUqfiB5PIIMm9">here</a></span><span
class="c5">.</span></p>
<h3 id="2d"><span class="c12">Fallback Fonts and
Font Stacks</span></h3>
<p class="c0"><span>Web safe fonts are good </span><span class="c20">fallback fonts</span><span
class="c5"> that can be used if your preferred font
is not available.</span></p>
<p class="c3"><span class="c14">h1 {</span></p>
<p class="c3"><span class="c14"> font-family: Caslon, Georgia,
'Times New Roman';</span></p>
<p class="c3"><span class="c14">}</span></p>
<p class="c0"><span>In the example above, Georgia and Times New Roman
are fallback fonts to Caslon. When you specify
a group of fonts, you have what is known as a
</span><span class="c20">font stack</span><span class="c5">. A
font stack usually contains a list of similar-looking
fonts. Here, the browser will first try to use the
Caslon font. If that’s not available, it will try
to use a similar font, Georgia. And if Georgia is
not available, it will try to use Times New
Roman.</span></p>
<h3 id="2e"><span class="c12">Serif and
Sans-Serif</span></h3>
<p class="c0"><span>You may be wondering what features make a font
similar to another font. The fonts Caslon,
Georgia, and Times New Roman are </span><span class="c20">Serif</span><span> fonts.
Serif fonts
have
extra details on the ends of each letter, as opposed to
</span><span class="c20">Sans-Serif</span><span class="c5"> fonts, which do not
have the extra
details.</span></p>
<p class="c0 c8"><span class="c5"></span></p>
<p class="c0"><span class="c5">serif and sans-serif are also keyword
values that can be added as a final fallback
font if nothing else in the font stack is
available.</span></p>
<p class="c3"><span class="c14">h1 {</span></p>
<p class="c3"><span class="c14"> font-family: Caslon, Georgia,
'Times New Roman', serif;</span></p>
<p class="c3"><span class="c14">}</span></p>
<p class="c0"><span class="c5">In this final example, the font stack has
4 fonts. If the first 3 fonts aren’t
available, the browser will use whatever serif font is
available on the system.</span></p>
<h3 id="2f"><span class="c12">Font Weight</span>
</h3>
<p class="c0"><span class="c5">In CSS, the font-weight property controls
how bold or thin text appears. It can be
specified with keywords or numerical values.</span></p>
<p class="c39"><span class="c5">Keyword Values</span></p>
<p class="c0"><span class="c5">The font-weight property can take any one
of these keyword values:</span></p>
<ul class="c4 lst-kix_j0tbo5wk3a8i-0 start">
<li class="c0 c7 li-bullet-0"><span class="c5">bold: Bold font
weight.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">normal: Normal
font weight. This is the default value.</span>
</li>
<li class="c0 c7 li-bullet-0"><span class="c5">lighter: One font
weight lighter than the element’s parent
value.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">bolder: One font
weight bolder than the element’s parent
value</span></li>
</ul>
<p class="c39"><span class="c5">Numerical Values</span></p>
<p class="c0"><span class="c5">Numerical values can range from 1
(lightest) to 1000 (boldest), but it is common
practice to use increments of 100. A font weight of 400
is equal to the keyword value normal, and a font
weight of 700 is equal to bold.</span></p>
<p class="c3"><span class="c14">.left-section {</span></p>
<p class="c3"><span class="c14"> font-weight: 700;</span></p>
<p class="c3"><span class="c14">}</span></p>
<p class="c3 c8"><span class="c14"></span></p>
<p class="c3"><span class="c14">.right-section {</span></p>
<p class="c3"><span class="c14"> font-weight: bold;</span></p>
<p class="c3"><span class="c14">}</span></p>
<p class="c0"><span class="c5">In the example above, text in elements of
both .left-section and .right-section
classes will appear bold.</span></p>
<p class="c0"><span class="c5">It’s important to note that not all
fonts can be assigned a numeric font
weight, and not all numeric font weights are available
to all fonts. It’s a good practice to look up
the font you are using to see which font-weight values
are available.</span></p>
<p class="c3 c8"><span class="c15"></span></p>
<h3 id="2g"><span class="c12">Font Style</span>
</h3>
<p class="c0"><span class="c5">You can also italicize text with the
font-style property.</span></p>
<p class="c3"><span class="c14">h3 {</span></p>
<p class="c3"><span class="c14"> font-style: italic;</span></p>
<p class="c3"><span class="c14">}</span></p>
<p class="c0"><span class="c5">The italic value causes text to appear in
italics. The font-style property also has a
normal value which is the default.</span></p>
<p class="c0 c8"><span class="c5"></span></p>
<p class="c0 c8"><span class="c31"></span></p>
<h3 id="2h"><span class="c12">Text
Transformation</span></h3>
<p class="c0"><span class="c5">Text can also be styled to appear in
either all uppercase or lowercase with the
text-transform property.</span></p>
<p class="c0"><span class="c14">h1 {</span></p>
<p class="c0"><span class="c14"> text-transform: uppercase;</span>
</p>
<p class="c0"><span class="c14">}</span></p>
<p class="c0"><span class="c5">The code in the example above formats all
<h1> elements to appear in uppercase,
regardless of the case used for the heading within the
HTML code. Alternatively, the lowercase value could
be used to format text in all lowercase.</span></p>
<p class="c0"><span>Since text can be directly typed in all uppercase or
lowercase within an HTML file, what is the
point of a CSS rule that allows you to
format</span><span><a class="c29"
href="https://www.google.com/url?q=https://en.wikipedia.org/wiki/Letter_case&sa=D&source=editors&ust=1659358834353293&usg=AOvVaw1QyqRtePIj2ddfVcwJhOTX"> </a></span><span
class="c26"><a class="c29"
href="https://www.google.com/url?q=https://en.wikipedia.org/wiki/Letter_case&sa=D&source=editors&ust=1659358834353629&usg=AOvVaw2SeygdcCk3kgeUNFfg2LJQ">letter
case</a></span><span class="c5">?</span></p>
<p class="c0"><span class="c5">Depending on the type of content a web
page displays, it may make sense to always
style a specific element in all uppercase or lowercase
letters. For example, a website that reports breaking
news may decide to format all <h1> heading
elements such that they always appear in all uppercase,
as
in the example above. It would also avoid uppercase text
in the HTML file, which could make code difficult
to read.</span></p>
<p class="c0 c8"><span class="c5"></span></p>
<h3 id="2i"><span class="c12">Text Layout</span>
</h3>
<p class="c3"><span class="c5">You’ve learned how text can be
defined by font family, weight, style, and
transformations. Now you’ll learn about some ways
text can be displayed or laid out within the
element’s container.</span></p>
<h5 class="c34 c37" id="h.txpv24dhw74e"><span class="c30 c35">Letter
Spacing</span></h5>
<p class="c3"><span class="c5">The letter-spacing property is used to
set the horizontal spacing between the
individual characters in an element. It’s not
common to set the spacing between letters, but it can
sometimes help the readability of certain fonts or
styles. The letter-spacing property takes length values
in units, such as 2px or 0.5em.</span></p>
<p class="c3 c8"><span class="c5"></span></p>
<p class="c3"><span class="c14">p {</span></p>
<p class="c3"><span class="c14"> letter-spacing: 2px;</span></p>
<p class="c3"><span class="c14">}</span></p>
<p class="c3 c8"><span class="c5"></span></p>
<p class="c3"><span class="c5">In the example above, each character in
the paragraph element will be separated by 2
pixels.</span></p>
<h5 class="c37 c34" id="h.9ybwrj3zwl09"><span class="c35 c30">Word
Spacing</span></h5>
<p class="c3"><span class="c5">You can set the space between words with
the word-spacing property. It’s also
not common to increase the spacing between words, but it
may help enhance the readability of bolded or
enlarged text. The word-spacing property also takes
length values in units, such as 3px or 0.2em.</span></p>
<p class="c3"><span class="c14">h1 {</span></p>
<p class="c3"><span class="c14"> word-spacing: 0.3em;</span></p>
<p class="c3"><span class="c14">}</span></p>
<p class="c3 c8"><span class="c5"></span></p>
<p class="c3"><span class="c5">In the example above, the word spacing is
set to 0.3em. For word spacing, using em
values are recommended because the spacing can be set
based on the size of the font.</span></p>
<h5 class="c37 c34" id="h.o13xajh4bpjt"><span class="c35 c30">Line
Height</span></h5>
<p class="c3 c8"><span class="c5"></span></p>
<p class="c3"><span class="c5">We can use the line-height property to
set how tall we want each line containing our
text to be. Line height values can be a unitless number,
such as 1.2, or a length value, such as 12px, 5% or
2em.</span></p>
<p class="c3 c8"><span class="c5"></span></p>
<p class="c3"><span class="c14">p {</span></p>
<p class="c3"><span class="c14"> line-height: 1.4;</span></p>
<p class="c3"><span class="c14">}</span></p>
<p class="c3 c8"><span class="c5"></span></p>
<p class="c3"><span class="c5">In the example above, the height between
lines is set to 1.4. Generally, the unitless
value is preferred since it is responsive based on the
current font size. In other words, if the line-height
is specified by a unitless number, changing the font
size will automatically readjust the line
height.</span></p>
<h3 id="2j"><span class="c12">Text
Alignment</span></h3>
<p class="c3"><span>The text-align property, which you may already be
familiar with from the</span><span class="c26"><a class="c29"
href="https://www.google.com/url?q=https://www.codecademy.com/courses/learn-css/lessons/css-visual-rules/exercises/text-align&sa=D&source=editors&ust=1659358834356542&usg=AOvVaw3i0WrvTRQBIIH4tTYQJB6W"> CSS
Visual Rules lesson</a></span><span class="c5">,
aligns text to its parent element.</span></p>
<p class="c3 c8"><span class="c5"></span></p>
<p class="c3"><span class="c14">h1 {</span></p>
<p class="c3"><span class="c14"> text-align: right;</span></p>
<p class="c3"><span class="c14">}</span></p>
<p class="c3 c8"><span class="c5"></span></p>
<p class="c3"><span>In the example above, the <h1> element is
aligned to the right side, instead of the
default left.</span></p>
<p class="c0 c8"><span class="c5"></span></p>
<h3 id="2k"><span class="c12">Web
Fonts</span></h3>
<p class="c0"><span>Previously, we learned about web safe fonts, a group
of fonts supported across browsers and
operating systems. However, the fonts you can use for
your website are limitless—</span><span class="c20">web fonts</span><span
class="c5"> allow
you to express your unique style through a
multitude of different fonts found on the web.</span>
</p>
<p class="c0"><span>Free font services, like</span><span><a class="c29"
href="https://www.google.com/url?q=https://fonts.google.com/&sa=D&source=editors&ust=1659358834358581&usg=AOvVaw0pJ7C-z2F_MGcnEslH7lHC"> </a></span><span
class="c26"><a class="c29"
href="https://www.google.com/url?q=https://fonts.google.com/&sa=D&source=editors&ust=1659358834359054&usg=AOvVaw1x6tjnoQjZwrhYeuJv6QCp">Google
Fonts</a></span><span> and</span><span><a class="c29"
href="https://www.google.com/url?q=https://fonts.adobe.com&sa=D&source=editors&ust=1659358834359474&usg=AOvVaw2gAzK6hujz2-FWamhgZ4uu"> </a></span><span
class="c26"><a class="c29"
href="https://www.google.com/url?q=https://fonts.adobe.com&sa=D&source=editors&ust=1659358834359760&usg=AOvVaw2-ygCqsX5-TwuGZAIBJQZ5">Adobe
Fonts</a></span><span class="c5">, host fonts
that you can link to from your HTML document with a
provided <link> element.</span></p>
<p class="c0"><span>You can also use fonts from paid font distributors
like</span><span><a class="c29"
href="https://www.google.com/url?q=https://www.fonts.com/&sa=D&source=editors&ust=1659358834360170&usg=AOvVaw3ITh8ibM70Mwmr0bFJG2IA"> </a></span><span
class="c26"><a class="c29"
href="https://www.google.com/url?q=https://www.fonts.com/&sa=D&source=editors&ust=1659358834360395&usg=AOvVaw0te4a83mkOVlKp-r9sLzAJ">fonts.com</a></span><span
class="c5"> by downloading and hosting them with
the rest of your site’s files. You can create a
@font-face ruleset in your CSS stylesheet to link to the
relative path of the font file.</span></p>
<p class="c0"><span class="c5">Both techniques for including web fonts
into your site allow you to go beyond the
sometimes “traditional” appearance of web
safe fonts. In the next two exercises, you’ll
learn exactly how to use each of these
techniques!</span></p>
<p class="c0 c8"><span class="c5"></span></p>
<h4 id="2ka"><span class="c32">Web Fonts Using
<link></span></h4>
<p class="c0"><span>Online font services, like</span><span><a class="c29"
href="https://www.google.com/url?q=https://fonts.google.com/&sa=D&source=editors&ust=1659358834361064&usg=AOvVaw3ao1Jc8Tqlbf0M9MSWBtlP"> </a></span><span
class="c26"><a class="c29"
href="https://www.google.com/url?q=https://fonts.google.com/&sa=D&source=editors&ust=1659358834361287&usg=AOvVaw0psNnx0-pKCrdd6aoL_t2W">Google
Fonts</a></span><span class="c5">, make it easy
to find and link to fonts from your site. You can browse
and select fonts that match the style of your
website.</span></p>
<p class="c0"><span
style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 601.70px; height: 349.33px;"><img
alt="Google Fonts Roboto Styles Page"
src="./resources/images/stylingCSS/stylingCss3.png"
style="width: 601.70px; height: 349.33px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);"
title=""></span></p>
<p class="c0"><span class="c5">When you select a font in Google Fonts,
you’ll be shown all of the different
styles available for that particular font. You can then
select the styles you want to use on your
site.</span></p>
<p class="c0"><span
style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 601.70px; height: 349.33px;"><img
alt="Showing Selected Font Families"
src="./resources/images/stylingCSS/stylingCss2.png"
style="width: 601.70px; height: 349.33px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);"
title=""></span></p>
<p class="c0"><span class="c5">When you’re done selecting a font
and its styles, you can review your selected
font family, and a <link> element will be
automatically generated for you to use on your
site!</span>
</p>
<p class="c0"><span class="c5"><head></span></p>
<p class="c0"><span class="c5"> <!-- Add the link element for
Google Fonts along with other metadata
--></span></p>
<p class="c0"><span class="c5"> <link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap"
rel="stylesheet"></span></p>
<p class="c0"><span class="c5"></head></span></p>
<p class="c0"><span class="c5">The generated <link> element needs
to be added to the <head> element in
your HTML document for it to be ready to be used in your
CSS.</span></p>
<p class="c0"><span class="c5">p {</span></p>
<p class="c0"><span class="c5"> font-family: 'Roboto',
sans-serif;</span></p>
<p class="c0"><span class="c5">}</span></p>
<p class="c0"><span class="c5">You can then create font-family
declarations in your CSS, just like how you learned
to do with other fonts!</span></p>
<p class="c0 c8"><span class="c31"></span></p>
<h4 id="2kb"><span class="c32">Web Fonts Using
@font-face</span></h4>
<p class="c0"><span>Fonts can also be added using a</span><span><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face&sa=D&source=editors&ust=1659358834362877&usg=AOvVaw3ET2Z_YmMYPokT2qK0DUCY"> </a></span><span
class="c26"><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face&sa=D&source=editors&ust=1659358834363169&usg=AOvVaw1luHonr_v_e5DMW9lekrfb">@font-face
ruleset</a></span><span class="c5"> in your
CSS stylesheet instead of using a <link> element
in your HTML document. As mentioned earlier, fonts can
be downloaded just like any other file on the web.
They come in a few different file formats, such
as:</span></p>
<ul class="c4 lst-kix_qk7s33zdoqj2-0 start">
<li class="c0 c7 li-bullet-0"><span class="c5">OTF (OpenType
Font)</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">TTF (TrueType
Font)</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">WOFF (Web Open
Font Format)</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">WOFF2 (Web Open
Font Format 2)</span></li>
</ul>
<p class="c0"><span class="c5">The different formats are a progression
of standards for how fonts will work with
different browsers, with WOFF2 being the most
progressive. It’s a good idea to include TTF,
WOFF, and
WOFF2 formats with your @font-face rule to ensure
compatibility on all browsers.</span></p>
<p class="c0"><span class="c5">Let’s take a look at how to use
@font-face using the same Roboto font as
before:</span></p>
<p class="c0"><span
style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 601.70px; height: 332.00px;"><img
alt="Google Fonts Download" src="./resources/images/stylingCSS/stylingCss1.png"
style="width: 601.70px; height: 332.00px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);"
title=""></span></p>
<p class="c0"><span>Within the “Selected Families” section,
you can use the “Download”
button to download the font files to your computer. The
files will be downloaded as a single format, in this
case, TTF. You can use a tool such as</span><span><a class="c29"
href="https://www.google.com/url?q=https://google-webfonts-helper.herokuapp.com/fonts&sa=D&source=editors&ust=1659358834364209&usg=AOvVaw0GyyOJbe0y_eCva5OWllJI"> </a></span><span
class="c26"><a class="c29"
href="https://www.google.com/url?q=https://google-webfonts-helper.herokuapp.com/fonts&sa=D&source=editors&ust=1659358834364471&usg=AOvVaw2jHGyEFuoejnivYwXpgs5s">Google
Web Fonts Helper</a></span><span class="c5"> to generate additional
file types for
WOFF and
WOFF2.</span></p>
<p class="c0"><span class="c5">When you have the files you need, move
them to a folder inside your website’s
working directory, and you’re ready to use them in
a @font-face ruleset!</span></p>
<p class="c0"><span class="c5">@font-face {</span></p>
<p class="c0"><span class="c5"> font-family:
'MyParagraphFont';</span></p>
<p class="c0"><span class="c5"> src:
url('fonts/Roboto.woff2')
format('woff2'),</span></p>
<p class="c0"><span class="c5">
url('fonts/Roboto.woff')
format('woff'),</span></p>
<p class="c0"><span class="c5">
url('fonts/Roboto.ttf')
format('truetype');</span></p>
<p class="c0"><span class="c5">}</span></p>
<p class="c0"><span class="c5">Let’s take a look at the example
above, line by line:</span></p>
<ul class="c4 lst-kix_iht17jjv1yhi-0 start">
<li class="c0 c7 li-bullet-0"><span class="c5">The @font-face
at-rule is used as the selector. It’s
recommended to define the @font-face ruleset at
the top of your CSS stylesheet.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">Inside the
declaration block, the font-family property is
used to
set a custom name for the downloaded font. The
name can be anything you choose, but it must be
surrounded by quotation marks. In the example,
the font is named 'MyParagraphFont', as
this font
will be used for all paragraphs.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">The src property
contains three values, each specifying the
relative path to the font file and its format.
In this example, the font files are stored
inside a
folder named fonts within the working
directory.</span></li>
</ul>
<p class="c0"><span class="c5">Once the @font-face at-rule is defined,
you can use the font in your
stylesheet!</span></p>
<p class="c0"><span class="c5">p {</span></p>
<p class="c0"><span class="c5"> font-family:
'MyParagraphFont', sans-serif;</span></p>
<p class="c0"><span class="c5">}</span></p>
<p class="c0"><span class="c5">Like using any other fonts, you can use
the font-family property to set the font on
any HTML element. The downloaded font can be referenced
with the name you provided as the font-family
property’s value in the @font-face
ruleset—in this case,
'MyParagraphFont'.</span></p>
<p class="c0 c8"><span class="c5"></span></p>
<h3 id="2l"><span class="c12">Review</span></h3>
<ul class="c4 lst-kix_vi88yo2kaw4k-0 start">
<li class="c0 c7 li-bullet-0"><span class="c20">Typography</span><span class="c5"> is the
art of arranging
text on a page.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">Text can appear
bold or thin with the font-weight
property.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">Text can appear
in italics with the font-style property.</span>
</li>
<li class="c0 c7 li-bullet-0"><span class="c5">The vertical
spacing between lines of text can be modified
with
the line-height property.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c20">Serif</span><span> fonts have
extra details on the ends of
each letter. </span><span class="c20">Sans-Serif</span><span
class="c5"> fonts do not.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c20">Fallback
fonts</span><span class="c5"> are used when
a
certain font is not installed on a user’s
computer.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">The word-spacing
property changes how far apart individual words
are.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">The
letter-spacing property changes how far apart
individual
letters are.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">The text-align
property changes the horizontal alignment of
text.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">Google Fonts
provides free fonts that can be used in an HTML
file
with the <link> tag or the @font-face
property.</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">Local fonts can
be added to a document with the @font-face
property and the path to the font’s
source.</span></li>
</ul>
<p class="c3 c8"><span class="c5"></span></p>
<p class="c3 c8"><span class="c40"></span></p>
<h2 id="3"><span class="c13">Learn Links and
Buttons</span></h2>
<p class="c3 c8"><span class="c31"></span></p>
<h3 id="3a"><span class="c12">Tooltips and
Titles</span></h3>
<p class="c0"><span class="c5">In addition to providing descriptive
anchor text, it is sometimes helpful to provide
additional context to explain links. This context can be
particularly helpful when a link contains or
consists of an image, icon, or another non-text
element.</span></p>
<p class="c0"><span>Additional context can be provided as text using
the</span><span><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title&sa=D&source=editors&ust=1659358834367823&usg=AOvVaw1aZYjrLwm5TEdGez84fy7W"> </a></span><span
class="c30"><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title&sa=D&source=editors&ust=1659358834368168&usg=AOvVaw0IjhXxAent6YJml2NWbZVA">HTML
title attribute</a></span><span class="c5">.
Although the title attribute can be provided to any HTML
element, it is often extremely useful as additional
context or advisory text for clickable elements.</span>
</p>
<p class="c0"><span>Most browsers will display the text of a title
attribute as a</span><span><a class="c29"
href="https://www.google.com/url?q=https://en.wikipedia.org/wiki/Tooltip&sa=D&source=editors&ust=1659358834368535&usg=AOvVaw25ewGFhYIjcBElWNLf9AWy"> </a></span><span
class="c30"><a class="c29"
href="https://www.google.com/url?q=https://en.wikipedia.org/wiki/Tooltip&sa=D&source=editors&ust=1659358834368767&usg=AOvVaw2Lpz40NTKmi2RlRP0Jha2I">tooltip</a></span><span
class="c5">, meaning when a user hovers their cursor
over an element, the text will appear in a small box
near the cursor.</span></p>
<p class="c0"><span class="c5">To add tooltips to a clickable element
like a link, add it as the title
attribute.</span></p>
<p class="c3"><span class="c28"><p></span></p>
<p class="c3"><span class="c28"> <a
href="https://www.codecademy.com"
title="Codecademy is
an online learning
platform">Codecademy</a> is the best place
to learn to code!</span></p>
<p class="c3"><span class="c28"></p></span></p>
<p class="c0 c8"><span class="c5"></span></p>
<h3 id="3b"><span class="c12">Hover States and
Cursors</span></h3>
<p class="c0"><span>In addition to styling elements themselves, other
signifiers and visual feedback can be utilized
during user interaction. The</span><span><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/CSS/:hover&sa=D&source=editors&ust=1659358834369618&usg=AOvVaw14Z25gB0gKkS04qqB1jFJe"> </a></span><span
class="c30"><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/CSS/:hover&sa=D&source=editors&ust=1659358834369864&usg=AOvVaw0yzmmjoGGujDEMzWFyKj9L">CSS
pseudo-class :hover</a></span><span class="c5"> can be used to
style elements on mouse
hover. For
instance, to change the color of link anchor text from
blue to orange when a user hovers over it, the
following CSS could be used:</span></p>
<p class="c3"><span class="c28">a {</span></p>
<p class="c3"><span class="c28"> color: blue;</span></p>
<p class="c3"><span class="c28">}</span></p>
<p class="c3 c8"><span class="c28"></span></p>
<p class="c3"><span class="c28">a:hover {</span></p>
<p class="c3"><span class="c28"> color: orange;</span></p>
<p class="c3"><span class="c28">}</span></p>
<p class="c0"><span class="c5">The first rule sets link colors to blue
by default, and when a user mouses over a
link, the second rule will override the color attribute
of the <a> tag and cause the text to turn
orange. When the user moves the cursor away from the
link, the text color will revert to blue.</span></p>
<p class="c0"><span>In addition to any text style changes when hovering
over a link, the user’s cursor should
change from the default appearance to a pointing hand.
The</span><span><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/CSS/cursor%23Examples&sa=D&source=editors&ust=1659358834370774&usg=AOvVaw3oOGE2Co_FwwudMZVANABO"> </a></span><span
class="c30"><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/CSS/cursor%23Examples&sa=D&source=editors&ust=1659358834371064&usg=AOvVaw2b3UdxMGU_C90RhTYYKuVC">CSS
cursor property</a></span><span class="c5"> is used to control this
behavior. For
example, to add
this behavior to all <a> tags, the following rule
could be used:</span></p>
<p class="c3"><span class="c28">a {</span></p>
<p class="c3"><span class="c28"> cursor: pointer;</span></p>
<p class="c3"><span class="c28">}</span></p>
<p class="c0"><span>Luckily, this behavior is generally included in
browser user agent stylesheets, and it also
exists in the</span><span><a class="c29"
href="https://www.google.com/url?q=https://www.w3.org/TR/html5/rendering.html&sa=D&source=editors&ust=1659358834371653&usg=AOvVaw2pZohGJvmDm0IVlab6dYdq"> </a></span><span
class="c30"><a class="c29"
href="https://www.google.com/url?q=https://www.w3.org/TR/html5/rendering.html&sa=D&source=editors&ust=1659358834371881&usg=AOvVaw1sGnnl0Cmf9FlYPG-1aG4z">HTML5
default styles</a></span><span class="c5">.</span></p>
<p class="c0"><span class="c5">Hover state styling should never be used
as the sole indication that something is a
link. Users should not be forced to move their mouse
over an entire document to tell what might be
clickable. Additionally, hover states are not accessible
in mobile browsers. Mobile devices do not generally
have on-screen cursors, and users must actually touch
the device (and possibly trigger a click event) to
interact.</span></p>
<p class="c3 c8"><span class="c5"></span></p>
<p class="c3 c8"><span class="c5"></span></p>
<h3 id="3c"><span class="c12">Link States</span>
</h3>
<p class="c0"><span>Links have four main states: normal (not clicked),
hover, active (clicked), and visited. These
four states have associated</span><span><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes&sa=D&source=editors&ust=1659358834372598&usg=AOvVaw0HSy-VqDThlqHaiQ_j7aEG"> </a></span><span
class="c26"><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes&sa=D&source=editors&ust=1659358834372850&usg=AOvVaw0XLDtBSeWv1K5PndpWUWf_">CSS
pseudo-classes</a></span><span class="c5">:
:link, :hover, :active, and :visited. These four states
can
be used to give a full range of visual feedback to users
about the status of their link interaction.</span>
</p>
<p class="c0"><span class="c5">Each state should still make it clear
that the element in question is a link, meaning
it should not make text identical to non-link text or
alter the link’s appearance so much that users
could perceive its behavior differently.</span></p>
<p class="c0"><span class="c5">The ordering of link state pseudo-class
rules is important to reveal the proper
information. When a user hovers and then clicks a link,
those styles should always override the static
styling surrounding a user’s history with the link
(unvisited :link and :visited). The proper order of
these rules is:</span></p>
<ul class="c4 lst-kix_6f1d155lezt5-0 start">
<li class="c0 c7 li-bullet-0"><span class="c5">:link</span></li>
<li class="c0 c7 li-bullet-0"><span class="c5">:visited</span>
</li>
<li class="c0 c7 li-bullet-0"><span class="c5">:hover</span>
</li>
<li class="c0 c7 li-bullet-0"><span class="c5">:active</span>
</li>
</ul>
<p class="c0"><span>This ordering will ensure that the
rules</span><span><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Cascade_and_inheritance&sa=D&source=editors&ust=1659358834373936&usg=AOvVaw3rP78GXzwvWwanAaHHUMmY"> </a></span><span
class="c26"><a class="c29"
href="https://www.google.com/url?q=https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Cascade_and_inheritance&sa=D&source=editors&ust=1659358834374270&usg=AOvVaw0-3lunQ_lGqdMLfeMmiE8M">cascade
properly</a></span><span class="c5"> and
the user can receive the most applicable visual feedback
about the state of the link.</span></p>
<p class="c3 c8"><span class="c5"></span></p>
<h3 id="3d"><span class="c12">Skeuomorphism and
Flat Design</span></h3>
<p class="c0"><span>Buttons are another fundamental element of user
interaction and navigation. They are called
‘buttons’ because they are often modeled on
the appearance and behavior of real-life buttons.
The concept of UI elements that replicate or imitate
real-life counterparts is known as </span><span class="c20">skeuomorphism</span><span
class="c5">.</span></p>
<p class="c0"><span class="c5">In design, skeuomorphism is helpful for
lowering the learning curve for users. If
users can draw a metaphor between a familiar real-life
object and an interface element, they are more likely
to know how to use it without training. In the example
of the button, if a web button appears similar to a
real-life button on a physical interface, users can
reliably figure out that the way to interact with the
button is to press it.</span></p>
<p class="c0"><span class="c20">Flat design</span><span class="c5"> is an alternative
approach to
skeuomorphism
which embraces the fact that computer interfaces do not
necessarily need to model real-life interfaces. As
users grow more familiar with digital displays and
interfaces, designers have felt less need to model
physical interactions and instead rely on other
signifiers to indicate interactive elements. To
generalize,
flat design uses simplicity and lack of clutter for its
UI elements.</span></p>
<p class="c3 c8"><span class="c5"></span></p>
<h3 id="3e"><span class="c12">Buttons:
Skeuomorphic styling</span></h3>
<p class="c0"><span class="c5">Skeuomorphic button design aims to
imitate the appearance and interactivity of a
real-life button, often including a ‘raised’
appearance while the button is unpressed and a
‘pressed’ appearance when clicked.</span>
</p>
<p class="c0"><span class="c5">Skeuomorphic button design can be
implemented using image files, CSS rules, or a
combination of both. CSS styles should be preferred over
image files if possible, since they are faster to
load, have smaller file sizes, and allow for a more
consistent scaling and appearance across different
screen sizes and resolutions. Modern CSS3 has support
for many 2-D and 3-D effects and animations and can
create many skeuomorphic button designs on its
own.</span></p>
<p class="c0"><span class="c5">If using CSS rules, the use of hover
and/or active states is important in order to