html - 如何在 html 和 css 旁边显示 2 个大按钮

标签 html css

我是 html 和 css 的新手,我正在尝试制作网页。
我创建了 2 个大按钮,每个按钮大约是屏幕大小的一半。问题是我无法将它们并排显示。相反,它们一个一个地显示在另一个之上。

一小段 html 位于添加的代码段的 css 下方,可能看起来有点乱。

编辑:想法是创建一个分成 2 部分的页面,例如 --> http://www.masitupungato.com/ <-- 但非常基本的外观

截图如下:

Button supposed to be on the left side Button supposed to be on the right side

body {
	background: #191B1C;
	color: white;
	font-family: helvetica;
}

ul {
	list-style-type: none;
	margin: 0;
	padding: 0;
}

li a{
	color: white;
	background: #2A2F30;
	height: 616px;
	width: 650px;
	border-radius: 40px;
	text-align: center;
	font-size: 100px;
	font-weight: bold;
	text-decoration: none;	
	padding-top: 400px; 
	display: inline-block;
}

li a:hover{
	background: #2FA2C4;
	border: 4px solid white;
}
<div>
	<ul>
		<li id="left-container"><a href="#">Browse</a></li>
		<li id="right-container"><a href="#">Upload</a></li>
	</ul>

</div>

最佳答案

ul li 添加样式

ul li {
    float:left; //or display:inline-block;
}

body {
	background: #191B1C;
	color: white;
	font-family: helvetica;
}

ul {
	list-style-type: none;
	margin: 0;
	padding: 0;
}

ul li {
  float:left
}

li a {
	color: white;
	background: #2A2F30;
	height: 616px;
	width: 650px;
	border-radius: 40px;
	text-align: center;
	font-size: 100px;
	font-weight: bold;
	text-decoration: none;	
	padding-top: 400px; 
	display: inline-block;
}

li a:hover{
	background: #2FA2C4;
	border: 4px solid white;
}
<div>
	<ul>
		<li id="left-container"><a href="#">Browse</a></li>
		<li id="right-container"><a href="#">Upload</a></li>
	</ul>

</div>

关于html - 如何在 html 和 css 旁边显示 2 个大按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38946132/

相关文章:

javascript - 垂直对齐未知宽度的文本

php - 无法将 <div> 居中对齐并且无法正确管理不透明度

jquery - 推特 Bootstrap : How do I get the selected value of dropdown?

javascript - 在 Javascript 中突出显示给定长字符串中的特定字符串

jquery - float 页脚 jquery 插件? (不是常见的 "how to make a footer stick to the bottom of the page")

html - 表单无法正确使用 Mailto

javascript - innerHTML 将 CDATA 转换为注释

html - 使用 HTML/CSS 在图标悬停时显示文本?

javascript - css3 animation-delay 只适用于 Firefox?

html - Firefox 不会加载/渲染自定义字体