Search code examples
phphtmlcsswordpresscopyright-display

How to center copyrights text in subfooter?


I'm using wordpress and the theme is Newspaper. I want to center the copyrights text but I don't know how. I have checked the theme panel settings and there's no options to edit that.

Theme panel pic:enter image description here

I have gone through some answers in the web and they suggested adding codes in the editor but I'm not sure if it's the footer.php or style.css. If the latter, I managed to find the part regarding sub-footer:

    Sub Footer
*/
.td-sub-footer-container {
  background-color: #0d0d0d;
  color: #ccc;
  font-size: 12px;
  font-family: 'Open Sans', arial, sans-serif;
  /* responsive portrait phone */
}
@media (max-width: 767px) {
  .td-sub-footer-container {
    text-align: center;
    padding: 6px 0;
  }
}
.td-sub-footer-copy {
  line-height: 18px;
  margin-top: 8px;
  margin-bottom: 8px;
}
/* Sub Footer Menu */
.td-sub-footer-container .td-sub-footer-menu {
  float: right;
  /* responsive portrait phone */
}
@media (max-width: 767px) {
  .td-sub-footer-container .td-sub-footer-menu {
    float: none;
  }
}
.td-subfooter-menu {
  display: inline-block;
  margin: 0;
  float: right;
  /* responsive landscape tablet */
  /* responsive landscape tablet */
  /* responsive portrait tablet */
  /* responsive portrait phone */
}
@media (min-width: 1019px) and (max-width: 1140px) {
  .td-subfooter-menu {
    padding-right: 40px;
  }
}
@media (min-width: 768px) and (max-width: 1018px) {
  .td-subfooter-menu {
    padding-right: 48px;
  }
}
@media (max-width: 767px) {
  .td-subfooter-menu {
    float: none;
  }
}
.td-subfooter-menu li {
  display: inline-block;
  margin-left: 0;
}
.td-subfooter-menu li a {
  margin-right: 16px;
  line-height: 34px;
  display: inline-block;
  color: #ccc;
}
.td-subfooter-menu li a:hover {
  color: #4db2ec;
}
.td-subfooter-menu li:last-child a {
  margin-right: 0;
}
.td-subfooter-menu ul {
  display: none;
}

Solution

  • Thank you for such depth! Here's some CSS you need to add:

    .td-pb-span5.td-sub-footer-copy {
        float: none;
        text-align: center;
        margin:0 auto;
    }
    

    The reason why you need this is because your subfooter is following some rules that are already established for the rest of your page:

    .td-pb-row [class*="td-pb-span"] {
        display: block;
        min-height: 1px;
        float: left;
        padding-right: 24px;
        padding-left: 24px;
        position: relative;
    }
    

    Simply removing the immediately above CSS will 'break' the rest of your page's layout.

    Edit, to answer comment question:

    Apologies, here's a bit more information:

    When CSS is being applied to an element that is already being styled by a different selector's rules, there's a calculation of specificity. The CSS I've given you will be fine on its own if added, however, if you'd like to add it to the selector you already have, .sub-footer-copy, then you'd have to add !important to override your already written CSS, like so:

    td.sub-footer-copy{
        float: none !important;
        text-align: center;
        margin: 0 auto;
    }
    

    This is because the selector .td-pb-row [class*="td-pb-span"] is more specific than the selector .sub-footer-copy. Here's some further reading on this:

    https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity

    Also, I'd like to note that the selector .td-pb-row [class*="td-pb-span"] is an attribute selector referring to a CSS class, so it is similar to .td-pb-row .td-pb-span