Wexa.css & Book.css

Two CSS frameworks to make books easy and accessible

Description

This page shows how a website looks like if this code is added to the <head>:

<link
    rel="stylesheet"
    href="https://sourceforge.net/p/whakerexa/code/ci/master/tree/statics/css/wexa.css?format=raw"
    media="all" />
<link
    rel="stylesheet"
    href="https://sourceforge.net/p/whakerexa/code/ci/master/tree/statics/css/book.css?format=raw"
    media="all" />
            

Overview

wexa.css is a CSS framework intended to be as simple as possible to make accessible web content, and to minimize the use of CSS classes for enhancing the readability of HTML code, like it should always be! wexa.css is the main CSS framework of Whakerexa. See the wexa.css documentation for details.

book.css is a CSS framework designed to make HTML content resemble a book. It includes features for implementing chapters, sections, and subsections, along with an auto-numbering function.

Not convinced? Take a look at the source code of this page!

The custom classes

book.css has a built-in feature that automatically assigns numbers to chapters, sections, or subsections without manual intervention. Let's show how to do it!

Add the following classes into your document, and book.css does the rest:

  1. chapter
  2. ssection
  3. subssection

Example of use:

<section class="chapter">
<h1> Chapter title </h1>
    <section class="ssection">
    <h2> Section title </h2>
        <section class="subssection">
        <h3> Sub-Section title </h3>
        <section>
    <section>
<section>
                

The <section> element is used here instead of the nonsensical <div>. Both will be displayed the same way, but screen readers interpret a section in a more appropriate manner, unlike a div!

The <section> element in HTML is semantic and indicates a thematic grouping of content, making it useful for screen readers to understand the structure and context of the content. This can assist users who rely on screen readers to navigate and understand web pages more effectively. It is then perfectly suitable to indicate the chapters and sections. Fot the h3 level, the section can effectively be replaced by article.

Notice that a proper semantic markup, including correct usage of "section", "article", "header", "footer", etc., can significantly enhance accessibility for users of assistive technologies like screen readers.

The variables

Only one variable is introduced. It allows to fix the color of the numbering.

<style>
    :root {
        /* if you like gray */
        --numbers-color: rgb(60, 60, 60);
    }
    .dark {
        --numbers-color: rgb(180, 180, 180);
    }
</style>

Demonstration: what's possible with both wexa.css and book.css?

Example of non-numbered Heading 1

Example of non-numbered Heading 2

Example of non-numbered Heading 3

Dark mode applied

No specific class applied except the font choice

Sans

This is a short text embedded into a p tag with no specific class. This is then the default font style, padding and margin, etc. This is then the bold default font style. This is then the italic default font style. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this file, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Serif

This is a short text embedded into a p tag with no serif class. This is the serif font style, with default padding and margin, etc. This is the bold font style. This is the italic font style. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this file, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Mono

This is a short text embedded into a p tag with no serif class. This is the mono font style, with default padding and margin, etc. This is the bold font style. This is the italic font style. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this file, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Pre

This is a short text embedded into a p tag with no serif class. This is the pre font style, with default padding and margin, etc. This is the bold font style. This is the italic font style. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this file, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

With high contrast inside dark mode

Sans

This is a short text embedded into a p tag with no specific class. This is then the default font style, padding and margin, etc. This is then the bold default font style. This is then the italic default font style. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this file, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Serif

This is a short text embedded into a p tag with no serif class. This is the serif font style, with default padding and margin, etc. This is the bold font style. This is the italic font style. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this file, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Mono

This is a short text embedded into a p tag with no serif class. This is the mono font style, with default padding and margin, etc. This is the bold font style. This is the italic font style. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this file, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Pre

This is a short text embedded into a p tag with no serif class. This is the pre font style, with default padding and margin, etc. This is the bold font style. This is the italic font style. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this file, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

With weight-specific classes applied

Sans Font Normal view

This is Sans Font with weight-thin.

This is Sans Font with weight-normal.

This is Sans Font with weight-bold.

This is Sans Font with weight-black.

Sans Font Contrast view

This is Sans Font with contrast weight-thin.

This is Sans Font with contrast weight-normal.

This is Sans Font with contrast weight-bold.

This is Sans Font with contrast weight-black.

Serif Font Normal view

This is Serif Font with weight-thin.

This is Serif Font with weight-normal.

This is Serif Font with weight-bold.

This is Serif Font with weight-black.

Serif Font Contrast view

This is Serif Font with contrast weight-thin.

This is Serif Font with contrast weight-normal.

This is Serif Font with contrast weight-bold.

This is Serif Font with contrast weight-black.

HTML tags for embed text

So, this is a text with a Primary link inside...

Bold Italic Underline Deleted Inserted Strikethrough Small Text Sub Text Sup Abbr. Kbd Highlighted

Blockquote

La règle d'or de la conduite est la tolérance mutuelle, car nous ne penserons jamais tous de la même façon, nous ne verrons qu'une partie de la vérité et sous des angles différents. — Ghandi

Lists

Simply use the standard ul, ol or dt HTML elements.

An ul list
  • This is the 1st item.
  • then the second one.
  • For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
  • And the last li tag.
An ol list
  1. This is the 1st item.
  2. then the second one.
  3. For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
  4. And the last li tag.
A dt list
This is the 1st item
Some item in a first line.
And a second item.
Then the second one
A item related to the second.
And the last dt tag.
with the last dd tag.