0

So I have two questions:

1. How can I vertically align text in my footer with two or more lines?

(I'm justing line-height with the height of footer to align one line but it leaves huge gaps between two or more lines)

2. How can I remove underline from CSS ::after content thing but keep it under the text.

(so all Links will look on hover like the last one)

HTML & CSS

    footer {
      position: absolute;
      left: 0;
      bottom: 0;
      width: 100%;
      min-height: 50px;
      line-height: 50px;
      text-align: center;
      margin-top: auto;
      margin-bottom: auto;
      color: white;
      background-color: #232323;
    }
    
    footer a {
      cursor: pointer;
    }
    
    footer a:hover {
      text-decoration: underline;
    }
    
    footer a:not(:last-child)::after {
      content: " | ";
      cursor: default;
    }
<footer>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
    <a>Link</a>
</footer>

JSFIDDLE
https://jsfiddle.net/qmbbtmb5/

Ejdrien
  • 2,782
  • 1
  • 17
  • 32

1 Answers1

1

You can make it work like you want by adding position: absolute css property to the :after pseudo selector. Try adjusting your css code like this one.

footer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  min-height: 50px;
  text-align: center;
  line-height: 1.5;
  margin-top: auto;
  margin-bottom: auto;
  color: white;
  background-color: #232323;
  padding: 30px 0;
}

footer a {
  cursor: pointer;
  display: inline-block;
  position: relative;
  margin: 0 5px;
}

footer a:hover {
  text-decoration: underline;
}

footer a:not(:last-child)::after {
  content: " | ";
  cursor: default;
  position: absolute;
  top: 0;
  right: -10px;
}
Aryan Twanju
  • 2,464
  • 1
  • 9
  • 12