1

Originally I have my text as white. When changing the browser's width to smaller than 500px, I want the text to turn blue. I've tried multiple ways and landed on this, which is not working. Any help would be appreciated. The media query is at the very bottom. I'm not sure if it has to do with overriding somewhere, which I can't imagine being the case since the media query is placed at the very bottom of the css file.

html {
  font-size: 62.5%;
  scroll-behavior: smooth;
}

* {
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

body {
  color: white;
  font-family: 'Montserrat', sans-serif;
}

h1 {
  font-size: 2.5rem;
  font-family: 'Lobster', sans-serif;
  font-weight: lighter;
}

h2 {
  font-size: 8rem;
  font-family: 'Lobster', sans-serif;
  font-weight: lighter;
}

h3 {
  font-size: 3.5rem;
  font-family: 'Lobster', sans-serif;
  font-weight: lighter;
}

h4 {
  font-size: 3rem;
}

p {
  font-size: 2.5rem;
}

li {
  font-size: 2rem;
}

a {
  color: white;
}

.home {
  background: radial-gradient(#5c523d, #131313);
}

.nav-container {
  background: #070707;
}

nav {
  width: 80%;
  margin: auto;
  min-height: 10vh;
  padding: 3rem 0rem;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
}

nav a {
  text-decoration: none;
}

nav ul {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  -webkit-box-flex: 1;
      -ms-flex: 1;
          flex: 1;
  list-style: none;
}

nav #logo {
  -webkit-box-flex: 1.5;
      -ms-flex: 1.5;
          flex: 1.5;
  position: relative;
}

nav #logo::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 16rem;
  height: 6rem;
  background: #5c523d;
  border-radius: 50%;
  -webkit-transform: translate(-10%, -20%);
          transform: translate(-10%, -20%);
  mix-blend-mode: screen;
}

nav .order {
  background: #5c523d;
  padding: 1rem 2rem;
  border-radius: 2rem;
}

nav .prices {
  background: #5c523d;
  padding: 1rem 2rem;
  border-radius: 2rem;
}

nav .about {
  background: #5c523d;
  padding: 1rem 2rem;
  border-radius: 2rem;
}

.showcase {
  display: -ms-grid;
  display: grid;
  min-height: 90vh;
  -ms-grid-columns: 10% (minmax(5rem, 1fr))[3] 10%;
      grid-template-columns: 10% repeat(3, minmax(5rem, 1fr)) 10%;
  -ms-grid-rows: 1fr 2fr 1fr;
      grid-template-rows: 1fr 2fr 1fr;
}

.showcase h2 {
  -ms-grid-column: 2;
  -ms-grid-column-span: 1;
  grid-column: 2/3;
  -ms-flex-item-align: end;
      align-self: flex-end;
  font-size: 6rem;
}



.about .pic {
  height: 50vh;
  width: 65vh;
  margin-bottom: 40px;
  border-radius: 20%;
}





.rev-section {
  margin: auto;
  padding: 0 1rem;
  max-width: 1100px;
  text-align: center;
}

.review-container {
  background: #323232;
  height: 100vh;
}

.review-container #intro {
  font-size: 2.5rem;
  font-family: 'Lobster', sans-serif;
  font-weight: lighter;
  width: 80%;
}

.review .review-content {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  /* align horizontal */
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
}
/*# sourceMappingURL=style.css.map */



@media (max-width: 500px) {

  
  body {
    color: blue;
  }

}

The following is my html:

<!DOCTYPE html>
<html Lang="en">
<head>
   
    <meta charset="UTF-8">
    <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <script src="https://js.stripe.com/v3/"></script>

    <script src="pay.js" type="text/javascript" defer></script>
    <script src="review.js" type="text/javascript" defer></script>

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">


    <script src="https://kit.fontawesome.com/44f557ccce.js"></script>

    <link href="https://fonts.googleapis.com/css2?family=Lobster&display=swap" rel="stylesheet">
    <!-- font-family: 'Lobster', cursive; -->
    <link href="https://fonts.googleapis.com/css2?family=Lobster&family=Montserrat:ital@1&display=swap" rel="stylesheet">
    <!-- font-family: 'Lobster', cursive;
