Jon Holm Jon Holm - 1 year ago 114
CSS Question

CSS hide elements behind logo

I have a problem where I need to remove/hide a line behind my transparent logo:

The white line needs to be beside the logo, but it should not be shown behind. - And no, I will not add a black background..


<div style="position: absolute;margin-top: 74px;margin-left: 4%;width: 90%;height: 2px;background-color: #FFF;"></div>
<span style="font-size:81px;margin-top: 14px;padding: 0px 0px 0px 43%;position: fixed;">LOGO</span>

  • Span will become a transparent image, this is just for testing..

Answer Source

You can check out the Line-On-Sides Headers CSS Trick.

Something like this:

body {
  background-color: black;
  color: white;
.fancy {
  line-height: 0.10;
  text-align: center;
  font-size: 81px;
  margin-top: 20px;
.fancy span {
  display: inline-block;
  position: relative;
.fancy span:before,
.fancy span:after {
  content: "";
  position: absolute;
  height: 5px;
  border-top: 1px solid white;
  top: 0;
  width: 200px;
.fancy span:before {
  right: 100%;
  margin-right: 15px;
.fancy span:after {
  left: 100%;
  margin-left: 15px;
<div class="fancy"><span class="fancy">LOGO</span>


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download