The CSS code is effective on one page but fails to render on the other

I am in the process of creating a website for my jewelry business and it's my first time doing so. I'm facing an issue where the CSS styles are being applied to one page but not to the other, even though both HTML files have the same code linking the CSS file:

<link rel="stylesheet" href="shizoid.css">
.

You can check out the screenshots here: https://i.stack.imgur.com/q4uPL.jpg https://i.stack.imgur.com/R6DuQ.jpg

As shown in the images, the HTML contains the tag:

<h1>Extravagant, Unique, Handmade Jewelry and Crafts</h1>
, and the corresponding CSS styling is:

h1 {
        background-color: #a018ba;
        border-radius: 15px;
        font-family: Garamond;
        font-size: 40px;
        text-align: center;
        margin-bottom: 0px;
    }

The strange thing is that this styling works on one page but not on the other. It was working fine yesterday but now it's not. I've checked in both Firefox and Chrome on different computers but still can't figure out the issue. Any help would be greatly appreciated. :)

Answer №1

In my experience, I've found that it's more effective to style elements like borders and backgrounds by applying them to a div and then placing the h1 within it. To illustrate, your CSS could appear as follows:

#title-box { width: 800px; margin: 0 auto; background-color: #a018ba; border-radius: 15px;  text-align: center; }
h1 { font-family: Garamond; font-size: 40px; }

As for your HTML, it might look like this:

<div id="title-box"><h1>Extravagant, Unique, Handmade Jewelry and Crafts</h1></div>

Based on the images you provided, I suspect there could be an error elsewhere in your code, such as a missing

tag without a corresponding
tag, preventing the CSS from being applied correctly.

Answer №2

It's challenging to pinpoint the exact issue without more details about your website, but my initial thought is that your second webpage might be in a folder and you may have forgotten to update your CSS.

<link rel="stylesheet" href="../shizoid.css">

If your webpage is indeed in a different folder, you can utilize this href to navigate back to the previous directory.

Answer №3

It seems like there may be an issue with your concept. The problem may not necessarily be related to CSS. Upon closer inspection, it appears that each of your images is unique. By simply dragging and moving the images in your browser, you will notice their differences. It appears that your entire site is made up of images rather than containing any HTML tags such as

<h1>Extravagant, Unique, Handmade Jewelry and Crafts</h1>
. Feel free to take a look at the image I have posted for comparison by saving it to your local drive or dragging and dropping it into a new tab in your browser.

I hope this helps provide clarity on the situation.

Answer №4

If you want to keep your CSS organized (especially if it applies to the entire site), you can create a folder named CSS in the root directory and store your stylesheets there. Then, linking to the stylesheet from any page is as simple as:

<link rel="stylesheet" href="/css/shizoid.css">

Using the initial '/', you are directed back to the root of your site.

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

Using Express, Node, and JQuery to handle form submissions

I am struggling with form submissions while working on a web app using HTML, Express, and Node.js. Despite being new to these technologies, I have created a script that generates a dynamic form based on certain factors: $FormContainer.html(''); ...

Is there a way to transmit a div using Node.js?

Scenario: I am developing a web application that allows users to draw on a canvas, save the drawing as an image, and share it with others using Node.js. Current Progress: Drawing functionality (real-time updates on both clients). Saving the canvas as a ...

Ways to center Bootstrap panel in the middle of a webpage

Is there a way to center this entire panel on the web page? I could use some guidance with this. Does anyone have recommendations for a good book to learn Bootstrap design? <div class="panel panel-default" style="max-width:500px;margin-left:auto;margi ...

Is it possible to use an Ajax callback function to add a select dropdown HTML to a table

I am currently in the process of using jQuery to append some HTML with the code provided below. My main objective is to select an option based on AJAX response data and create a select dropdown menu. However, the variable scope of sOut doesn't seem to ...

Issues with external javascript link functionality

I'm having trouble connecting my external JavaScript file to my HTML code. I'm attempting to concatenate two strings using an input function and then display the new string in the empty text field. What could be causing this issue? Appreciate an ...

