Skip to main content
Known Participant
February 19, 2017
Answered

How do I add media queries to an existing css stylesheet?

  • February 19, 2017
  • 1 reply
  • 5250 views

I started learning Dreamweaver CC 2015 about a year ago and have ploughed my way through countless tutorials.

I am a designer not a coder but somehow have managed to create a reasonable-looking test site for my client. He now wants the captions to the carousel on the home page to move below the image on smaller screens so that the image is still visible and the font size changes.

I cannot find the original Adobe tutorial I used to create the site in the first place and am floundering on how to achieve this.

Can I add a media query to my current stylesheet or do I need to make a separate style sheet?

I have looked on line for answers to my problem but they all assume greater knowledge than I have.

Here is the page:

http://http://www.warfieldpark.co.uk/testing.html

Assume I am a complete novice (which I probably still am) and give me step by step instructions if possible please!

    This topic has been closed for replies.
    Correct answer osgood_

    Probably best to hide the pagers (those circles on the images) and arrow indicators as well, otherwise you will probably have to rethink the html structure.

    Css media query which will stack the caption under the images at 768px:

    @media screen and (max-width: 768px) {

    .carousel-caption {

    position: static;

    width: 100%

    }

    .carousel-indicators, .left, .right {

    display: none;

    }

    }

    You can add the media query to the end of your custom css file:

    warfield.css

    1 reply

    osgood_Correct answer
    Legend
    February 19, 2017

    Probably best to hide the pagers (those circles on the images) and arrow indicators as well, otherwise you will probably have to rethink the html structure.

    Css media query which will stack the caption under the images at 768px:

    @media screen and (max-width: 768px) {

    .carousel-caption {

    position: static;

    width: 100%

    }

    .carousel-indicators, .left, .right {

    display: none;

    }

    }

    You can add the media query to the end of your custom css file:

    warfield.css

    Mary_8Author
    Known Participant
    February 19, 2017

    I have added that code thanks and the test page is here http://www.warfieldpark.co.uk/pages/testing_media_q.html

    How can I make it also occur when the window is viewed on a desktop but the window is dragged to a smaller size?

    I have experimented and it doesn't seem to work.

    Is it possible to add other styles to the box and text within the media query code?

    Legend
    February 26, 2017

    osgood_  wrote

    I try to avoid it like the plague because I know how shite it is.

    You know I don't like explicit language. Please use, (load of)  'excrement' next time


    pziecina  wrote

    osgood_   wrote

    I try to avoid it like the plague because I know how shite it is.

    You know I don't like explicit language. Please use, (load of)  'excrement' next time

    Oh yeah forget myself,  well I can't change it now as a post has followed it See what Bootstrap does, it turns me into an unpleasant person.