8 |
9 |
10 |
--------------------------------------------------------------------------------
/01 - Introduction to CSS/Listing_1-7.css:
--------------------------------------------------------------------------------
1 | div {
2 | background-color: red;
3 | }
--------------------------------------------------------------------------------
/01 - Introduction to CSS/Listing_1-8.css:
--------------------------------------------------------------------------------
1 | @keyframes spin {
2 | from { transform: rotate(0); }
3 | to { transform: rotate(360deg); }
4 | }
5 |
6 | @-moz-keyframes spin {
7 | from { -moz-transform: rotate(0); }
8 | to { -moz-transform: rotate(360deg); }
9 | }
10 |
11 | @-webkit-keyframes spin {
12 | from { -webkit-transform: rotate(0); }
13 | to { -webkit-transform: rotate(360deg); }
14 | }
15 |
--------------------------------------------------------------------------------
/01 - Introduction to CSS/Listing_1-9.scss:
--------------------------------------------------------------------------------
1 | .header {
2 | background-color: red;
3 |
4 | h1 {
5 | font-size: 24px;
6 | }
7 | }
--------------------------------------------------------------------------------
/01 - Introduction to CSS/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/02 - CSS Selectors/Listing_2-1.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | }
4 |
--------------------------------------------------------------------------------
/02 - CSS Selectors/Listing_2-10.html:
--------------------------------------------------------------------------------
1 |
11 |
12 |
5 |
--------------------------------------------------------------------------------
/02 - CSS Selectors/Listing_2-8.html:
--------------------------------------------------------------------------------
1 | Google
2 |
--------------------------------------------------------------------------------
/02 - CSS Selectors/Listing_2-9.css:
--------------------------------------------------------------------------------
1 | .external-link::after {
2 | content: " (external)"
3 | color: green;
4 | }
5 |
--------------------------------------------------------------------------------
/02 - CSS Selectors/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/03 - Basic CSS Concepts/Listing_3-1.html:
--------------------------------------------------------------------------------
1 |
14 |
15 |
18 | Hello world, I am demonstrating an inline-block element.
19 |
20 |
--------------------------------------------------------------------------------
/03 - Basic CSS Concepts/Listing_3-9.css:
--------------------------------------------------------------------------------
1 | .header {
2 | font-size: 24px;
3 | padding: 0.5em;
4 | }
5 |
--------------------------------------------------------------------------------
/03 - Basic CSS Concepts/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/04 - Basic Styling/Listing_4-1.html:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/04 - Basic Styling/Listing_4-5.css:
--------------------------------------------------------------------------------
1 | .container {
2 | border: 5px solid red;
3 | }
4 |
--------------------------------------------------------------------------------
/04 - Basic Styling/Listing_4-6.html:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/04 - Basic Styling/Listing_4-7.html:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/04 - Basic Styling/Listing_4-8.html:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/04 - Basic Styling/Listing_4-9.html:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/04 - Basic Styling/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/05 - Backgrounds and Gradients/Listing_5-1.html:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
--------------------------------------------------------------------------------
/05 - Backgrounds and Gradients/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/05 - Backgrounds and Gradients/mountains.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Apress/modern-css/cea922754a117becdfcff9e15002909760d7484b/05 - Backgrounds and Gradients/mountains.jpg
--------------------------------------------------------------------------------
/05 - Backgrounds and Gradients/tiles.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Apress/modern-css/cea922754a117becdfcff9e15002909760d7484b/05 - Backgrounds and Gradients/tiles.jpg
--------------------------------------------------------------------------------
/06 - Text Styling/Listing_6-1.css:
--------------------------------------------------------------------------------
1 | .hello {
2 | font-family:
3 | Georgia,
4 | 'Times New Roman',
5 | serif;
6 | }
7 |
--------------------------------------------------------------------------------
/06 - Text Styling/Listing_6-10.html:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | Here is some text
10 | with
11 | whitespace.
12 |
23 |
24 |
25 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec sapien
26 | dolor. Nunc condimentum sem nec commodo sollicitudin.
27 |
28 |
--------------------------------------------------------------------------------
/07 - Layout and Positioning/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/08 - Transforms/Listing_8-1.html:
--------------------------------------------------------------------------------
1 |
10 |
11 |
13 |
--------------------------------------------------------------------------------
/08 - Transforms/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-1.css:
--------------------------------------------------------------------------------
1 | button.fancy-button {
2 | background: blue;
3 | }
4 |
5 | button.fancy-button:hover {
6 | background: red;
7 | transform: scale(1.1);
8 | }
9 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-10.html:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-11.css:
--------------------------------------------------------------------------------
1 | @media (prefers-reduced-motion: reduce) {
2 | .loader {
3 | animation: none;
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-2.css:
--------------------------------------------------------------------------------
1 | button.fancy-button {
2 | background: blue;
3 | transition: 500ms;
4 | }
5 |
6 | button.fancy-button:hover {
7 | background: red;
8 | transform: scale(1.1);
9 | }
10 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-3.css:
--------------------------------------------------------------------------------
1 | button.fancy-button {
2 | background: blue;
3 | transition: background-color 500ms,
4 | transform 500ms 500ms;
5 | }
6 |
7 | button.fancy-button:hover {
8 | background: red;
9 | transform: scale(1.1);
10 | }
11 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-4.css:
--------------------------------------------------------------------------------
1 | button.fancy-button {
2 | background: blue;
3 | transition-property: background-color, transform;
4 | transition-duration: 500ms, 500ms;
5 | transition-delay: 0ms, 500ms;
6 | }
7 |
8 | button.fancy-button:hover {
9 | background: red;
10 | transform: scale(1.1);
11 | }
12 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-5.css:
--------------------------------------------------------------------------------
1 | @keyframes colors {
2 | 0% {
3 | background: red;
4 | }
5 |
6 | 50% {
7 | background: blue;
8 | }
9 |
10 | 100% {
11 | background: green;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-6.html:
--------------------------------------------------------------------------------
1 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-7.html:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-8.html:
--------------------------------------------------------------------------------
1 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/Listing_9-9.css:
--------------------------------------------------------------------------------
1 | .my-element {
2 | will-change: transform, opacity;
3 | }
4 |
--------------------------------------------------------------------------------
/09 - Transitions and Animations/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/10 - Flexbox/Listing_10-1.html:
--------------------------------------------------------------------------------
1 |
25 |
26 |
21 |
--------------------------------------------------------------------------------
/10 - Flexbox/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/11 - Responsive Design/Listing_11-1.css:
--------------------------------------------------------------------------------
1 | h1 {
2 | color: red;
3 | }
4 |
5 | @media screen and (max-width: 400px) {
6 | h1 {
7 | color: blue;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/11 - Responsive Design/Listing_11-10.css:
--------------------------------------------------------------------------------
1 | @media screen and (max-width: 700px) {
2 | .main {
3 | flex-direction: column;
4 | }
5 |
6 | .sidebar {
7 | flex-direction: row;
8 | justify-content: center;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/11 - Responsive Design/Listing_11-11.css:
--------------------------------------------------------------------------------
1 | @media screen and (max-width: 700px) {
2 | .main {
3 | flex-direction: column;
4 | }
5 |
6 | .sidebar {
7 | flex-direction: row;
8 | justify-content: center;
9 | flex-wrap: wrap;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/11 - Responsive Design/Listing_11-2.css:
--------------------------------------------------------------------------------
1 | @media screen and (max-width: 785px) {
2 | h1 {
3 | font-size: 3rem;
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/11 - Responsive Design/Listing_11-3.css:
--------------------------------------------------------------------------------
1 | @media screen and (max-width: 785px) {
2 | h1 {
3 | font-size: 3rem;
4 | }
5 | }
6 |
7 | @media screen and (max-width: 480px) {
8 | h1 {
9 | font-size: 2rem;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/11 - Responsive Design/Listing_11-4.css:
--------------------------------------------------------------------------------
1 | @media screen and (max-width: 785px) {
2 | h1 {
3 | font-size: 3rem;
4 | }
5 | }
6 |
7 | @media screen and (max-width: 480px) {
8 | h1 {
9 | font-size: 2rem;
10 | }
11 |
12 | img {
13 | width: 250px;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/11 - Responsive Design/Listing_11-5.html:
--------------------------------------------------------------------------------
1 |
22 |
23 |
70 |
--------------------------------------------------------------------------------
/11 - Responsive Design/Listing_11-9.css:
--------------------------------------------------------------------------------
1 | @media screen and (max-width: 700px) {
2 | .main {
3 | flex-direction: column;
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/11 - Responsive Design/cat.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Apress/modern-css/cea922754a117becdfcff9e15002909760d7484b/11 - Responsive Design/cat.jpeg
--------------------------------------------------------------------------------
/11 - Responsive Design/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/12 - CSS Grid/Listing_12-1.html:
--------------------------------------------------------------------------------
1 |
14 |
15 |
24 |
--------------------------------------------------------------------------------
/12 - CSS Grid/desktop.ini:
--------------------------------------------------------------------------------
1 | [ . S h e l l C l a s s I n f o ]
2 | C o n f i r m F i l e O p = 0
3 | I c o n R e s o u r c e = C : \ P r o g r a m F i l e s \ G o o g l e \ D r i v e F i l e S t r e a m \ 4 2 . 0 . 1 1 . 0 \ G o o g l e D r i v e F S . e x e , 2 1
4 |
--------------------------------------------------------------------------------
/9781484262931.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Apress/modern-css/cea922754a117becdfcff9e15002909760d7484b/9781484262931.jpg
--------------------------------------------------------------------------------
/Contributing.md:
--------------------------------------------------------------------------------
1 | # Contributing to Apress Source Code
2 |
3 | Copyright for Apress source code belongs to the author(s). However, under fair use you are encouraged to fork and contribute minor corrections and updates for the benefit of the author(s) and other readers.
4 |
5 | ## How to Contribute
6 |
7 | 1. Make sure you have a GitHub account.
8 | 2. Fork the repository for the relevant book.
9 | 3. Create a new branch on which to make your change, e.g.
10 | `git checkout -b my_code_contribution`
11 | 4. Commit your change. Include a commit message describing the correction. Please note that if your commit message is not clear, the correction will not be accepted.
12 | 5. Submit a pull request.
13 |
14 | Thank you for your contribution!
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Freeware License, some rights reserved
2 |
3 | Copyright (c) 2020 Joe Attardi
4 |
5 | Permission is hereby granted, free of charge, to anyone obtaining a copy
6 | of this software and associated documentation files (the "Software"),
7 | to work with the Software within the limits of freeware distribution and fair use.
8 | This includes the rights to use, copy, and modify the Software for personal use.
9 | Users are also allowed and encouraged to submit corrections and modifications
10 | to the Software for the benefit of other users.
11 |
12 | It is not allowed to reuse, modify, or redistribute the Software for
13 | commercial use in any way, or for a user’s educational materials such as books
14 | or blog articles without prior permission from the copyright holder.
15 |
16 | The above copyright notice and this permission notice need to be included
17 | in all copies or substantial portions of the software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | SOFTWARE.
26 |
27 |
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Apress Source Code
2 |
3 | This repository accompanies [*Modern CSS*](http://www.apress.com/9781484262931) by Joe Attardi (Apress, 2020).
4 |
5 | [comment]: #cover
6 | 
7 |
8 | Download the files as a zip using the green button, or clone the repository to your machine using Git.
9 |
10 | ## Releases
11 |
12 | Release v1.0 corresponds to the code in the published book, without corrections or updates.
13 |
14 | ## Contributions
15 |
16 | See the file Contributing.md for more information on how you can contribute to this repository.
--------------------------------------------------------------------------------
/errata.md:
--------------------------------------------------------------------------------
1 | # Errata for *Modern CSS*
2 |
3 | ## Chapter 2: CSS Selectors
4 |
5 | ### Page 18
6 |
7 | The caption for Listing 2-2 should read:
8 |
9 | > Applying a margin to all p elements.
10 |
11 | ### Page 25
12 |
13 | Under the `:nth-child` pseudo-class, the description of `nth-child(4n)` should read:
14 |
15 | > Or we could select every *fourth* item with the selector `.my-list > li:nth-child(4n)`.
16 |
17 | ## Chapter 3: Basic CSS Concepts
18 |
19 | ### Page 49
20 |
21 | The second-to-last sentence on this page should read:
22 |
23 | > There is a newer syntax for these functions that *is* slightly different.
24 |
25 | ### Page 50
26 |
27 | The hex code on the last bullet, pure red with 50% alpha, should be `#FF000080`.
28 |
29 | ## Chapter 4: Basic Styling
30 |
31 | ### Page 68
32 |
33 | The second-to-last sentence on this page should read:
34 |
35 | > Note that when you specify border-radius in this way, an elliptical border-radius does not have a slash separating the horizontal and vertical *radii*.
36 |
37 | ### Page 71
38 |
39 | In the paragraph before Listing 4-11, the first sentence should read:
40 |
41 | > If we add a spread radius and set the blur radius to zero, as shown in Listing 4-11, we can see that the shadow size grows by the spread radius *only*.
42 |
43 | ## Chapter 6: Text Styling
44 |
45 | ### Page 117
46 |
47 | In Listing 6-11, there should be extra whitespace between `is` and `some` in order to produce the result in Figure 6-10.
48 |
49 | ## Chapter 8: Transforms
50 |
51 | ### Page 171
52 |
53 | The italic text in Listing 8-10 is a formatting error and has no special meaning.
54 |
55 | ### Pages 182-184
56 |
57 | The italic text in Listing 8-16 is a formatting error and has no special meaning.
--------------------------------------------------------------------------------