css working in one file but not the other - html

I have two html files using one css file. The one is working the other is not.
In the first 'working' case, the html syntax is (css file is in the same directory):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<title>Our first page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="ourstyle.css"></head>
In the second 'not working' case, the html syntax is (css file is in one folder up):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Our second page</title>
<link rel="stylesheet" type="text/css" href="../ourstyle.css"></head>
When running both files locally, the css file works, but on a server it does not.
I am using javascript and jquery in the second html file. I did what they suggested in the question on Two Linked CSS Files Not working but still did not work.
Please help.
PS This is my first question I am asking, so please let me know if I was not specific or clear enough. Thank you.
To clarify:
I don't have ourstyle.css in two separate directories in my local environment nor on a server. I have it only in the parent directory. So practically, I have the parent folder WWW, in which I have the 3 things:
1. the 'working' html script (with syntax 'href="ourstyle.css"')
2. the file ourstyle.css
3. the folder called cgi-bin, in which I have the 'not working' html script (with syntax 'href="../ourstyle.css"')
The same folder structure I have locally and it is running. On server it does not.
Thank you for your help.

Rather put ourstyles.css into a folder (like CSS) and then refer to them the same, i.e. /CSS/ourstyle.css (and not ../ourstyle and outstyle). Putting your scripts in js folders and styles in css folders is good practice. You will thank yourself later when you are working with lots of files.

Related

FB Thinks Meta Tags Are in Body

If you follow this links you will see that there is a paragraph-tag that should not be there in line 3
This is the actual code that "causes" this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
I do not get why there would be a paragraph-Tag cancelling the element and making FB believe that meta-tags are in the body instead... do you?
https://developers.facebook.com/tools/debug/
I used the Facebook Open Graph Debugger to solve the issue. On the very bottom there is a link called
Scraped URL See exactly what our scraper sees for your URL
This shows exactly what Facebook catches as code and there was a print of a paragraph-tag from one of the libraries I have been using. I can only recommend to debug it this way because I wasted a lot of time not doing so (because I did not see the link at the bottom of the page).

My doctype code is not showing up?

I have two doctypes above my <html> tag and I still don't see it in my page source. I tried just using one of them but they still dont work. Here is the site URL http://nonudot.io-web.com/demo.aspx and the doc types I'm using:
<!DOCTYPE HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Heres a link to a screenshot of the code http://nonudot.io-web.com/LCValleyADA/media/ProjectsContent/Capture.JPG
Thanks
Your screenshot doesn't look anything like the final output. Compare the following
with
Notice how the meta tag <meta http-equiv="pragma" content="no-cache" /> doesn't exist in the second screen grab (my screen grab from your posted site)? That's most likely because your not using the same page... I'm assuming that you might not be using the correct MASTERPAGE, or something has gone awry with your masterpages.
Your style sheets don't match up either.

How do you embed an .epub in a web page?

Is there a viewer or plugin of any kind that would allow an .epub document to be viewable on a web page? A Google search turned up tons of installable epub viewing desktop software but I couldn't seem to find anything for embedding this format on a web page. Perhaps you folks have some insight into this?
epub files are just HTML/XML and CSS, so you could easily open the epub container (it's a zip), then parse the XML inside using a language like PHP.
It shouldn't be too difficult to do that.
The format looks like:
--ZIP Container--
mimetype
META-INF/
container.xml
OPS/
book.opf
chapter1.xhtml
ch1-pic.png
css/
style.css
myfont.otf
Here's an example of the content you might find in chapter1:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title>Pride and Prejudice</title>
<link rel="stylesheet" href="css/main.css" type="text/css" />
</head>
<body>
...
</body>
</html>
I'd suggest that this should in most cases be done with Javascript using a library like one of these How to read epub files using javascript

Chrome and Nginx: strange things happen. Sometimes empty HTML page instead of PHP or static files

On server: nginx with php-fpm and static folder.
On client: Chrome with tab opened for a long time.
Sometimes empty HTML page is retrived instead of PHP or static file. Ajax and non-ajax queries are affected. I can see wrong answers in Network panel:
It's not completely blank page, it's well-formatted page with doctype and head:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> -->
<HTML>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="0.1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<TITLE></TITLE>
</HEAD>
<BODY><P></BODY>
</HTML>
One time it happened with js-file query, Chrome showed javascript syntax error.
What can it be?

Is it ok to remove the lines below in a HTML file?

Is it ok not to include such lines in a HTML file? Removing these lines makes the code look more clean.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
When I use dreamweaver to create a HTML file, these lines are automatically included.
No, you should NOT remove those lines.
You can, however, switch the <!doctype>-declaration to the one of HTML5, since that will still trigger standards mode in all current browsers, even though they don't yet implement HTML 5. It looks like the following:
<!DOCTYPE html>
Which is a bit more clean than the ordinary one you use looks like. You can also read a little more about the new doctype-declaration here. You can also learn more about what will change in HTML5 here.
No that is not allowed. It sets the character encoding, i.e. how the browser should read it.
But the new HTML5 elements make the whole thing look easier and cleaner. So:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
becomes --> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
lang="en"
xml:lang="en">
becomes --> <html lang="en">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
becomes --> <meta charset="UTF-8">
<link rel="stylesheet" href="style.css" type="text/css">
becomes --> <link rel="stylesheet" href="style.css">
So the whole code in the <head> becomes:
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
No, you shouldn't remove these lines. The first two lines tell the browser what type of document your page is, and helps the browser render it properly.
The third line tells the browser what character set you're using, in this case so that it knows to render non-latin characters properly.
Those declares the DOCTYPE, which shouldn't be forgotten to add.
Why?
Why specify a doctype? Because it
defines which version of (X)HTML your
document is actually using, and this
is a critical piece of information
needed by browsers or other tools
processing the document.
For example, specifying the doctype of
your document allows you to use tools
such as the Markup Validator to check
the syntax of your (X)HTML (and hence
discovers errors that may affect the
way your page is rendered by various
browsers). Such tools won't be able to
work if they do not know what kind of
document you are using.
But the most important thing is that
with most families of browsers, a
doctype declaration will make a lot of
guessing unnecessary, and will thus
trigger a "standard" parsing mode,
where the understanding (and, as a
result, the display) of the document
is not only faster, it is also
consistent and free of any bad
surprise that documents without
doctype will create.
You can remove the DOCTYPE, html tags and meta tags and still have valid HTML, and if you are happy for your page to take browser default styling they can be safely omitted. The content type and charset can be specified by the HTTP headers if you prefer. As others have already pointed out, the DOCTYPE will affect how styling instructions are interpreted, and also how HTML parsers interpret some invalid markup, so you will need to allow for this.