Media query failing to adjust properly

On my website's "about" page, I'm attempting to implement a media query but encountering an issue. In the original CSS, I structured the "information" section into 2 columns with right padding to prevent the content from extending all the way to the screen edge. However, when applying the media query, the padding and grid layout remain unchanged, creating unnecessary extra space on the right side of the website. How can I adjust this?

I've attempted modifying these properties within the media query, but it doesn't seem to have any effect on the website: grid-template-columns: repeat(1,1fr) padding-right: 0px;

        <!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Portfolio</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="screen" href="css/main.css" />
    <link rel="stylesheet" href="https://unpkg.com/@blaze/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="395a4a4a790a170b1709">[email protected]</a>/dist/blaze.css">
    <link href="https://fonts.googleapis.com/css?family=Didact+Gothic" rel="stylesheet">
    <script src="https://unpkg.com/@blaze/ [email protected]/dist/blaze-atoms.js"></script>
    <script src="javascript/main.js"></script>
    <script src="javascript/jquery.js"></script>
</head>
<body>
        <div class="cotainer">
                <div class="title">
                    About Me!
                </div>
                <div class="information">
                        <div class="span-row-2">
                                <img src="images/profile.svg" id="logo">
                        </div>
                        <div class="tabs">
                                <input type="radio" name="tabs" id="tabone" checked="checked">
                                <label for="tabone">Education</label>
                                <div class="tab">
                                  <h1 class="phrase">San Jose State University</h1>
                                  <blaze-divider class="divider">Major</blaze-divider>
                                  <div class="major">Digital Media Art</div>
                                </div>

                                <input type="radio" name="tabs" id="tabtwo">
                                <label for="tabtwo">Contacts</label>
                                <div class="tab">
                                  <h1 class="phrase">Stay in touch!</h1>
                                  <blaze-divider class="divider">Get Connected</blaze-divider>
                                  <div class="socials">
                                      <a href="https://www.facebook.com/thanh.truong.3597" class="icons" target="_blank">Facebook</a>
                                      <a href="https://www.instagram.com/thanh_be_like/" class="icons" target="_blank">Instagram</a>
                                      <a href="https://www.linkedin.com/in/thanh-truong-918509163/" class="icons" target="_blank">Linkedin</a>
                                      <a href="creative_resume.pdf" class="icons" target="_blank">Resume</a>
                                  </div>
                                </div>
                </div>
            </div>
            <nav id="mainnav" class="group">
                <div id="menu">&#x2261; Menu</div>
                <ul>
                   <li><a href="about.html" class="active">About</a></li>
                   <li><a href="index.html">Home</a></li>
                   <li><a href="portfolio.html">Portfolio</a></li>
                </ul>
            </nav>
            <script>
                    $(document).ready(function() {

           // JQUERY NAV TOGGLE
           $('#menu').bind('click',function(event){
               $('#mainnav ul').slideToggle();
           });

           $(window).resize(function(){  
               var w = $(window).width();  
               if(w > 768) {  
                   $('#mainnav ul').removeAttr('style');  
               }  
           });

         });
            </script>

</body>
</html>




  information {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding-right: 50px;
    background:#323526;
    padding-bottom: 50%;
}
.span-row-2{
    grid-row: span 2 / auto;
    align-items: center;
    margin:10vw;
}
.tabs {
    display: flex;
    flex-wrap: wrap;
}
.tabs label {
    order: 1; 
    display: block;
    padding: 1rem 3rem;
    margin-top:70px;
    cursor: pointer;
    transition: background ease 0.2s;
    width:50%;
    text-align: center;
    border-bottom: 1px solid #C28710;
    color: #C28710;
    font-size: 1.5vw;
    letter-spacing: 2px;
}
.tabs .tab {
    order: 99; 
    flex-grow: 1;
    width: 100%;
    display: none;
    padding: 1rem;
}
.tab{
    border-radius: 0px 0px 20px 20px;
    background-color: rgba(0, 0, 0, 0.2);
}
.tabs input[type="radio"] {
    display: none;
}
.tabs input[type="radio"]:checked + label {
    border-bottom: 4px solid #C28710;
    font-weight: bold;
}
.tabs input[type="radio"]:checked + label + .tab {
    display: block;
}

@media (max-width: 45em) {
  .tabs label,
  .tab .tabs {
    order: initial;
  }
  .tabs label {
    width: 100%;
    margin-right: 0;
    margin-top: 2rem;
  }
}

@media all and (max-width:650px){
    .span-row-2{
        grid-row: span 2 / auto;
        align-items: center;
        margin:40px;
        min-width:250px;
        min-height: 250px;
        grid-area: main;
    }
    .tabs label {
        order: 1; 
        display: block;
        margin-top:20px;
        cursor: pointer;
        transition: background ease 0.2s;
        width:50%;
        text-align: center;
        border-bottom: 1px solid #C28710;
        color: #C28710;
        font-size: 15px;
        letter-spacing: 2px;
    }
    .information{
        grid-template-columns:repeat(1,1fr);
        padding-right:0px;
    }
}

Current Layout Image Desired Layout Image

Answer №1

It appears there may be some confusion regarding the intended outcome in this situation. An observation I made is a potential conflict between the rules specified in your two media queries.

The directives within the max-width:45em media query are being overridden by those within the max-width:650px

