Home  >  Article  >  Web Front-end  >  How to arrange the list horizontally in html

How to arrange the list horizontally in html

青灯夜游
青灯夜游Original
2022-01-21 11:47:0236894browse

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>

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;
}

How to arrange the list horizontally in html

2. Use display attribute

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

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!

Statement:
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