How to Justify Text and Fill Empty Spaces with Dots Using CSS?

Barbara Streisand
Release: 2024-10-25 03:59:02
Original
770 people have browsed it

How to Justify Text and Fill Empty Spaces with Dots Using CSS?

Justifying Text and Filling Spaces with Dots Using CSS

This question discusses the need to uniformly align text and fill the remaining space with dots, specifically for displaying product information with drugs and doses.

CSS Solution

To achieve this formatting with CSS, an elegant and partially supported solution is provided:

<code class="css">dl { width: 400px }
dt { float: left; width: 300px; overflow: hidden; white-space: nowrap }
dd { float: left; width: 100px; overflow: hidden }

dt:after { content: " .................................................................................." }</code>
Copy after login

HTML Implementation

<code class="html"><dl>

    <dt>Drug 1</dt>
    <dd>10ml</dd>

    <dt>Another drug</dt>
    <dd>50ml</dd>

    <dt>Third</dt>
    <dd>100ml</dd>


</dl></code>
Copy after login

Limitations

This solution has the following limitations:

  • Not supported by Internet Explorer versions older than 8.
  • Content property accepts only literal characters, not HTML entities like ·. However, UTF-8 characters cover a wide range of needs in this context.

The above is the detailed content of How to Justify Text and Fill Empty Spaces with Dots Using CSS?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!