简体   繁体   中英

Centering image in wordpress theme css

This is how header looks already:

HTML

<div class="row">

  <div class="col-md-6 col-sm-8 col-xs-12 text-right">
    <a href="#"><img class="site-logo" src="logo.png" alt=""></a>
  </div>
  <div class="col-md-6 col-sm-4 col-xs-12">
    <nav>...</nav>
  </div>

</div>

with default css

I want to have logo centered in the whole row (in the middle of screen) but without changing nav at all.

On md sceen it would be imposible since you have col-md-6 on both divs, so each colum takes a half of the screen,on the other sm and xs screens you can achieve this doing the following Change this line:

  <div class="col-md-6 col-sm-8 col-xs-12 text-right">

To

  <div class="col-md-6 col-sm-4 col-sm-offset-4 col-xs-12 text-center">

Hope it could help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM