My browsers seem to be having trouble pulling the CSS divDisplay code, but interestingly, CodePen has no issues with

I recently enrolled in a Coursera course titled "Introduction to Web Design for Everyone (Basics of Coding and Web Development)" as a beginner in the coding world. Setting up my workspace on the computer, I created separate folders for CSS and HTML files - naming them divDisplay.css and divDisplay.html respectively. However, upon opening the code in popular web browsers like Chrome, Firefox, or Microsoft Edge, I noticed that the CSS styles and divDisplay were not rendering properly. You can check out the issue at this link:

file:///K:/COURSERAWEBDEVELOPMENT/divDisplay.html

The peculiar thing is that when I transfer the same CSS and HTML code to CodePen, it works flawlessly displaying as intended. Here is an example of how it should look like: https://codepen.io/LuRocks/pen/RwbQxZj

While trying to troubleshoot the problem in Chrome by using the INSPECT tool and navigating to the CONSOLE tab on the far right, I encountered the following error message:

Failed to load resource: divDisplay.css:1 net::ERR_FILE_NOT_FOUND

If anyone has any suggestions or solutions to this dilemma, please do share. Your help would be greatly appreciated.

Thank you,

Luciana Castillo

I am at a loss on what else to try.

In Sublime Text3, this is the CSS3 code I have saved under divDisplay.css:

span{
height:50px;
width:75px;
background:#00ff00;
}   
div{
height:100px;
width:45%;
background:#00ffff;

}

p{
background:#ff00ff;
width: 200px;
height:100px;
}

Under the same editor, here's my HTML5 code saved as divDisplay.html:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset= "UTF-8">
<title>Div Display Example</title>
<link rel="stylesheet" href="CSS/divDisplay.css">
</head>
<body>

<span>Span A</span>
<span>Span B</span>
<span>Span C</span>
<hr>
<div>Div A</div>
<div>Div B</div>
<div>Div C</div>
<hr>
<p>Paragraph A</p>
<p>Paragraph B</p>
<p>Paragraph C</p>

</body>
</html>

The expected output is similar to what you see here https://codepen.io/LuRocks/pen/RwbQxZj, but unfortunately, I'm facing difficulties and the actual output appears differently. You can compare by pasting this link into your browser:

file:///K:/COURSERAWEBDEVELOPMENT/divDisplay.html

Answer №1

Forgot to include the CSS file path. Here's the correct link:

<link rel="stylesheet" href="../CSS/divDisplay.css">

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

Typing text into a dynamic span element using Selenium's send_keys function

I am currently utilizing selenium to modify the Yoast SEO meta description of a post within WordPress. Despite my efforts, I have been unsuccessful in getting this to function properly. Below is the code for the text box when there is no text present: &l ...

Assistance needed! Issue with the functionality of the survey modal text inclusion

Currently working on this page: The red bar is supposed to trigger a modal window with the survey inside. However, I am encountering an error in my .TXT file. <!--CSS--> There is additional code that I can't display due to restrictions from t ...

Can someone provide a method to automatically align bootstrap 5 footers within a set of cards?

Trying out this HTML code in Bootstrap 5, I noticed that the third column appears longer than the first two columns: <!-- bootstrap scripts --> <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_ ...

Having trouble with my CSS list, something appearing on top of it?

Check out my website at At the bottom of the page, you'll find a social media list that seems to be displaying oddly. It looks cluttered and like something is overlapping it. I can't seem to figure out what I'm doing wrong. Here's the ...

Should serverside validation be retained upon the second page load?

As a newcomer to programming, I encountered an issue while working on a form. In the "Preferred way of communication" section, selecting the "Mobile telephone" checkbox dynamically shows the "Confirm mobile number" textbox through my JavaScript code. If I ...

AngularJS allows for the use of multiple `ng-views` on the homepage

As a beginner in Angular, I recently started using ngRoute and ngView directives. I have encountered an issue that I believe stems from my lack of experience in Angular. Here is the simplified markup on my index.html page: <html> <head> ...

Ways to elegantly re-establish a websocket connection?

I've been working on a single-page application that utilizes HTTP and Websockets. When the user submits a form, I start streaming a response back to the client. Here's a snippet of the client-side code: var html = `<!DOCTYPE html> <met ...

What is the best way to add custom styles to an Ext JS 'tabpanel' xtype using the 'style

Is there a way to change the style of a Ext.tab.Panel element using inline CSS structure like how it's done for a xtype: button element? { xtype: "button", itemId: "imageUploadButton1", text: "Uploader", style: { background : ' ...

Is it feasible to place an image on top of a box?

Hello everyone, I have been trying to figure out how to achieve a specific layout in React. I am using MUI so there is no need for any hard-coded CSS. However, my attempts have not been successful so far. The layout I am aiming for consists of an image on ...

Mozilla Firefox is having trouble rendering HTML elements

While a webpage loads perfectly in Chrome, it seems to be causing some issues in Firefox. Can someone please shed some light on what the problem might be and suggest a solution? Please visit this Link in both Chrome and Firefox to see the difference. Chr ...

Creating a Custom HTML File in R Language

When creating an HTML report output using R, I encounter an issue where the charts I generate with ggplot are visible when I open the file myself. However, if I share the same html file with someone else, they only see the text and the charts are missing. ...

Determining the quantity of items within a div using jQuery

Similar Question: Retrieve the count of elements inside parent div using jQuery Can you determine the total number of elements within a specific div? <div id=count"> <span></span> <span></span> <span></ ...

When attempting to print a Rectangle on my webpage using JavaScript and taking user input, I encountered an error stating that 'str' is not defined

I'm trying to implement a feature where clicking on the "try it" button will prompt the user for the number of lines and then print that many lines in the form of a rectangle. However, when I run my code, nothing appears on the DOM and there is an err ...

The function of window.location is a mixed bag of success and failure

I am encountering an issue with a JavaScript function that is supposed to navigate to the next page when clicking a button. The function works correctly for step 1, but it fails for step 2. Upon executing the function using nextstep = 'form', _b ...

The jQuery navigation consistently unveils the initial option every time

My navigation element looks like this: <ul> <li name='first_item'> <ul> <li>item 1</li> <ul> <li>item 1.1</li> <li ...

Issue with Bootstrap 5 left-side navigation menu not functioning correctly with pills

My code snippet is as follows: <?php $page_title = 'Welcome to JPR Technology'; include('./includes/header.html'); ?> <body> <div class="d-flex align-items-start mt-5 ms-5"> <div class=&q ...

Creating elegant text in HTML using only CSSLearn how to design stylish text using CSS without any additional code

Can you generate stylish text using just CSS in HTML? Check out this link for a great demonstration of fancy text. ...

What measures can I take to prevent images from being easily saved from my website?

Have you noticed that background images cannot be saved by simply long pressing or right clicking on them? In order to save the picture to your hard disk, you'll need to save the entire webpage. Is there a way to make a picture harder to save, such as ...

Arrange elements within a division when the division splits into two rows

Currently in my setup: I have a navigation bar with a group of buttons located on the right-hand side. When the navbar is reduced to a smaller size, like on a smartphone, the two buttons get split across 2 rows within the div. In this state, I'm ai ...

The left and right boxes have the same background color, but the left box is filled with lots of content while the right box only has a small

For my layout, I am using two boxes - a left_box with float:left property, and a right_box also with float:left property. The left box contains a lot of content and images, while the right box has only some content and images. Initially, everything was wo ...