WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to change logo for mobile (10 posts)

  1. sabrina34
    Member
    Posted 9 months ago #

    Hi,

    I have a logo image in my header.php on the stage at 100%.
    On mobile my logo become to small
    So, i d like to add an other logo image for mobile.

    Posible ?

    Tks !

  2. WPyogi
    Volunteer Moderator
    Posted 9 months ago #

    Generally, that's done in the CSS - specifics depend on your theme/site.

  3. sabrina34
    Member
    Posted 9 months ago #

    tks for your help,

    With mediaquery in css stylesheet i can manage the image size but cannot change image path :(

  4. sabrina34
    Member
    Posted 9 months ago #

    In my header.php i call my logo like this

    <div class="logo">/"><img src="../img/logo.png"/></div>

    Could i add some condition ?

    if screen < 480 print <div><img src="../img/logo1.png"/></div>
    else print <div><img src="../img/logo2.png"/></div>

    i am not a php user !

  5. martcol
    Member
    Posted 9 months ago #

    Target the image in your CSS using:

    div.logo img {
    }
  6. sabrina34
    Member
    Posted 9 months ago #

    tks - but i cannot do it like this :

    @media only screen and (min-width:480px) and (max-width:2000px){
    div.logo img {<img src="../img/logo2.png"/>}}

    @media only screen and (max-width:480px){
    div.logo img {<img src="../img/logo1.png"/>}}

    And when i try to put logo in background-image he doesn't appear on the page :(

  7. martcol
    Member
    Posted 9 months ago #

    Can you link to your site?

    You should leave your code in your header where it is.

    All you want to declare in the CSS is a width.

    width: 30px;

    Or whatever width you want.

    You can also use %

    width: 30%;

  8. sabrina34
    Member
    Posted 9 months ago #

    I have the 100% logo with

    Here is the website:
    http://scaryhouse.fr/

  9. sabrina34
    Member
    Posted 9 months ago #

    Ok i did it with background image

    thank for your help !

  10. sabrina34
    Member
    Posted 9 months ago #

    i close the topic :)

Reply

You must log in to post.

About this Topic

Tags

No tags yet.