Anomalies in the HTML and CSS file structure

While running my html on localhost, I encountered an issue when placing my CSS file in a css folder.

  href="css/well.css"

Here is the well.css file placed in the css folder https://i.sstatic.net/MOdra.png

Then, I tried moving the well.css file to the same directory as index.php and observed the following:

href="well.css"

Now, here is the well.css file in the same directory as index.php

https://i.sstatic.net/hfnsk.png

This is the content of the well.css file which includes Bootstrap styles for this site:

#well{
color:white;
}
#topping{
  background-color: black;
  color:white;
}
.active{
  background-color: white;
}
#rite{
  background-image:url("../1.jpg");
  opacity: 0.9;
  background-repeat: fixed;
}
#submit{
  width:100px;
  margin-left:90%;
  background-color:white;
}
#sing{
  background-color: white;
  color:#323280;
}
.panel-default > .panel-heading{
  background-color: #bd1919;
  color:white;
}
.panel-default > .panel-footer {
  background-color: black;
  color:white;
}

I am questioning whether the directory of the CSS file can impact the appearance of the website. Additionally, why does the panel heading have a different color even though it utilizes the same CSS style?

Answer №1

Is it possible for the directory of a CSS file to impact the appearance of a website?

Absolutely, yes.

For instance, if you utilize a relative path like

background-image:url("../1.jpg");
, the browser will search for the image in a folder one level above the CSS file's folder.

Thus, assuming your folder structure resembles this:

root/www/css/well.css
root/www/1.jpg

and then you rearrange the CSS as follows:

root/www/well.css
root/www/1.jpg

The browser will be unable to locate the image since it is no longer placed one level above the CSS folder.

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

Trouble with flex wrap in my design template using Material UI

How can I create a responsive template using flexbox wrapping method? <Box sx={{ padding: 0, margin: 0, listStyle: "none", display: "flex", flexFlow: ...

Tips for positioning elements on an HTML page by utilizing CSS styling

I have a primary container with the following CSS: .major { width:30%; height:100%; position:absolute; } Now, I want to insert web information at the bottom part which includes: About | Terms | Policies | Contact Us This content will be within the .web ...

Is there a way to change my cursor to a pointer finger when hovering over my box?

<script type="text/javascript"> function draw() { var canvas = document.getElementById('Background'); if (canvas.getContext) { var ctx = canvas.getContext('2d'); ctx.lineWidth = 0.4 ctx.strokeRect(15, 135, 240, 40) Is there a w ...

Creating a custom button in a Material UI table using React

I am looking for a solution specific to customizing the MaterialTable Actions column by adding an icon for viewing details. Although I have reviewed the documentation and API, I have not found an efficient way to achieve this customization. My project inv ...

Is it possible that using vim omni-complete will remove the word that I had previously selected

When writing HTML with gvim, I find it frustrating that the omni-complete feature always deletes my previous word and even my previously selected ones. For example, let's say I'm in the middle of writing the following code**('_' indica ...

Achieving Vertical Alignment of Text with CSS

Can you figure out what's wrong with the placement of content outside the <footer> tag in this HTML? Also, why is the text not perfectly vertically middle-aligned? <html> <head> <style> body { ...

What is the best way to add the current date to a database?

code: <?php session_start(); if(isset($_POST['enq'])) { extract($_POST); $query = mysqli_query($link, "SELECT * FROM enquires2 WHERE email = '".$email. "'"); if(mysqli_num_rows($query) > 0) { echo '<script&g ...

Visual Composer now appends "?id=" to the background images of columns and rows, enhancing the customization

I am in the process of improving the performance of a WordPress site that is using the Visual Composer plugin. When checking GTmetrix results, I came across this issue: Ensure resources are served from a consistent URL https://example.com/wp-content/uploa ...

Can anyone explain to me why I am unable to retrieve the pricing information from the Nike website using selenium and Python?

I've been working on a Python script that scrapes the prices of trainers from the Nike website and saves them into a CSV file. Initially, I tried extracting the price data from the HTML element, but that didn't work. I then switched to using CSS ...

Modifying SAS ODS contentitem in PROC SQL SELECT query

When using SAS to generate ODS output in HTML format, you have the option to include a table of contents with the "CONTENTS" and "FRAME" settings: ODS HTML PATH="C:\Path\" (url=none) BODY="body.html" CONTENTS="contents.html" ...

What is the method for including a TabIndex property in a JSON file?

https://i.sstatic.net/ISi72.png I discussed the integration of HTML fields within a JSON file and highlighted how to utilize the TabIndex property effectively in JSON files. ...

Issues arise with AJAX authentication request

Currently, I'm working on incorporating a basic login form with an AJAX request that forwards the user to a page for querying my database. Depending on the results, the user is then redirected to the main index page or prompted back to the login form. ...

Issues arising from the visibility and concealment of elements using bootstrap

Struggling with hiding certain content in my code. I'm fairly new to coding, having just started about a week ago. So far, I've learned HTML, CSS (which I find the most important), and how to utilize Bootstrap 4. My issue lies in wanting to hide ...

Tips for consistently positioning a div beneath another div in HTML/CSS

Would appreciate it if you could review this. <.div id="main"> Main Div <./div> <br/> <.div id="sub">Sub-Division<./div> ...

Why is the camera access permission dialog not showing up in the WeChat app?

Why is it that when I attempt to open the following links for the first time, Chrome asks for camera permission, but when I access them through WeChat's in-app browser, the camera permission dialog does not appear? Can someone shed some light on this ...

Determining the Nearest Form to an Element using jQuery

I developed a JavaScript/jQuery script that allows me to check all checkboxes within a form. The function works effectively, but the issue is that it checks all checkboxes on the page regardless of their form wrapper. Here is the function: function toggl ...

After applying styling, the modal close button refuses to be clicked

I'm currently facing an issue where I am trying to enhance a modal window with a close button, but encounter problems once styling is applied. The unique aspect of this problem arises from the fact that the close button is not directly in the page HTM ...

Clickable label for checkbox in Android browser is unresponsive

I've been experimenting with creating a responsive CSS menu using the checkbox hack Here's the HTML: <input type="checkbox" id="button" /> <label for="button" onclick>click / touch</label> <div> Change my color! </d ...

Hexagon in the Middle

I'm struggling to center these hexagons without them jumping up or down. I've tried searching online for solutions, but couldn't find anything that works. I found another hexagon style, but it didn't have any images so I couldn't u ...

The HTML.LabelFor function is failing to display correctly

I am facing an issue with Html.LabelFor where it doesn't render properly. Instead of displaying the value of ProviderName like "AT&T," it just shows the text ProviderName instead of the actual value. <div id="ServiceProvider" class="main_filter" n ...