How to arrange the list horizontally in html

青灯夜游
Release: 2022-01-21 11:58:09
Original
36994 people have browsed it

How to arrange the list horizontally in html: 1. Using the float attribute, you only need to add the "float: left;" style to the li element of the list; 2. Using the display attribute, you only need to add the "float: left;" style to the li element of the list. Just add the "display: inline;" style to the li element.

How to arrange the list horizontally in html

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

HTML creates a list:

<!DOCTYPE html>
<html>
	<head>
		<style type="text/css">
			ul li{
				list-style:none;
			}
		</style>
	</head>

	<body>
		<ul>
			<li>列表1</li>
			<li>列表2</li>
			<li>列表3</li>
		</ul>
	</body>

</html>
Copy after login

How to arrange the list horizontally in html

How to arrange the list horizontally?

1. Use float attribute

ul li{
	list-style:none;
	float: left;
}
Copy after login

How to arrange the list horizontally in html

2. Use display attribute

ul li{
	list-style:none;
	display: inline;
}
Copy after login

How to arrange the list horizontally in html

Related recommendations: "html video tutorial"

The above is the detailed content of How to arrange the list horizontally in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template