CSS - Design
Instructors: Jess, Carmen, and Eda
Design
Before this session, please:
- Read User-Centered Design: What Is User-Centered Design? and take notes
- Read User-Centered Design: What Are User Requirements, User Research, and Testing? and take notes
- Read User-Centered Design: What Are Best Practices for Designing a Dark Mode Feature? and take notes
- Read User-Centered Design: What Are Best Practices for Designing Breadcrumbs? and take notes
- Read User-Centered Design: What Are Best Practices for Designing Cards? and take notes
- Read User-Centered Design: What Are Best Practices for Designing Infinite Scrolls? and take notes
- Read User-Centered Design: What Are Best Practices for Designing Modal Dialogs? and take notes
- Read User-Centered Design: What Are Best Practices for Progress Indication on Forms, Registration, and Setup? and take notes
- Read User-Centered Design: What Are Best Practices for Designing Shopping Carts? and take notes
- Read User-Centered Design: What Is Progressive Disclosure? and take notes
- Read User-Centered Design: What Is Deferred and Lazy Registration? and take notes
- Read Common Design Tools: What Are Design Briefs and How Do Developers Work with Them? and take notes
- Read Common Design Tools: What Are Some Common Tools Developers Should Know About That Are Used by Designers in the Industry? and take notes
- Read Design Fundamentals Review and take notes
- Complete Design Fundamentals Quiz solo to test your knowledge of design fundamentals
During this session, we’ll:
- Review notes
- Review notes
- Review notes
- Review notes
- Review notes
- Review notes
- Review notes
- Review notes
- Review notes
- Review notes
- Review notes
- Review notes
- Review notes
- Review notes
After this session, please:
- Read Working with Relative and Absolute Units: What Are Absolute Units in CSS, and When Should You Use Them? and take notes
- Read Working with Relative and Absolute Units: What Are Percentages in CSS, and When Should You Use Them? and take notes
- Read Working with Relative and Absolute Units: What Are ems and rems in CSS, and When Should You Use Them? and take notes
- Read Working with Relative and Absolute Units: What Are vh and vw Units, and When Should You Use Them? and take notes
- Read Working with Relative and Absolute Units: What Is the calc() Function, and How Does It Work? and take notes
- Complete Build an Event Flyer Page solo over the next few days. It would be wonderful to see learners creating flyers for events on topics they’re interested in.
- Read CSS Relative and Absolute Units Review and take notes
- Complete CSS Relative and Absolute Units Quiz solo to test your understaing of CSS units
Instructor notes
User-Centered Design: What Is User-Centered Design?
The purpose of user-centered design is prioritizing the end user, the person using the application or viewing the website.
Some aspects of user-centered design include:
- Target demographics. For example, creating more eye-catching designs for younger demographics to capture their attention.
- Considering the goal of end users. For example, creating an easy-to-use interface for users to be able to see the product details and find the “add to cart” button for an e-commerce application.
We may also use an analytics tool for measuring how users engage with our websites and understanding “user behavior.” However, we should be mindful of privacy considerations.
User-Centered Design: What Are User Requirements, User Research, and Testing?
User research is for measuring user needs, behaviors, and pain points.
One common measure is the Net Promoter Score (NPS). It measures the likelihood of users recommending your product to a friend. It’s measured on a scale from 0 to 10 (with 9-10 indicating that they’re most likely to recommend) through a survey during key milestones, like after 7 days, 30 days, or 90 days after using the product.
Exit interviews are also helpful for user research, and they’re the survey shown to users when they cancel their subscription or delete their account.
User testing is about gathering data from users as they interact with the application. One example is A/B testing, and it involves shipping a new feature to randomly selected users only. Then developers can determine if the feature is useful through analytics gathered from that data.
User requirements is the rubric that the application should follow. It’s dynamic, meaning that it changes as the user base changes.
User-Centered Design: What Are Best Practices for Designing a Dark Mode Feature?
With dark mode, we can define a dark color scheme for our websites and let users switch to it if they want to. It’s helpful to reduce eye strain and improve readability in low-light conditions.
There are some things to consider when designing dark mode:
- Avoiding saturated (bright and intense) colors.
- Avoiding pure black backgrounds with white text. It has high contrast and can be painful for eyes. Instead, we can use a dark gray background with a light gray text color.
- Making sure that the dark mode colors are consistent with the brand logo and color scheme.
User-Centered Design: What Are Best Practices for Designing Breadcrumbs?
Breadcrumbs are a navigation aid, showing the user where they are in the website’s hierarchy.
1<div class="breadcrumbs">
2 <span><a href="/">Home</a> ></span>
3 <span><a href="/books/">Books</a> ></span>
4 <span><a href="/books/genres/">Genres</a> ></span>
5 <span><a href="/books/genres/horror/">Horror</a></span>
6</div>Some considerations when using breadcrumbs are:
- The separator character. The commonly used characters are the greater than sign (
>), right angle quotation marks (»), and the forward slash (/). The escape character for the greater than sign is>and for right angle quotation marks it’s». - The placement. Breadcrumbs are usually placed at the top of the page and below the main navigation bar. They should be easy to locate.
- The size. They should be large enough to be noticed but not too large to distract the users.
This page itself has breadcrumbs!
User-Centered Design: What Are Best Practices for Designing Cards?
Cards are used to convey information in a structured way, and they are usually common in e-commerce, social media, and news websites.
Some things to consider when designing cards are:
- Simplicity. We should avoid adding too much information and visual clutter.
- Clickability. We should make sure that it’s understandable (a good accessibility principle!) what part of the card is clickable.
- The use of media. If the images are of higher quality, the card will draw more attention, for example.
- The use of color hierarchy. We should make sure that the most important information draws the most attention. We can make use of color to help with this.
User-Centered Design: What Are Best Practices for Designing Infinite Scrolls?
Usually, social media sites include a design pattern called infinite scrolling, loading more content as the user scrolls down the page.
Pagination is another design pattern that breaks up the content into different pages. Infinite scrolling can sometimes be used instead of pagination.
Some things to consider when implementing infinite scrolling:
- Adding a “Load more” button to load the next set of results when the user clicks on it. In that way, we can give the user more control and provide a way to lessen “doomscrolling.”
- Adding a “Back to the top” button that gives the users the ability to go back to the previous page without having to scroll to the top.
- Adding a loading indicator. It’s a good way to show that the new content is loading so that the users won’t think the site is broken or something went wrong.
- Keeping the footer content accessible. The content that is loaded through infinite scroll shouldn’t affect the accessibility of the footer.
User-Centered Design: What Are Best Practices for Designing Modal Dialogs?
A modal is kind of a pop-up window. We can create modals using the HTML dialog element.
Usually, the content behind the modal is dimmed or blurred to draw attention to the interactive nature of the modal content. Also, it’s good practice to provide the ability to close the modal when the user clicks outside the modal area.
Modals usually have a call-to-action (CTA) button and should also include a close button.
User-Centered Design: What Are Best Practices for Progress Indication on Forms, Registration, and Setup?
With progress indication, we can make sure that it’s clear for users where they are in a process such as registration, forms, or a setup process.
Some things to consider when designing progress indication:
- Simplicity. We should avoid providing too much information.
- Providing an ability for the user to go back to previous steps.
- Make the progress indication easy to find.
- Providing clear section titles/percentages/steps.
User-Centered Design: What Are Best Practices for Designing Shopping Carts?
A shopping cart is an important part of e-commerce websites.
Some considerations for designing a shopping cart:
- Visibility. Usually, shopping carts are displayed in the upper right corner of the page, along with the number of items that it has. It should be clickable so that the user can see more details about the items they added.
- Providing a clear way to update the amount of items. For each item, we can add an input field next to it to update the amount. We should also add a “Remove” button for each item for ease of use.
- The shopping cart icon. It should be easily recognizable, like a shopping cart with a handle and wheels!
It should also be easy to find the total cost of all the items in the cart.
We should also provide a call-to-action (CTA) button to guide the users to proceed to the checkout.
Here is an example from the freeCodeCamp lesson page:
1<div class="shopping-cart">
2 <button id="cart-btn" aria-label="Shopping cart">
3 <svg
4 xmlns="http://www.w3.org/2000/svg"
5 width="28"
6 height="28"
7 fill="none"
8 stroke="currentColor"
9 stroke-width="2"
10 stroke-linecap="round"
11 stroke-linejoin="round"
12 class="feather feather-shopping-cart"
13 viewBox="0 0 24 24"
14 aria-hidden="true"
15 focusable="false"
16 >
17 <circle cx="9" cy="21" r="1"></circle>
18 <circle cx="20" cy="21" r="1"></circle>
19 <path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path>
20 </svg>
21 <span id="item-count">3</span>
22 </button>
23 <div id="cart-details">
24 <ul id="cart-items">
25 <li>T-Shirt x2 - $40.00</li>
26 <li>Hat x1 - $15.00</li>
27 </ul>
28 <div id="cart-total">
29 Total: <strong>$55.00</strong>
30 </div>
31 <button id="checkout-btn">Proceed to Checkout</button>
32 </div>
33</div> 1:root {
2 --primary-color: #007bff;
3}
4
5.shopping-cart {
6 position: fixed;
7 top: 20px;
8 right: 20px;
9 font-family: sans-serif;
10 width: 280px;
11 background: white;
12 border: 1px solid #ccc;
13 padding: 10px;
14 box-shadow: 0 4px 8px rgba(0,0,0,0.1);
15 border-radius: 6px;
16}
17
18#cart-btn {
19 background: none;
20 border: none;
21 cursor: default;
22 position: relative;
23 display: flex;
24 align-items: center;
25 padding: 4px;
26 color: #333;
27 font-size: 28px;
28}
29
30#item-count {
31 background: red;
32 color: white;
33 border-radius: 50%;
34 padding: 2px 7px;
35 font-size: 14px;
36 position: absolute;
37 top: -6px;
38 right: -6px;
39 min-width: 18px;
40 height: 18px;
41 line-height: 14px;
42 text-align: center;
43 font-weight: 700;
44 user-select: none;
45 box-sizing: border-box;
46}
47
48#cart-details {
49 margin-top: 10px;
50}
51
52#cart-items {
53 list-style: none;
54 padding: 0;
55 margin: 0 0 10px 0;
56 font-size: 1rem;
57}
58
59#cart-items li {
60 padding: 5px 0;
61 border-bottom: 1px solid #eee;
62}
63
64#cart-total {
65 font-size: 1.2rem;
66 font-weight: 700;
67 text-align: right;
68 color: #111;
69 margin-bottom: 15px;
70}
71
72#checkout-btn {
73 width: 100%;
74 background-color: var(--primary-color);
75 color: white;
76 border: none;
77 padding: 12px 0;
78 font-size: 1.1rem;
79 font-weight: 700;
80 border-radius: 6px;
81 cursor: pointer;
82 transition: background-color 0.3s ease;
83}
84
85#checkout-btn:hover,
86#checkout-btn:focus {
87 background-color: #0056b3;
88 outline: none;
89}User-Centered Design: What Is Progressive Disclosure?
With progressive disclosure, we can show users only the relevant content based on their current activity and hide the other elements. It’s helpful for reducing cognitive load.
An example is providing a “More details” button for items on an e-commerce website.
Some things to consider when designing progressive disclosure elements are:
- Keep the important information always visible.
- Providing a single access point for additional information. It could be a button that’s always visible on the page.
User-Centered Design: What Is Deferred and Lazy Registration?
Lazy registration is the name of a design pattern that lets users browse and interact with the content of the application without registering for an account.
An example is the ability to add items to a shopping cart on an e-commerce website and only having to register/login when proceeding to checkout.
Another example is YouTube. Without having to register/sign in, users can watch the videos, but for other features like commenting, they need to register/sign in.
Common Design Tools: What Are Design Briefs and How Do Developers Work with Them?
A design brief is a document that outlines the goals and requirements of a project. It guides the design process.
Usually, it’s the client that writes the design brief.
Some things to include in a design brief are:
- The overview of the project that includes company details, mission, values, products, etc.
- The goals of the project that include the purpose and the desired outcomes.
- The target audience.
- The project scope, including deliverables (which includes a list of items that will be produced as part of the project like final designs), a timeline, and a budget.
We should be realistic about the timeline and budget and make sure to add these constraints to the design brief.
Once the design brief is reviewed and approved by all the stakeholders, designers can start with their work.
The developer’s role here is to review and understand the design requirements and create a working product.
Common Design Tools: What Are Some Common Tools Developers Should Know About That Are Used by Designers in the Industry?
There are two important features that most design tools offer:
- vector-based design: creating digital art using mathematical formulas to define lines, shapes, and colors
- prototyping: the process of creating an interactive model of a product.
Some common design tools are:
- Figma. It’s a cloud-based tool and offers a lot of built-in features such as vector-based design, automatic layout, real-time collaboration, and so on.
- Sketch. It’s used by designers to quickly create prototypes, UIs, icons, etc. It’s only available on macOS.
- Adobe XD. It’s a vector-based design and prototyping tool.
- Canva. It’s another popular design tool that offers a lot of templates and design elements.
Design Fundamentals Review
We’ve learned a lot about design fundamentals in this section! Here are some of the things we’ve looked at:
- Design Terminology
- UI Design Fundamentals
- Design Best Practices
- Common Design Tools