 <p>Instead of making span text to have absolute position, I have given line to have absolute position, and have placed text in center using text-align : center.</p> <pre><code> div.btn{ width:100px; height:100px; float:left; border:1px solid #000000; font-family:Arial, Helvetica, sans-serif; font-size:80px; text-align:center; position: relative; } div.vertical_line{ width:0; height:100px; border:1px solid #000000; position:absolute; right:49px; z-index:100; margin:0; padding:0; top : 0; } div.btn span{ float:left; width : 100%; text-align : center; z-index:0; } </code></pre>