Usage

How to use DPiCSS with some examples

Olivier 3lanc

Table of content
  1. Simple example
  2. Interoperability
  3. With Bootstrap
  4. With Tailwind
  5. With Reset CSS
  6. Normalize CSS

DPiCSS works with details, picture and image. Since alt attribute is entered, details summary accessibility is fulfilled, but an optional span can be added as child of summary tag to display HTML content under the thumbnail.

Here is the associated markup to use with DPiCSS:

<details data-dpicss="<OPTIONAL_LIST_OF_KEYWORDS_PARAMETERS>">
    <summary title="<OPTIONAL_TOOLTIP_TEXT>">
        <picture>
            <img src="<THUMBNAIL_IMAGE_URL>"
                alt="<THUMBNAIL_ALTERNATE_TEXT>"
                width="<NATURAL_WIDTH_OF_BOTH_IMAGES>"
                height="<NATURAL_HEIGHT_OF_BOTH_IMAGES>"
                loading="lazy">
        </picture>
        <!-- Optional <span>, can be removed if unnecessary-->
        <span>
            Optional summary text into a span tag
        </span>
    </summary>
    <picture>
        <img src="<LARGE_SIZED_IMAGE_URL>"
            alt="<LARGE_SIZED_IMAGE_ALTERNATE_TEXT>"
            width="<NATURAL_WIDTH_OF_BOTH_IMAGES>"
            height="<NATURAL_WIDTH_OF_BOTH_IMAGES>"
            loading="lazy">
    </picture>
    <!-- Optional below - Any content as "details" tag can display -->
</details>

Simple example

Here is a fully fonctionnal minimalistic example with a still AVIF file thumbnail and an animated AVIF.

Interoperability

Since DPiCSS uses CSS and HTML5 tags, it may interfere with others librairies or frameworks. The following sandboxes includes most common CSS libraries to check DPiCSS renders properly across every framework or library. Feel free to suggest other libraries or report issues.

With Bootstrap

Example of a page with Bootstrap and DPiCSS.

With Tailwind

Example of a page with Tailwind CSS and DPiCSS.

With Reset CSS

Example of a page with Eric A. Meyer Reset CSS and DPiCSS.

Normalize CSS

Example of a page with Normalize CSS and DPiCSS.