What could be causing an issue with the CSS file in the Chrome browser?

Just delving into the world of HTML, CSS, and JS. Recently followed a tutorial on creating a "Rock Paper Scissors" game website on YouTube. Currently facing an issue while setting up the CSS file in the initial stages. Here's what I've tried.

@import url('https://fonts.googleapis.com/css2?family=Asap:wght@600&display=swap');

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

header{
    background : white;
    padding: 20px;
}

header > h1{
    color :  #25272E;
    text-align: center;
    font-family: Asap, sans-serif;
}

body{
    background-color: #25272E;
}

.score-board{
    margin : 20px auto;
    border : 3px solid white;
    border-radius: 4px;
    width : 200px;
    text-align: center;
    color : white;
    font-size: 40px;
    padding : 15px 20px; /*top-bottom left-right */
    font-family: Asap, sans-serif;
    position : relative;
}
.badge{
    background : #E2584D;
    color: white;
    font-size: 14px;
    padding : 2px 10px;
    font-family: Asap, sans-serif;

}

#user-label{
    position : absolute;
    top: 0px;
    left : 0px;
}

In my HTML document, I included it in the header section as per my learning process.

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Rock Paper Sissors Game</title>
        <link rel="stylesheet" type="text/css" href="css/page_styles.css">
    </head>
    <body>
        <header>
            <h1>Rock Paper Sissors</h1>
        </header>
        <div class="score-board">
            <div id = "user-label" class="badge">user</div>
            <div id = "computer-label"class="badge">comp</div>
            <span id="user-score">0</span>:<span id="computer-score">0</span>
        </div>
        <div class="result">
            <p>Paper covers Rock. You Win!</p>
        </div>
        <div class="choices">
            <div class="choice" id="r">
                <img src="images/hand_rock.png" alt="">
            </div>
            <div class="choice" id="p">
                <img src="images/hand_paper.png" alt="">
            </div>
            <div class="choice" id="s">
                <img src="images/hand_sissors.png" alt="">
            </div>
        </div>
        <p id="action-message">Make your move</p>
    </body>
</html>

I've verified the file paths and they seem correct. However, upon launching the HTML page, the styles are not being applied. Initially, I inspected the sources through Chrome developer tools, and everything seemed fine.

But after refreshing the page, the CSS source link changed unexpectedly.

This issue is specific to the Chrome browser as it works fine on Microsoft Edge.

Images for reference:

HTML CSS image -https://i.sstatic.net/rXAkb.jpg

Chrome display -https://i.sstatic.net/XCx3m.jpg

Upon reloading the page -https://i.sstatic.net/QY1hb.jpg

Seems like the CSS file disappears upon refresh.

Answer №1

Don't worry, your CSS file is not missing. To locate it in your editor, simply find the CSS link:

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

Hover over the href, then press alt + click to access your file. Another way to find your CSS file is through the editor's Explorer function.

If you still can't find the CSS file, try using the search feature on your PC.

Based on the images provided, any changes made are only visible on the browser copy. If using the page option, attempt a hard reload with ctrl + shift + R. Alternatively, close and reopen the page after a hard reload to address any display issues.

Keep in mind that CSS code order matters. For example, if you add body { background-color-:red; } above existing CSS, it will be overridden. Ensure correct order like:

body {
    background-color: #25272E;
}

If utilizing developer tools for file edits, use the "overrides" feature to apply changes locally as well:

  1. Navigate to Sources > Overrides > Select folder to override (your project folder)
  2. Check the local override option
  3. Select the file to edit, save changes, and reload to see updates on your local copy

This information should assist you in addressing any concerns you may have had. Hope this helps!

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

Switch between addition and subtraction functionality using jQuery

I am in need of a solution to retrieve the current value of a div and then increment or decrement that value based on the toggle of another div. The process should follow these steps: Retrieve current value Increment by '10' upon first click D ...

Exploring the functionality of buttons within jQuery Impromptu

My current project involves creating a survey composition tool. The main focus is on having a preview button that displays the values inputted by the user. <!doctype html> <html> <head> &l ...

The gradient background-color feature in three.js seems to be malfunctioning

