Search code examples
phpcsswordpressfunctionmedia-queries

Editing CSS Media Queries in Wordpress


This is the part of the functions.php file

function javascript_file(){ 
    //this is the second style sheet for media query in wordpress
    wp_enqueue_style( 'container-css',  get_stylesheet_directory_uri() . '/container.css',array(),null, 'only screen and  (max-width:650px)' );

    wp_enqueue_style( 'container-css' );
}

//applying action on this function
add_action('init','javascript_file');

In this I am adding the code for the media query in WordPress, the code is working well in the developer tool in the browser but when I put on the server the code starting messing up, in other words does't work.

The size which I chose for is 4 inches and above screen.


Solution

  • You can use media queries in wordpress dashboard in Appearance -> Editor. Simple copy and paste your media quesries in that.