What Is CSS?

Written by Coursera Staff • Updated on

CSS, or Cascading Style Sheets, in a programming language that offers stylistic choices for web design. Deepen your understanding of Cascading Style Sheets (CSS), one of the key technologies in website creation.

[Featured Image] Two web developers are looking at a computer monitor designing a cascading style sheet.

Building websites is a multifaceted process that necessitates a range of skills and technologies. Notably, HTML and CSS serve as the fundamental technologies underpinning websites. When skillfully combined, HTML and CSS empower developers to craft visually captivating, well-structured websites, enhancing user engagement.

Explore the fundamentals of CSS, covering its syntax, features, benefits, and more below. 

What does CSS stand for?

CSS is an acronym for Cascading Style Sheets. In web development, a style sheet refers to a document that includes guidelines and directives governing the presentation of elements within a web page. CSS adjusts the font, size, or decorative flourishes like animations or images. 

Every web browser comes equipped with a default style sheet. However, most web pages feature custom CSS styles configured by web designers, which override the default CSS settings. The cascading nature of CSS ensures that the last defined style sheet takes precedence. 

Read more: How to Become a Web Developer

The origin of CSS

The concept of styling a website emerged as early as 1994. While no single individual invented CSS, Håkon Wium Lie, a Norwegian web pioneer and computer scientist, proposed the original idea.

Soon afterward, Bert Bos, a renowned Dutch computer scientist known for his contributions to the Argo browser, partnered with Lie to develop the CSS specification. Lie and Bos authored the first official CSS specification, published by the World Wide Web Consortium (W3C) in 1996. 

How does CSS work? 

If hypertext markup language (HTML) is the skeleton of a book, outlining the chapters, sections, and content, then CSS serves as the book’s cover design and typography, enticing readers to pick up and explore the book.

More technically, HTML elements represent different components on a web page, such as a paragraph or a heading. For example, this is an HTML tag:

<p>This is a paragraph</p> 

Remember, the paragraph on its own lacks styling. The following CSS code, however, can style this paragraph: 

p  {  color: purple;  font-weight: bold;  }

In the CSS mentioned above, “p” acts as the selector, specifying that the styling applies to all HTML paragraphs. The code within the curly brackets forms the declaration, which includes properties (color and font) and their corresponding values (purple and bold) that the selector will inherit. 

Similarly, altering the values can achieve various styles. For example, a property like “background-color” can have values like “red” or “blue, “background-position” can have values like “top” or “bottom,” and “text-align” can have values like “center,” “right,” or “left.”

Did you know? US government websites use “usa” as a prefix for CSS selectors (e.g., .usa-button) to prevent possible conflicts with styles not associated with the US Web Design System [1].

Placeholder

Types of CSS

A web designer may harness one of three CSS types to style and customize a website: inline, embedded (internal), or external. Let’s explore each of them in detail below.

Inline CSS

Inline CSS applies styles to a single HTML element and defines them within its style attribute. This approach is useful for rapidly previewing, testing, or addressing issues with web pages. However, excessive inline CSS can cause the HTML structure to become disorderly.

Embedded CSS 

Embedded or internal CSS involves placing the CSS code directly within the HTML file. This is useful when applying a unique style to a specific HTML page. However, using embedded CSS for multiple pages can be tedious, as the CSS style must be added individually to each page.

External CSS

External CSS is particularly useful for styling large websites. To apply external CSS, web pages must connect to an external.css file. The approach enables web designers or developers to maintain a consistent style across all pages. Then again, it’s important to note that using multiple CSS files may impact website loading time. 

In summary, the use of inline CSS applies to individual elements, while embedded CSS pertains to specific pages, and external CSS serves for styling an entire website. Choosing the right CSS type depends on the project’s unique requirements and scope, considering the advantages and disadvantages of each approach in website styling.

Pros and cons of using CSS

Every programming language has its strengths and weaknesses. Let’s look at some notable advantages and disadvantages of using CSS in web development:

Advantages

  • Support for simultaneous application of styles across multiple web pages

  • CSS’ minimal code enhances website loading speed, boosting search engine rankings

  • Streamlining site upkeep, CSS allows changes to website design elements without altering the underlying HTML code.

Disadvantages

  • Choosing the right CSS type can be confusing

  • CSS code fragmentation across web browsers may cause compatibility issues

Why learn CSS?

Whether you are a beginner or a professional, learning CSS comes with many perks, including:

  1. Learning CSS allows you to comprehend the essential building blocks of the web. This knowledge can benefit various professions, including marketing, design, and more.

  2. You can create your own website using CSS, saving money on start-up costs while also enhancing brand identity and customer experience.

  3. Proficiency in CSS makes it easier to learn and master additional coding languages, such as HTML and JavaScript, which can broaden your skill set and job prospects.

  4. Freelancing your web development skills can help you earn extra income alongside your regular job or studies. 

Career in web development

You can begin a career in web development without a college degree. Online coding and web development bootcamps offer a path to acquire the necessary skills for entry-level jobs in web design. If you are a student, enrolling in a university that offers computer science, graphic design, or computer engineering as a specialization is your best bet. Below are the job roles where you can apply your CSS skills, along with their average yearly salaries:

Web designer

Average annual US base salary (Glassdoor): $69,120 [2]

Job outlook (projected growth from 2022 to 2032): 8 percent [3]

As a web designer, you’ll specialize in creating a website’s layout and features tailored to your client’s target audience. Additionally, you will help determine the website's technical requirements and make updates as needed.

Front-end developer 

Average annual US base salary (Glassdoor): $85,758 [4]

Job outlook (projected growth from 2022 to 2032): 8 percent [3]

In your role as a front-end developer, you will design and build user interfaces (UI) for websites and applications. Furthermore, as a liaison between end users and back-end developers, you will work toward ensuring websites and apps are accessible and compatible across different browsers.

Web developer

Average annual US base salary (Glassdoor): $80,958 [5]

Job outlook (projected growth from 2022 to 2032): 8 percent [3]

As a web developer, you manage both the visual and technical aspects of the website. From crafting the layout to implementing essential functionalities, you’ll be involved in all aspects of the website creation process.

Read more: How to Become a Web Developer Without a Degree

Learning more about CSS and web design with Coursera 

CSS is a fundamental aspect of web design that styles the HTML structural elements of a website by using cascading style sheets that dictate the style of each element. Understanding CSS in conjunction with HTML and JavaScript gives way to a web development and design career. Hone your CSS skills with the Introduction to CSS3 course on Coursera. This course, which takes approximately 16 hours to complete, is beginner-friendly and focuses on CSS rules, code testing, and more. It is just one of five courses in Web Design for Everybody: Basics of Web Development & Coding Specialization from the University of Michigan, also on Coursera.

Article sources

1

US Web Design System. “For developers, https://v1.designsystem.digital.gov/documentation/developers/#css-architecture.” Accessed September 4, 2024.

Keep reading

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.