This project i originally wrote on VS Code and the CSS style sheet links an image from my laptop as a background-image: url()
Now i want to use the same CSS file to style a similar HTML document, that will use many of the same attributes and that will be linked to the original HTML as a part of the same website (Psalm 2, for example), the first difference would be a different background image. That’s why i gave the body element a specific id.
I can’t linked the second HTML to that same CSS. I used identical syntax: link href="style.css" type="text/css" rel="stylesheet" /
Is it even possible?
Yes. The thing to do is build up the site using only the default theme throughout and be sure to be able to browse the site seamlessly. Make the style sheet as simple as possible to achieve the most basic of goals. Every page will load the same CSS.
When you begin to section off parts of the site, each section can be given its own custom style sheet to either override the main styles that would be affected, and/or include additional style rules that will only apply to that section.
link rel="stylesheet" href="sitewide.css"
link rel="stylesheet" href="custom.css"
i’m afraid i still don’t understand. In your solution it seems you’re proposing that i link two different css files: href="sitewide.css" and href="custom.css".
i have only one css file, let’s call it sitewide.css and i want my two or more html files access it, differentiating some elements of html with id attribute where necessary.
Every page should have enough common elements to render them from a mains style sheet. There is no rule that says ALL styles should be in the same file. Hardly. The main file should apply to the entire site, every page, and be supported by a template on the server if it’s a dynamic site.
Features and sections can have their own CSS file to overlay the site styled page.
link rel="stylesheet" href="sitewide.css"
link rel="stylesheet" href="thispage.css"
In other words, don’t use the main style sheet to do custom styles. Let the custom style sheet override the main styles where needs be. No different IDs, the same id, with the same selector in the custom sheet. That will take precedence since it is lower in the cascade (loaded later).
so i need multiple style sheets, a main one and several little ones for specific html sub pages. fine.
not the solution i was hoping for, namely one single style sheet for all html sub pages, but since no ID needed, because the “lower” style sheet overrides the “higher”, i guess it’s still straightforward enough. I’ll do that when i get a chance, thanks again.
Say you have a site wide header image, but on certain pages you want a different background. Simply use the same selector rule in the custom style sheet.
That absolute URL is starting at the root of your current volume. We can see the Psalms directory, so maybe peel back the URL…
./Psalms/images/...
Which link should load first, Psalm_1.css or Psalm.css?
Aside
Web resources, file names, image names, folder names should be written in lowercase, as is the convention. Capitalization only adds to the potential for errors.
i guess issue is something else, because the secondary html (psalms.html) won’t open any css at all, i tried with secondary css (psalms.css) only and still nothing.
peelong back to Psalms nade all ny styles dissapear, but pealing back all the way to images worked as previously (i’m talking about the main html, the secondary wouldn’t work in any configuration).