ApoLLoSkiLLz ApoLLoSkiLLz - 3 months ago 29
CSS Question

How can I display 2 big buttons next to each other html & css

I'm new to html and css and I'm trying to make a webpage.

I created 2 big buttons, each about half the size of the screen. The problem is I can't display them next to each other. Instead they are displayed one above the other.

The little piece of html is below the css of the added snippet which probably looks a bit messy.

EDIT: the idea is to create a page divided in 2 like --> http://www.masitupungato.com/ <-- but a very basic look

Here are the screenshots:

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>




Answer

Add style for 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>

Comments