Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Media queries – Only show specific image is screen width if more than 768px

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #145938
    nolimit966
    Participant

    Hi there,

    Im currently working with media queries, and i want to only load / show specific images if the page width if more than 768px but not much seems to be working. Heres what i have

    `<img src="<?php echo bloginfo( 'template_directory' ) . '/images/logo-.png" width="205" />"  media="(min-width: 769px)">`
    

    As you can see im working in WordPress thats what the echo statement related to.

    Is this the correct syntax?

    In my CSS file i have the media stream section for this (not sure if this is relevant or not.

    @media only screen and (min-width: 769px) {

    Many thanks.

    #145941
    Paulie_D
    Member

    Is this a background image?

    #145942
    Senff
    Participant

    I’m not familiar with the format of having a media tag in as an attribute of an IMG (and I’m not sure why you add a dynamic path in front of the image path), but what you’re probably trying to achieve is this?

    http://codepen.io/senff/pen/mcbyx

    #145946
    nolimit966
    Participant

    ^^ thats exactly it.

    Thanks very much. :-)

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.