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

Combining Sass and SCSS in webpack: A step-by-step guide

Just curious about something. I have some libraries I'm interested in using (for example, font-awesome) that use scss, but I personally prefer working with sass. How can I set up my project with webpack to accommodate this? Here's my current s ...

Steps for shaping the dialog of Material-UI to fit an image

Is there a way to adjust the size of the dialog box to match that of the image? https://i.stack.imgur.com/pXtXg.png I've also tried changing the background color to transparent without success. https://i.stack.imgur.com/Hjx2x.png ...

Obtain the radio button value along with the values of all other input fields

$('.cinput').each(function(){ console.log($(this).val()); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type='radio' name='radiox' class='cinput' v ...

Here is a unique rewrite:"Adjusting the prop of a Material UI Button component depending on screen size breakpoints can be achieved by utilizing

While using the Material UI Button component, I encountered an issue with conditionally determining the variant of the button based on screen size. Specifically, I want the variant to be 'outlined' on medium and larger screens, and no variant at ...

Hovering over the designated area will reveal the appearance of

I've encountered an issue with a list group in a card. Specifically, when hovering over the topmost item in the list group, a border appears underneath it (which should only appear when hovering). However, when I try to override this behavior using :h ...

Issues with jQuery causing responsive CSS triangles to fail implementations

Recently, I stumbled upon the interesting concept of CSS triangles created using element borders. I decided to incorporate this design into one of my custom Wordpress themes, but I encountered a problem. I wanted to add a triangle at the bottom of a div, l ...

Employing jQuery to implement a hover animation on IE9, it functions properly when hovering over but exhibits strange behavior upon exiting

My website features a quote box positioned to the right of the browser. When hovered over, it reveals a list of available dates. I initially tried using CSS transitions which worked on all browsers except for IE - no surprise there. So, I turned to jQuery ...

Swap two frames effortlessly with just a single click!

Is there a way to effortlessly change the contents of two frames with just one click? With a single click, I'd like to modify both "framename" and "framename2" by setting their href attribute to 'qwerty' and 'qwerty2' respectively ...

Is it possible to display the HTML video poster at the end of the video without relying on jQuery or JavaScript?

I have a webpage with multiple informational videos, using basic HTML/CSS player markup without any Javascript/jQuery knowledge. After a video is played or paused, the poster image does not reappear. Is there a way to recall the poster within the simple HT ...

Generate a fresh row in a table with user inputs and save the input values when the "save" button is

HTML: <tbody> <tr id="hiddenRow"> <td> <button id="saveBtn" class="btn btn-success btn-xs">save</button> </td> <td id="firstName"> <input id="first" type="tex ...

Angular - developing a custom web element to enhance the project

Is there a way to convert a single module into a web component and integrate it within the same project? Specifically, I have 3 modules in my project and I am looking to transform only module1 into a web component and incorporate it seamlessly. Thank you! ...

Issue with mouse hover not triggering overlay effect between two div elements

I am trying to display articles in a 2x3 matrix with article details like image, title, author, and description wrapped inside a div. I want this entire div to be overlapped by another div of the same dimensions containing a single image. Below is a snipp ...

An error in PHP has been detected within the CodeIgniter framework

I have encountered an error that has been frustrating me lately: An unexpected PHP Error occurred with the following details: Severity: Warning Message: strip_tags() expects parameter 1 to be string, array given Filename: inscription/loginform3.php Line ...

Is there a way to insert a clickable hyperlink in the text of a MessageDialog?

I am currently working on MessageDialog code that looks like this: MessageDialog dlg = new MessageDialog("None of the images you selected contain location information. You can add your own after downloading http://exifpilot.com/"); await dlg.ShowAsync(); ...

Using Rails and HAML to incorporate looping HTML5 video tags

I have a question regarding how I'm using Rails video_tag to display a video: = video_tag("SMR_video.mp4", :controls => false, :autobuffer => true, :autoplay => true, :loop => true, :id => "hero-video") After implementing the above co ...

Problem with translating a variable into a selector in JQuery

When attempting to make my Jquery code more flexible, I decided to extract the selector and access it through a variable. However, despite creating variables for both selectors, neither of them seem to be functioning properly. I am confident that the issue ...

using the GET method to transfer empty data

I am currently developing a basic search feature using php/sql with a primitive approach. Essentially, I am utilizing the GET method to send the form query across multiple fields in /search.php. This implies that the query will be sent in the following fo ...

Is it possible in HTML to create an "intelligent" overflow effect where text is truncated and replaced with an ellipsis "..." followed by a link to view the full content?

I have a <div> that has a limited size, and I am looking for a way to display multiline text in it. If the text exceeds the available space, I would like to add "..." at the end along with a link to view the full content on another page. Is there a ...

The inner HTML functionality in Angular 2 seems to be malfunctioning when dealing with HTML tags

I am facing an issue with an array that includes displayName with HTML tags: this.topicsList = [ {id: "173", name: "Discussion1", displayName: "Discussion1", status: 1}, {id: "174", name: "discussion123", displayName: "discussion123", status: 1}, {id: "19 ...

Modify picture properties when listbox is altered using jQuery

I need to set up a unique album gallery display where different folders are selected based on the item chosen in a selectbox. Below is the HTML code: <select name="album" id="album" onChange="changeimage();"> <option value="0" selected disab ...