A brief analysis of CSS3 using text-overflow to solve text layout problems

A brief analysis of CSS3 using text-overflow to solve text layout problems

Basic syntax
The use of text-overflow requires the use of three attributes: hight, over-flow:hidden; white-space:nowrap;

text-overflow: clip;ellipsis;string
Clip: Hide directly without displaying
ellipse: Use three dots to indicate overflowing text (commonly used)
string: You can customize symbols to represent characters that cannot be placed

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title></title>
	<style type="text/css">
		.tf{
			width: 100px;
			height:50px;
			border:1px solid black;
			overflow: hidden;
			text-overflow: clip;/*If you just want to hide the text, it doesn't matter whether you add this sentence or not. height+overflow can directly hide the overflowing text*/
		}
		.tf1{
			width: 100px;
			border:1px solid black;
			overflow: hidden;
			text-overflow: ellipsis;
			-webkit-text-overflow: ellipsis;
			white-space: nowrap;
			/*If using ellipsis attribute text-overflow:ellipsis; overflow: hidden;white-space: nowrap;
			 These three attributes are indispensable */
		}
	</style>
</head>
<body>
	<div class="tf">
		123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM.
	</div>

	<div class="tf1">
		123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM123WORDPRESS.COM.
	</div>

	
</body>
</html>

This concludes this article on a brief analysis of how CSS3 uses text-overflow to solve text typesetting problems. For more relevant CSS3 text typesetting content, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope that everyone will support 123WORDPRESS.COM in the future!

<<:  Combining XML and CSS styles

>>:  Solution to inconsistent display of cursor size in input box

Recommend

MySQL multi-instance configuration solution

1.1 What is MySQL multi-instance? Simply put, MyS...

Vue+Element realizes paging effect

This article example shares the specific code of ...

Detailed explanation of angular parent-child component communication

Table of contents APIs used Simple Example person...

Kill a bunch of MySQL databases with just a shell script like this (recommended)

I was woken up by a phone call early in the morni...

Detailed explanation of the pitfalls of MySQL 8.0

I updated MySQL 8.0 today. The first problem: Nav...

jQuery plugin to achieve seamless carousel

Seamless carousel is a very common effect, and it...

Tomcat maxPostSize setting implementation process analysis

1. Why set maxPostSize? The tomcat container has ...

Basic usage tutorial of IPTABLES firewall in LINUX

Preface For production VPS with public IP, only t...

Three ways to parse QR codes using javascript

Table of contents 1. Use JavaScript to parse the ...

Detailed explanation of MySql slow query analysis and opening slow query log

I have also been researching MySQL performance op...

PyTorch development environment installation tutorial under Windows

Anaconda Installation Anaconda is a software pack...

How to configure the pdflatex environment in docker

Technical Background Latex is an indispensable to...

jQuery realizes the sliding effect of drop-down menu

When we make a web page, sometimes we want to hav...

MySQL gets the current date and time function

Get the current date + time (date + time) functio...