I trust this information proves helpful. ¯\_(ツ)_/¯

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the latest CSS browser support for the min() and max() functions in 2018?

I am considering implementing the use of the min() and max() functions in my project. I'm curious about the current browser support as of 2018. Do you think it is necessary to include the @supports at-rule? For example, I could write: .px-4-safe { ...

The sidebar vanishes when you move your cursor over the text contained within

My issue is that the side menu keeps closing when I hover over the text inside it. The "About" text functions correctly, but the other three don't seem to work as intended. Despite trying various solutions, I am unable to identify the root cause of th ...

Error message: Unhandled error - $(...).sidr does not exist as a function. [Chrome developer console]

I included this code in the basic module HTML block of a WordPress page builder and encountered the white screen of death. According to the Chrome developer console, the following error occurred: helpers.js?ver=4.5.3:15 Uncaught TypeError: $(...).sidr is ...

Update the content of a div and refresh it when a key on the keyboard is pressed

I need to hide the images in a div when I press a key on the keyboard. How can I achieve this? <div> <span role="checkbox" aria-checked="true" tabindex="0"> <img src="checked.gif" role="presentation" alt="" /> ...

Tips for creating a static PHP website with a fixed navigation bar and footer

I am looking to create a webpage with a consistent horizontal navigation bar and footer, but where the content changes dynamically based on the user's interactions with the navigation. For example: <div class="nav-bar"> /* The navigation bar r ...

Problem encountered when attempting to set and retain default values in a PHP select box

<form name="search" method="post" > Seach for: <input type="text" name="find" value="<?php echo (isset($_POST['find']) ? $_POST['find'] : ''); ?>" /> in <Select NAME="field"> <Option VALUE="catego ...

Putting off the execution of a setTimeout()

I'm encountering difficulties with a piece of asynchronous JavaScript code designed to fetch values from a database using ajax. The objective is to reload a page once a list has been populated. To achieve this, I attempted to embed the following code ...

Display data-content vertically using CSS

Looking for a way to display text vertically one by one with CSS? While the rotation method produces this result: https://i.stack.imgur.com/utAiN.png However, I aim to achieve something more like this: https://i.stack.imgur.com/fuVyb.png If you have an ...

add text nodes with unnecessary quotation marks around my selection list

Looking to incorporate a select list into my website using a button. I must utilize nodes for access within the DOM to retrieve its value later, so innerHTML isn't an option. Experiencing difficulty as createTextNode seems to encase my list in quota ...

Are the files selected by the user not displaying properly in the URL?

I'm currently working on a project using PhoneGap where I am facing an issue with uploading files and adding all file names to the parameters. The desired format is: http://www.example.com/uplaod.html?file=file1,file2,file3 To achieve this, I have a ...

Having trouble with margin auto 0 not functioning properly in Safari on iPad?

I'm facing a challenge with centering a div in Safari on iPad. It works fine in Chrome, but in Safari there are margins on the left and right which require scrolling to view the whole content. Any suggestions on how to make this work seamlessly in bot ...

Different Ways Split Button Format Can Vary Based on Web Browser

I am encountering a formatting issue with a jQuery splitbutton on my webpage. In order to adhere to my company's design standards, I am essentially converting a link into a button. The functionality works perfectly fine; however, depending on the brow ...

Vertical centering of inline-block elements remains unaffected by line-height changes

I attempted to center an inline-block vertically in the following manner: div { width: 50px; height: 50px; background: red; line-height: 50px; } span { display: inline-block; width: 20px; height: 20px; background: white; } <div> ...

Tips for transferring a variable from a hyperlink to a Flask application

Here is a snippet of my Python Flask code: @app.route('/ques/<string:idd>',methods=['GET', 'POST']) def ques(idd): print(id) And here is the accompanying Javascript code: var counts = {{ test|tojson }}; var text = ...

Tooltip positioned within a custom container using Material UI

Currently, as part of my Chrome extension development utilizing React and Material UI, I am implementing an inject page strategy. I have managed to set up a tooltip for the Fab button, but unfortunately, it appears outside the DOM of my extension. Upon ins ...

Using Html.BeginForm to route to a Web Api endpoint

I need help figuring out how to make my page post to my Web API controller instead of my Area/Controller/Action. I've tried using both Html.BeginForm and Ajax.BeginForm, but haven't had any success so far. Here's what I've attempted: @ ...

Angular date control and its corresponding date panel are not properly aligned on the user interface

I am utilizing Angular and Angular Material for date control display. See the code snippet below: <input type="date" (change)="validateDateRange($event,true, index)" class="form-control oot-start-date align-middle" name=& ...

Top-notch tools and guides for front-end web development

As I prepare to transition to a new role focused on front-end web development, specifically CSS and jQuery, I am seeking recommendations for valuable resources to enhance my skills in these areas. Whether it be books, websites, blogs, or any other medium, ...

Learn how to efficiently import scripts and styles from WordPress plugins with the help of the wp_enqueue_script function

After creating my own custom Wordpress theme, everything seemed to be running smoothly. However, I soon encountered an issue where certain plugins were not functioning properly with the theme. It seems that the theme is unable to import the necessary style ...

Is there a conflict between bootstrap.min.JS and chart.min.js?

I have been working on developing an admin page for customer support and I recently added a visually appealing chart to display some data on the home screen. The chart integration was successful, but when I introduced tab panes to the page and refreshed ...