font-family: 'Montserrat', sans-serif;-->

    <link rel="stylesheet" href="style.css" type="text/css" />
    <title>Math Website</title>

    <body>
        <main>
            <div class="nav-container">
                <nav>
                <h1 id="logo">Simple Math!</h1>
                    <ul>
                        <li><a class="about" href="#">Home</a></li>
                        <li><a class="prices" href="#features-scroll">Schedule Appt</a></li>
                        <li><a class="order" href="#about-scroll">About Me</a></li>
                    </ul>
                </nav>
            </div>
             
            <section class="home">
                <div class="showcase">
                    <h2>Simple Math</h2>
                    <img src="roman-mager-5mZ_M06Fc9g-unsplash.jpg" style="height:520px;width:520px" alt="">
                    <div class="info">
                        <h3 class="language">The only universal language</h3>   
                    </div>
                </div>
            </section>
            <div class="features-container">
                <div id="features-scroll"></div>
                <section class="features">
                    <h2>Book Appt</h2>
                        <p>
                            So how does this work? Just submit your payment down below to schedule 
                            your session with me!
                        </p>                          
                        <form id="payment-form" class="sr-payment-form">
                            <div class="sr-combo-inputs-row">
                              <div class="sr-input sr-card-element" id="card-element"></div>
                            </div>
                            <div class="sr-field-error" id="card-errors" role="alert"></div>
                            <button id="submit">
                              <div class="spinner hidden" id="spinner"></div>
                              <span id="button-text">Pay</span><span id="order-amount"></span>
                            </button>
                          </form>
                </section>
                <section></section>
            </div>
            <div id="about-scroll"></div>
            <div class="about-container">
                <section class="about">
                    <div class="about-logo">
                        <h2>About me</h2>
                    </div>
                    <div class="about-content">
                    <img class="pic" src="texas.JPG" alt="">
                    <p id="intro">
                        Hey guys thanks for checking out my site! So what separates me from other tutors? Well it's my patience
                        and ability to explain things the way I wish someone could've explained math to me when I was in school.. like a 
                        Kindergardner! During our 1 hour sessions, we'll go through problem by problem, exploring each step of the solution
                        in depth, and throughly answering any of your questions along the way!
                    </p>
                   </div>
                </section>
            </div>
            <div id="review-scroll"></div>
            <div class="review-container">
                <section class="review">
                    <div class="review-header">
                        <h2>Reviews</h2>
                    </div>
                    <div class="review-content">
                   
                        <h2 class="title">Our guests love us</h2>
                        <p class="note">
                            lorem ipsum dolor sit amet consectetur adipscing elit. Nihil lbaorisam possimus preferendis non error neque
                        </p>
                        <div class="reviews">
                            <div class="review_two">
                                <div class="head-review">
                                    <img src="youtube.png" width="100px" height="100px">
                                </div>
                                <div class="body-review">
                                    <div class="name-review">
                                        Jorge V
                                    </div>
                                    <div class="place-review">
                                        San Diego
                                    </div>
                                    <div class="rating">
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="review_two">
                                <div class="head-review">
                                    <img src="youtube.png" width="100px" height="100px">
                                </div>
                                <div class="body-review">
                                    <div class="name-review">
                                        Jorge V
                                    </div>
                                    <div class="place-review">
                                        San Diego
                                    </div>
                                    <div class="rating">
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="review_two">
                                <div class="head-review">
                                    <img src="youtube.png" width="100px" height="100px">
                                </div>
                                <div class="body-review">
                                    <div class="name-review">
                                        Jorge V
                                    </div>
                                    <div class="place-review">
                                        San Diego
                                    </div>
                                    <div class="rating">
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                        <i class="fa fa-star"></i>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                    <!-- <div class="submit_review">
                        <h5>Like to submit a review? Please fill this out to recieve a code. Then use this code 
                            to submit the review!
                        </h5>
                        <div class="input_form">
                            <form id="review_form">
                                <input type="text" label="phone number"> 
                                <input id="submit" type="submit">
                            </form>
                        </div>
                        <div>
                            Submit Review and Photo here!
                        </div>
                    </div> -->

                   
                </section>
            </div>
        </main>
    </body>
</head>
</html>

jav040
  • 11
  • 2
  • Just tried it. Still no effect :( – jav040 Aug 28 '20 at 23:21
  • The media query part looks good. Are you getting any syntax error in the rest of the CSS file? – Bikas Aug 28 '20 at 23:22
  • Please post your html – Dan Mullin Aug 28 '20 at 23:23
  • Just posted the HTML. This problem is so weird. – jav040 Aug 28 '20 at 23:27
  • 1
    @jav040 I just copied your code and it works. – Bikas Aug 28 '20 at 23:32
  • Okay not sure what happened but it does work now, thanks! – jav040 Aug 28 '20 at 23:37
  • There is nothing wrong with the code you posted as others have already said. That means the issue is somewhere else - it could be in other code you haven't included here, or if your code isn't exactly the same as here (e.g. your CSS is included before Bootstrap etc),or maybe an old page was cached in your browser and it didn't pick up changes in your CSS. Either way, there is no issue here, so there is no answer we can provide that adds value to Stack Overflow in general (the purpose of this site is a Q&A reference for all users, similar to an encyclopedia) – FluffyKitten Aug 29 '20 at 02:41

1 Answers1

-1

Try body {color: blue !important}

  • @jav040 You might have to post you html code as well. – Enoch Johnson Aug 28 '20 at 23:26
  • just added my html – jav040 Aug 28 '20 at 23:29
  • @jav040 I also copied your code and it works except for the nav items. – Enoch Johnson Aug 28 '20 at 23:39
  • I don't get it why do some people vote down when someone mention `!important` it works but we tend to avoid it because when you want to override the element again you should use `!important` again. But overall his answer is not wrong. Not best practice but not wrong. – Ahmad Dalao Aug 28 '20 at 23:56
  • 1
    I didn't downvote, but recommending `!important` is a *really* bad idea. It might not be wrong, but it's definitely not a good idea. `!important` rarely a solution to anything and is usually just a hack instead of fixing an underlying problem. You even mention yourself that it's bad practice. And having to use even more `!important`s to override it breaks the fundamental "cascading" part of *cascading* stylesheets. `Also, answering questions that are unclear and don't include all the required information is also against Stack Overflow guidelines, so that could have been a reason either. – FluffyKitten Aug 29 '20 at 02:30
  • Also see [What are the implications of using “!important”](https://stackoverflow.com/a/3706876/924299). – showdev Aug 29 '20 at 03:00