The CSS modifications are only visible in my browser after I delete the browsing data

After setting up a landing page with simple text in the center of the screen using flex, I encountered an issue. Whenever I made changes to the CSS, they would not reflect in my browser unless I cleared the browsing data (history, cookies, etc). This problem persisted across different browsers such as Chrome, Firefox, and Android Internet. Interestingly, changes to the HTML code were immediately updated on the page without any issues. This inconsistency was observed both on desktop and mobile devices.

I'm curious if anyone knows why this is happening and how it can be avoided. The code for reference:

<!DOCTYPE html>
<html>
    <head>
        <title>Landing page</title>
        <link rel="stylesheet" href="style.css"/>
    </head>
    
    <body>
       
        <div class="flex-container">
            
            <div class="items style"><h1>My<strong>TEXT</strong></h1>
            <p>Business type | <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99fcf4f8f0f5d9fcf4f8f0f5b7faf6f4">[email protected]</a> </p></div>
        </div>
    </body>
</html>

Style.css

body{
    overflow: hidden;
    background: black;
}

.flex-container{
    display: flex;
    background-color: black;
    justify-content: center;
    flex-wrap: nowrap;
    align-items: center;
    min-height: 100vh;
    }


.style{
    font-family: 'Poppins', sans-serif;
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    color: #FFFFFF;
    }

@media screen and (min-width: 800px){
    .flex-container > div {
        background-color: black;
        margin: 20px;
        padding: 20px;
        font-size: 220%;
        color: white;
        border: thin solid white;
        text-align: center;
        border-radius: 5px;
    }

}

@media screen and (max-width: 799px){
    .items{
      flex: 100%;
      align-items: center;
      }
}

Answer â„–1

If you're looking to ensure the browser loads the most recent version of a CSS file instead of relying on a cached version, one technique you can employ is to add a version number as part of the file URL. This prompts the browser to fetch the updated CSS file. Consider using this code snippet as an example:

<link rel="stylesheet" href="style.css?v1"/>

Answer â„–2

I appreciate the effort with your solution, but unfortunately it did not yield successful results. My website consists of a basic landing page similar to any other HTML page. I'm puzzled as to why this issue is occurring specifically in my setup. Could it possibly be related to the implementation of flexbox?

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

Guiding users who have disabled JavaScript through redirection

When faced with the following markup, users whose browser has JavaScript disabled will be redirected to an alternative page. This alternate page may attempt to mimic the site's functionality without JavaScript or simply display a warning message infor ...

What is the best method for initializing Bootstrap data attributes API?

I've been puzzled by this issue for a while now. When trying to use the JavaScript components, I can't seem to grasp how to utilize them using the Data Attributes API, also known as the first-class API. For example, take the modal component ment ...

What is the best way to keep track of dynamically inserted input fields?

I've created a form with two text boxes: one for entering people's "name" and another for their "surname." By clicking on the page, you can add additional pairs of text boxes for both "name" and "surname," allowing users to input as many pairs as ...

What is the reason behind genNewColor function's malfunction?

I'm having trouble with this code that is supposed to generate a random color. The CSS formatting works perfectly, but I suspect there might be an issue with the function itself. When I try to run the code, it doesn't produce any error messages â ...

Increase the CSS integer by a set value at regular intervals with the help of JavaScript

I am looking to create a simulated loading icon that gives the illusion of loading for some calculations, but in reality, it loads quickly. My plan is to increment the animation every second until it appears "complete". I am using CSS3 animations, with a h ...

As the user scrolls down, the navigation becomes obscured by the content

Whenever I scroll down on my website at Bradly Spicer, the navigation menu extends and ends up falling behind the content. This is the script I am using: .menu { position: relative; z-index:9999; } .post { background: #fff; border: 1px solid #ddd; font- ...

Interested in incorporating href within a PHP variable?

My goal is to send a verification email without displaying the link in the email itself. Instead, I want to include text that says "click here to verify." { $verify_email=" Hello, Thank you for signing up. To verify your e-mail, please visit http://".$sit ...

What is the best way to hide the black icons (x) and bars on larger screens and which specific CSS code should I use to achieve this?

I'm attempting to display menu icons only on smaller screens like phones or tablets, and text on larger screens such as laptops or desktops. I've experimented with adjusting the media query and CSS, but haven't had any success. What specific ...

Deactivating a widget on one of my web pages

I'm looking to disable a widget on certain pages. Does anyone know how to do this? One idea I had was to add a condition in the HTML (using Django or PHP?) of the widget that would make it only appear if the site URL is not the one where I don't ...

How can I modify the custom CSS to adjust the color of a Font Awesome icon?

Hello everyone! I am new to coding and I have a question for the Stack Overflow community. I am trying to customize the color of my Font Awesome icons on the homepage of my WordPress theme (Arcade Pro) using the custom CSS editor. Can anyone provide me w ...

What causes a fixed position div to extend beyond the boundaries of the main container?

Below is the CSS for the fixed div: .top-container { position: fixed; width: 100%; z-index: 999; } Upon zooming out the screen, the div causes the main container to break on the right side while the left side remains unchanged. Refer to the screenshot be ...

Strange Behavior of Json Dataset

I've noticed some unusual behavior when loading JSON data via AJAX with an interval. Initially, the data loads correctly, but after a few intervals, it starts to get scrambled and runs unpredictably between intervals. This issue even leads to crashes ...

The issue with the Bootstrap 5 navbar in an Angular project is that it expands properly but fails to close when

I am currently working on developing a Single Page Application using Angular 12 and Bootstrap 5. As part of this project, I have created a shared navbar component. The issue I am facing is that when the navbar transitions to the hamburger menu button for ...

Steps for designing image animations with fade in and fade out effects

I have a task to enhance the current code provided below, which currently works with only two images. HTML: <div id="cf"> <img class="bottom" src="<?php bloginfo('template_directory') ?>/assets/img/image1" /> <img class ...

Retrieve the text input from the text field and display it as

Is there a way to display what users enter in a textfield when their accounts are not "Activated"? Here's an example: if(active == NULL);{ //I've attempted the following methods. //In this scenario, 'username' is the name of ...

Dim the shading of a portion of the picture

If you have an image that covers an entire element through CSS like this #myDiv {background-image: url("../images/background.jpg "); background-repeat: no-repeat; background-size: cover; background-position: center;} Now, what if you want to add a gray ov ...

Is the PHP variable receiving a null value by the conclusion of the script?

I'm facing a puzzling issue that I just can't crack. Currently, I'm in the process of developing a blog and I've encountered an anomaly with a cookie-generated variable that holds a post ID. Strangely, when I reach the if(isset) stateme ...

Creating a functional dropdown form in Ruby On Rails: A Step-by-Step Guide

Having an issue with implementing a dropdown form in the navigation bar of my Rails application. The problem arises randomly - sometimes it works smoothly, while other times I have to refresh the page for it to function properly. The Rails version being u ...

I’m having trouble getting my home.html page to render in Spring Boot

https://i.sstatic.net/ovw5z.jpg This image perfectly encapsulates the essence of my code and project structure. I am encountering an issue where I cannot return the home.html file located in the static folder. I have tried specifying it as 'home&apos ...

The margins within the div of the new tab are not applying as expected

Greetings! Currently, I am in the process of generating a dynamic form within a new tab using JavaScript. For some reason, the margin effects on the div element are not being applied correctly. Despite my attempts to set the margins using both classes and ...