ArticleslgStudy

science

Style sheet language

Style sheet language is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Style sheet language rather than just read about it. In short: A style sheet language, or style language, is a computer language that expresses the presentation of structured documents. One attractive feature of structured documents is that the content can be reused in many contexts and presented in various ways.

Style sheet language — main illustration
Style sheet language — illustration

Key takeaways

  • Style sheet language belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Style sheet language to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Style sheet language from memory before moving on to harder problems.

Reference excerpt

A style sheet language, or style language, is a computer language that expresses the presentation of structured documents. One attractive feature of structured documents is that the content can be reused in many contexts and presented in various ways. Different style sheets can be attached to the logical structure to produce different presentations. One modern style sheet language with widespread use is Cascading Style Sheets (CSS), which is used to style documents written in HTML, XHTML, SVG, XUL, and other markup languages. For content in structured documents to be presented, a set of stylistic rules – describing, for example, colors, fonts and layout – must be applied. A collection of stylistic rules is called a style sheet. Style sheets in the form of written documents have a long history of use by editors and typographers to ensure consistency of presentation, spelling and punctuation. In electronic publishing, style sheet languages are mostly used in the context of visual presentation rather than spelling and punctuation.

Components All style sheet languages offer functionality in these areas:

Syntax A style sheet language needs a syntax in order to be expressed in a machine-readable manner. For example, here is a simple style sheet written in the CSS syntax:This says that headings on level 1 should be displayed in a font size of 1.5 times the font size of the surrounding text. Selectors Selectors specify which elements are to be influenced by the style rule. As such, selectors are the glue between the structure of the document and the stylistic rules in the style sheets. In the example above, the "h1" selector selects all h1 elements. More complex selectors can select elements based on, e.g., their context, attributes and content. Properties All style sheet languages have some concept of properties that can be given values to change one aspect of rendering an element. The "font-size" property of CSS is used in the above example. Common style sheet languages typically have around 50 properties to describe the presentation of documents. Values and units Properties change the rendering of an element by being assigned a certain value. The value can be a string, a keyword, a number, or a number with a unit identifier. Also, values can be lists or expressions involving several of the aforementioned values. A typical value in a visual style sheet is a length; for example, "1.5em" which consists of a number (1.5) and a unit (em). The "em" value in CSS refers to the font size of the surrounding text. Common style sheet languages have around ten different units. Value propagation mechanism To avoid having to specify explicitly all values for all properties on all elements, style sheet languages have mechanisms to propagate values automatically. The main benefit of value propagation is less-verbose style sheets. In the example above, only the font size is specified; other values will be found through value propagation mechanisms. Inheritance, initial values and cascading are examples of value propagation mechanisms. Formatting model All style sheet languages support some kind of formatting model. Most style sheet languages have a visual formatting model that describes, in some detail, how text and other content is laid out in the final presentation. For example, the CSS formatting model specifies that block-level elements (of which "h1" is an example) extend to fill the width of the parent element. Some style sheet languages also have an aural formatting model.

References

Illustrations

Style sheet language: Snapshot of CSS, a style sheet language
Snapshot of CSS, a style sheet language

Worked examples

Example 1 — a first encounter with Style sheet language

Start with the simplest possible case. Write down what Style sheet language claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Style sheet language before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Style sheet language ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Style sheet language

In research
Style sheet language appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Style sheet language in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Style sheet language is common in secondary-school and first-year university syllabi. It links to neighbouring topics Stylesheet languages, so understanding it makes those chapters shorter.
In everyday life
Look for Style sheet language outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Style sheet language in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Style sheet language means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Style sheet language out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Style sheet language in simple terms?

A style sheet language, or style language, is a computer language that expresses the presentation of structured documents. One attractive feature of structured documents is that the content can be reused in many contexts and presented in various ways.

Why does Style sheet language matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Style sheet language?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Style sheet language.

Tags

  • Stylesheet languages

Keep exploring