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.
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?
1. Use float attribute
ul li{ list-style:none; float: left; }
2. Use display attribute
ul li{ list-style:none; display: inline; }
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!