I am having trouble placing labels directly under a span element. If this was an input that I needed the label under, I would assign a name attribute to the input element and assign a for="name" attribute to the label. However, I am not able to assign a name attribute to a span.
I have to use a span because I want to use these IcoMoon icons that must be placed inside a span.
Currently, I am stuck with the label either on the left or right of the span. I can not seem to get it to be centered under the span element.
Here is my code:
@font-face {
font-family:icomoon;
src:url(http://s3.amazonaws.com/icomoon.io/4/IcoMoonApp/icomoon.eot?-m9wrda);
src:url(http://s3.amazonaws.com/icomoon.io/4/IcoMoonApp/icomoon.eot?#iefix-m9wrda) format("embedded-opentype"),
url(http://s3.amazonaws.com/icomoon.io/4/IcoMoonApp/icomoon.ttf?-m9wrda) format("truetype"),
url(http://s3.amazonaws.com/icomoon.io/4/IcoMoonApp/icomoon.woff?-m9wrda) format("woff"),
url(fonts/2ad343be.icomoon.svg#icomoon) format("svg"),url(fonts/69e79c77.icomoon.woff) format("woff"),
url(http://s3.amazonaws.com/icomoon.io/4/IcoMoonApp/icomoon.svg?-m9wrda#icomoon) format("svg");
}
.icon-bubbles{
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size:36px;
color:#f00;
border: 1px solid white;
}
.icon-bubbles:before {
content: "\e613";
}
#back {
width: 400px;
height: 200px;
background: black;
color: white;
}
table {
border-collapse: collapse;
margin-left: 5%;
}
table, th, td {
border: 1px solid white;
height: 80px;
}
label {
border: 1px solid white;
}
<div id="back">
<br>
<table border>
<tr>
<td>
<span class="icon-bubbles"></span>
<label>Label Text</label>
</td>
<td>
<span class="icon-bubbles"></span>
<label>Label Text</label>
</td>
<td>
<span class="icon-bubbles"></span>
<label>Label Text</label>
</td>
</tr>
</table>
</div>
Here is a link to the JSFiddle: http://jsfiddle.net/8Lffy7sg/