Reputation: 263
I want to position two span's and a button like so:
span1
span2
button
But, with my current code they look like this:
span1 span2 button
body {
text-align:center;
}
span#printHere {
color:black;
font-size:30px;
position:relative;
}
span#triesLeft{
align='centre';
font-size:30px;
position:relative;
}
Upvotes: 22
Views: 70363
Reputation: 13775
Can always go with flexbox,
<div style="display:flex; flex-direction:column">
<span>Hello</span>
<span>there,</span>
<span>span!</span>
</div>
Upvotes: 5
Reputation: 2657
Try:
span {
float: left;
clear: left;
}
button {
float: left;
clear: left;
}
button:hover {
background-image: url('imageurl');
}
clearing after a float will cause the span to drop to a new line. http://jsfiddle.net/aKmF6/
Upvotes: 28
Reputation: 70718
span
are inline elements. If you want them positioned under each other use a block element or style it with display:block
Upvotes: 28