I created a website featuring a 3D graphical project using three.js. After spending a few hours searching on Google, I came across the following widely-used source code for creating a gradient background-color: html { width: 100%; height: 100%; ba ...

HTML: Incorporating a Header and Footer with Dynamic Content that meets specific requirements

I'm currently facing a challenge in creating a webpage that requires a normal header, sticky footer, and fluid body content stretched vertically without using absolute positions due to a page min-height requirement of 780px. While I managed to achiev ...

creating a webpage that includes a dynamic query variable

I'm currently working on a webpage that displays a summary of a report. By default, it only shows data for today. This is how I've set it up: include $connection $date ='current_date'; $query1 = mysqli_query($connection,"SELECT * from ...

What are the methods for storing scripts and images from my website?

Question on Website Speed I've been working on building a website hosted on x10hosting and have been researching ways to make it faster. I came across a page that suggested improving JQuery codes could help with site speed. The page mentioned that in ...

What is the best way to embed sections of one HTML page into another page?

Is there a method I can use to embed sections of one webpage within another webpage? The dilemma arises from the fact that the second page has a distinct style compared to my main page. Is it feasible to apply the alternate style solely to specific content ...

Maintain the vertical alignment of an item at a fixed point, even as the height of the

I'm currently working on a multi-step form project with three tabs, each containing a different section of the form and varying heights. The challenge I'm facing is to center the tallest tab vertically on the page, while aligning the other two ta ...

Error: ReactJs unable to find location

I'm attempting to update the status of the current page when it loads... const navigation = \[ { name: "Dashboard", href: "/dashboard", current: false }, { name: "Team", href: "/dashboard/team", current: fa ...

Tips for preventing the appearance of two horizontal scroll bars on Firefox

Greetings, I am having an issue with double horizontal scroll bars appearing in Firefox but not in Internet Explorer. When the content exceeds a certain limit, these scroll bars show up. Can someone please advise me on how to resolve this problem? Is ther ...

Please reset the form fields after the most recent edit

I've created a form that includes multiple select elements. When an option is selected, it activates the next select element and updates it with values using Ajax and PHP. However, I'm facing an issue where changing a previous option only resets ...

Restrict the input area of a text field

Apologies for the basic question, but I couldn't find an answer online. I have a textarea that I want to be resizable, but with specific dimensions when the page loads. The initial size should be the minimum size of the textarea. Additionally, I woul ...

Microsoft Edge breaks free: Introducing Dark Mode for iOS

It seems like Microsoft Edge's "Dark Mode" on iOS has a mind of its own. While it works as expected on Chrome, Safari, Firefox (iOS), and Chrome, Safari, Firefox, and Edge (OSX/Windows), I'm encountering some issues specifically with Edge on iOS. ...

disabling responsiveness in Bootstrap 2

I am facing an issue with Bootstrap version 2 where I am unable to fix the grid layout. Even after wrapping all my HTML elements in a container, the layout still behaves unpredictably on different screen sizes. Here is a snippet of my code: <header> ...

Display the text area when the "Yes" radio button is clicked, while it remains hidden either by default or when the "No" radio button is selected

I am currently working on an html code and I am looking for a way to use java script in order to create a text area box only when the "Yes" radio button is selected. This text area should be hidden by default or when selecting "NO". <table class="tab ...

Unable to click on Textarea due to CSS issue

Is there a way to prevent clicking on a textarea by setting its css? <textarea></textarea> Many thanks! ...

Excessive Margins in Bootstrap on Mobile Devices

After attempting to create a webpage using Bootstrap 3.3.6, everything looked good on my laptop. However, when I tried to view it on mobile devices using Chrome and other browsers, there was a significant offset issue. Current situation: https://i.sstati ...

Navigating events within the Material Design Light (MDL) mdl-menu component can be

I am utilizing Material Design Light with just PHP, jQuery, and MDL min CSS and JS, no other frameworks involved. Keeping it simple with a basic menu. <button id="lang-switcher" class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect"> ...

Showing a temporary marker while utilizing jQuery UI sortable container

Incorporating a sortable list of items using jQuery UI in a bootstrap layout has been successfully declared. $("#ReportContainer").sortable({ helper: 'clone', revert: 'invalid', }); Each draggable item represents a column size ra ...

Scroll to value in a custom dropdown with AngularJS

How do I ensure the selected item in a listbox scrolls to the top? [http://jsfiddle.net/729nX/1/] I need help with a similar issue, but there are a few differences: 1) I want to use only AngularJS without jQuery. 2) My code is unique from the example pro ...