Problem arises when the DIV elements are not expanding horizontally together

Struggling to create a round corner box using divs. I have been working on it all day and can't figure out what I'm missing. If anyone could help me spot the issue, that would be great. I want the 'header' and 'footer' to exp ...

Retain the formatting of HTML while extracting the text

Is there a simple way to extract text from HTML source without losing formatting (such as line breaks and spaces)? Currently, my text extraction process looks like this: page_title_element = driver.find_element_by_xpath("x-path") page_title = pa ...

Unable to run JavaScript file fetched from cache API

For a web application built using pure vanilla JavaScript without utilizing service workers, I am looking to cache a JavaScript file hosted on an AWS S3 file server explicitly. The script below will be embedded in the index.html file of the application (UR ...

What is causing the tabs to not update the navigation in nav-tabs?

I recently implemented a tab list using Bootstrap, similar to the one shown in the image below: https://i.sstatic.net/KEy7F.png However, I encountered an issue where clicking on "Profile" or "Contact" tabs does not change anything. Even though I inclu ...

Mastering the art of using div boxes in boxing form

When I box in information using divs, I've noticed that sometimes the wrapping boxes don't fill out the space completely. This can result in elements from other wrappers encroaching into the box area. For example: <div> <div style="le ...

Using absolute elements within a div that is positioned relative in HTML code

In the layout below: <div style="margin-top:0%" class="postcell"> <div id="postspantitle" > <span class="texts"><?php echo __('Başlık :', 'goldmem');?></span> </div> & ...

What's the issue with my jQuery AJAX script?

I am experiencing an issue with my ajax pages using jQuery to retrieve content. Only one page seems to be working properly, even though I have multiple pages set up. How can I resolve this problem? $(document).ready(function() { $('.lazy_content& ...

Revolutionary newspaper design utilizing asp.net's C# web forms

Trying to create a dynamic newspaper layout using ASP.NET C# web form. Struggling to set the page layout size inside a slider and display specific news content on a new page when clicking on an area of the newspaper using Repeater or another suitable contr ...

Enhancing the appearance of an image upon hovering in ReactJS: A step-by-step guide

My issue arises from my desire to border an image and display a Card with information upon hovering, but the problem is that this style is being applied to all images rather than just the one being hovered over. After pulling data from a movie API, I stor ...

What are the steps to design a versatile gallery page that can serve various projects?

Allow me to get straight to the point. What is my goal? I am aiming to develop galleries for various projects. Each project's thumbnail on the main page should open a gallery as a new page. These galleries will all have the same layout but different ...

How to adjust the size of a div based on its child content, including margins

I have encountered an issue with animating the height of a configurable content div, which typically contains paragraphs of text. Shown below is my animation (slowly paced), starting from a height of 0 and expanding to its calculated height based on its c ...

jQuery is unable to locate the FireBreath object

Currently, I am in the process of developing a web video player by using Firebreath to compile my C/C++ codec as a browser plugin. The plugin has been successfully loaded and is functioning properly (start, stop video, etc.). My next goal is to enable full ...

Looking for guidance on integrating Forms with VueX and script setup? Are you utilizing v-model in your implementation?

UPDATE: I'm contemplating whether or not to abandon VueX entirely due to its outdated status, with Pinia being the preferred choice nowadays. Can someone confirm this? https://stackblitz.com/edit/vue-script-setup-with-vuex-hmrk5d?file=src/store.ts ...

Error: Syntax mishap detected - Oh dear

Recently, I've been developing a small slideshow / public display for a client using the HTML5 Rock's Slideshow code. Everything was going smoothly until I encountered a DOM Exception 12 - an error related to CSS selectors. Strangely, I couldn&ap ...

What are the steps for positioning tables using HTML?

As a newcomer to this field (literally just started two days ago), I have managed to generate tables from an XML file using my XSL file. However, aligning these tables properly has become a bit of a challenge. I initially used the align attribute of <ta ...