Home >Web Front-end >HTML Tutorial >In html, let multiple li of ul be displayed in one line_html/css_WEB-ITnose

In html, let multiple li of ul be displayed in one line_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:41:131612browse

Sometimes it is necessary to display the li of ul on the same line to prevent the li from running to the next line. I encountered this problem today. Record it to avoid forgetting~

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">	<title>Document</title>	<style type="text/css">		*{			padding: 0;			margin-bottom:0;			border: 0;		}		.box{			width: 640px;			height: 50px;			overflow-x: scroll;			overflow-y: hidden;		}		ul{			display:inline;			white-space: nowrap;		}		ul li{			padding: 10px 20px;			display: inline-block;			background:pink;			white-space:nowrap;		}	</style></head><body><div class="box">	<ul>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>		<li>所有li都在一行显示</li>	</ul></div></body></html>

The effect is as shown below:

 

I just wrote it casually, it’s so ugly, don’t pay attention to the details hahaha~~~~

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