Removing a background by linking a CSS file

Issue Resolved: I have found the solution. The problem was that the css document still contained html tags. Thank you to everyone who provided assistance.

While designing a website using css, I encountered a situation where the site worked perfectly when the css code was embedded directly in the HTML file. However, when I saved the css in an external file within the same directory as the html file and included it using the link tag, the layout remained intact but the background image disappeared. Here is the snippet of my css code:

<style type="text/css">
body {
background-image: url('http://www.thepeepinghole.tk/pics/stone.jpg');
color: white;
}
#menubar {
position: relative;
width: 75%;
height: 60px;
}
#menubar svg {
margin: 0px;
width:100%;
}
#menubar h3 {
position: absolute;
top: 0px;
left: 10px;
}
#top {
height: 150px;
width: 75%;
background-color: rgba(0,0,0,0.6);
}
#top img {
position: absolute;
left: 11%;
top: -2%;
width: 266px;
height: 200px;
width: auto;
z-index: 2;
}
#top img.mirror {
position: absolute;
left: 69%;
top: -2%;
width: 266px;
height: 200px;
width: auto;
z-index: 2;
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
#top h2 {
position: relative;
top: 30%;
}
#top h1 {
position: relative;
top: 30%;
}
#menubar a {
color: white;
}
#menubar img {
position: absolute;
top: 0px;
left: 85%;
float: right;
}
#content {
width: 75%;
background: rgba(0,0,0,0.6);
}
</style>

I am including this css file in the head section of my html file using the following code:

<rel link="StyleSheet" href="http://thepeepinghole.tk/mainpage.css" type="text/css" />

Answer №1

It appears that the issue lies in your syntax: It should read as follows:

<a href="http://theviewingportal.tk/index.css" rel="stylesheet" type="text/css">

instead of

<rel link="stylesheet"...>

Answer №2

Determine if there are any additional CSS rules that take precedence over the ones written in the external stylesheet.

For instance:

<rel link="StyleSheet" src="file.css" media="all" type="text/css"
 />
<style>
.background{
//If there is another CSS rule with the same class or ID, it will overwrite the one from the external file.
}
</style>

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

The various options in the dropdown menu are descending in order

I am currently facing an issue with a dropdown menu that contains the list of products offered by our company. Specifically, one of the product names, Hotel Management Solutions, is appearing on multiple lines instead of a single line in the dropdown menu. ...

Shift the checkbox label over to the left with just CSS

I am faced with the following code snippet: <div> <span> <input type="checkbox"> <label>I desire this to appear on the left-hand side</label> </span> </div> My goal is to shift the label to the left side of ...

Utilize Android accelerometer data to bring objects to life with animation

Utilizing an Android app, I am streaming accelerometer data to a Python script on my PC. The data is then saved to a text file. My goal is to utilize Javascript and jQuery to animate a 3D CSS cuboid (representing the device) to replicate the movements capt ...

Validating Color Properties with CSS 3.0

When using Visual Studio 2012 (Ultimate), a red squiggly may appear indicating that rgba(255, 255, 255, 0.4) is not a valid color property value However, according to the W3C, it is considered a valid value. Could this be a bug in Visual Studio, or am ...

The collapsed navbar button in Bootstrap is unresponsive

I run two websites. The Collapsed Navbar functions properly on the first site, located at (Index Site). <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" ...

Resounding achievement following the completion of the upload

I'm looking to display the message "success" on the same page as my form if it uploads correctly. I am new to PHP and not sure how to achieve this. Can anyone help? index.php <form action="upload" method="POST"> <input name="field1 ...

Customize the Width of DropDown List Items with Razor

I'm having trouble adjusting the width of items in a DropDownList. I want the width of the DropDown items to be different from the DropDown itself. Can anyone assist me with this? <div class="col-md-3"> @f.FormGroup().DropDownList("IdTipoAc ...

Tips for halting click propagation in VueJS

My dilemma lies within a recursive list (tree) where each element contains a @click="sayHello(el.id)". The challenge arises due to the nested structure of the list, such as: list-element-0-01 ├──list-el-1-01 │ └──list-el-2-01 └──list ...

Upon its second use, Ajax is loaded with cached data

Imagine a table with multiple rows, each row containing a SHOW button that reveals hidden content when clicked. The hidden div (with the classname "Content") loads the content of a second page using ajax and the id of the corresponding table row. However, ...

How can I adjust the number of columns displayed per page on a Bootstrap Studio website?

Currently, I am utilizing Bootstrap studio to design a website featuring multiple cards on each page. Initially, I incorporated cards from the sb-admin-2 template and everything was proceeding smoothly. In my bootstrap studio interface, the three-column ca ...

Lose the scrollbar but still let me scroll using the mouse wheel or my finger on the fullscreen menu

I am currently working on a fullscreen menu design. However, when the menu appears, some elements are not visible unless I apply the overflow-y: scroll property to the menu. But I don't like the appearance of the additional scrollbar that comes with i ...

What is the best way to incorporate a <c:forEach> loop into JSP operations?

I am attempting to calculate the product of two variables that are associated with an item in a loop. Below is the code snippet from the JSP file: <table> <thead> <tr> <th>PRICE</th> <th ...

Adjusting the display of HTML elements depending on geolocation authorization

I am currently facing an issue with my HTML code where I want to show an element only if the user declines to share their location with the browser. However, my code is not functioning as expected when the user rejects the location request. On the other ha ...

What is the best way to incorporate several php files into a WordPress post?

I have developed a system that retrieves information from a database and presents it in multiple text files. Now, I am looking to move this system to a page on a WordPress website. I have already created a custom page named page-slug.php and added the ne ...

What is the best way to add color to a Table Header?

I'm working on a HTML/CSS table and I want the header row to have a specific background color. Below is my code: <table class="contentTable"> <tr class="contentTableHeader"> <th>No.< ...

Step-by-step tutorial on designing an input slider to dynamically adjust the CSS :before linear-gradient values

Is there a way to achieve a gradient effect using pseudo-element :before on an image that can be customized by adjusting a slider input? I've been trying to implement this feature with the following code, but have not been successful so far. var ...

Excessive gap located above the section element

On the web page I'm practicing with, I've noticed an unwanted space at the top of the "Favorite Food" section. To center my unordered list, I made the "section" elements inline-block, but this created the issue. How can I remove that space at the ...

CSS - Height not working properly on mobile device model iPhone 6

I've been working on a seemingly simple problem for some time now without success! The issue involves a <header> element with a height of 100px. When the screen size reaches a certain breakpoint (specifically targeting mobile devices), I need ...

Footer overlapping occurs on a single page

My webpage is having an issue where the footer is overlapping. It seems to be fine on all other pages except for this one. I would prefer not to make any changes to the footer since it's working correctly on other pages. Is there a way to adjust the C ...

How about incorporating two subtly tilted SVGs for a creative twist on navigation backgrounds?

I am in the process of designing the navigation menu for my website and I have a specific vision in mind. I want to create a unique background using two rectangular SVGs that are slightly rotated off axis and overlapping each other, with their edges extend ...