Jump to content

Body styling won't work from external file

Recommended Posts

My site opens a html window containing a long series of divs with text. It uses a separate css file, all of which works except for the body styling. If I put the same styling (via cut & paste) into the html for the window, it works fine. The html and the css files are in the same folder.

There's no reason I can't add those few lines of css to the html in the ~30 windows that use it, but I'm curious why it won't work the other way. Here's the code:

body {

You can view the css file (including the body styling) here. As I said, everything else in the css file works correctly, so the file is obviously being loaded and read. Is there a secret about body styling I don't know?

Link to post
Share on other sites

1. Okay. I didn't know that. I don't think I had any.

2. The body css has all the same parent tags as the others, but it's the only one that doesn't work. Is that true even in a css file?

I'm missing the point of your first response. There is no body styling from the separate css file. There is from the html file.

Edited by Jay@TastefulTitles.com
Link to post
Share on other sites
2 hours ago, dsonesuk said:

Wait! Now there is.

Apparently removing the <style></style> tags from the css file allowed it to work. I don't know why the first declaration (body) was the only one hindered, but now it seems to work fine. A newbie mistake, I'm sure, but you might keep it in mind for the next one who asks.

Thanks for your input.

Link to post
Share on other sites

The max-width does not have a unit specified, also a bigger security problem is I can see a list of your folders and files if i remove slides.css from link, a quick fix is to add a blank index.html file in each folder other than the root/parent folder as it already has one which is your home page.

Link to post
Share on other sites

I thought I had fixed the missing px, but hadn't. Thanks for pointing it out.

I have not heard of the security problem before, nor the simple fix. Thanks! Would you be interested in explaining how that helps? What could some miscreant do with my folders list, and how does the empty index.html prevent that?

Edited by Jay@TastefulTitles.com
Link to post
Share on other sites

It prevents no good doers easy access to list of your files and possible vulnerabilities.

The server is set by default on going to any directory folder and finding index.* or default.* (htm, html, php, asp, aspx etc) files on opening them first, so if a file has these extensions and it has nothing in them, all they see is a blank page.



Edited by dsonesuk
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...