diff --git a/front/docs/CSS.md b/front/docs/CSS.md new file mode 100644 index 0000000..d18faaf --- /dev/null +++ b/front/docs/CSS.md @@ -0,0 +1,84 @@ +# CSS + +## What is CSS? + +CSS (Cascading Style Sheets) is the language that allows you to style and layout HTML web pages. This article explains what CSS is, with some simple syntax examples, and also covers some key terms about the language. + +Since this document relates specifically to **Chatty-pub**, the focus is going to be on the parts of the language that are supported by this platform. Because CSS is specifically oriented towards styling HTML (and related languages like SVG and XML) you have to have a basic understanding of HTML.[^1] Mozilla has an excellent [HTML introduction](https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Getting_started). + +At its heart, HTML is a fairly simple language made up of elements, which can be applied to pieces of text to give them different meaning in a document (Is it a paragraph? Is it a bulleted list? Is it part of a table?), structure a document into logical sections (Does it have a header? Three columns of content? A navigation menu?), and embed content such as images and videos into a page. +But what HTML does not do is speficy how these elements should look. That is where CSS comes in. + +CSS can be used for very basic document text styling — for example changing the color and size of headings and links. It can be used to create layout — for example turning a single column of text into a layout with a main content area and a sidebar for related information. It can even be used for effects such as animation. +In Chatty-pub we're mostly interested in the first part. + +### Rules + +#### _Elements and Classes_ + +In this section we will talk about CSS in general. Chatty-pub uses a slight variation on it, but it is good to know the basics, right? + +CSS is a rule-based language — you define rules specifying groups of styles that should be applied to particular elements or groups of elements on your web page. For example "I want the main heading on my page to be shown as large red text." + +The following code shows a very simple CSS rule that would achieve the styling described above: + +```lang-css +h1 { + color: red; + font-size: 5em; +} +``` + +The rule opens with a selector. This selects the HTML element that we are going to style. In this case we are styling all level one headings (`