I'm just trying to post a simple html file consisting mainly of some prose I wrote inside of <pre> elements.
Interestingly, when I view the file on my computer with my browser, the quotation marks display fine. But when I upload it to my website, quotation marks are rendered as something like “ or â€. I have looked around the web for solutions but they were few and in between.
I tried to use the meta tag and included
<meta http-equiv="Content-Type" content="text/html; charset="utf-8" />
to my header but to no avail. Any ideas on how to solve this? It just wouldn't make sense to go back to the content inside the elements and code it into html as the prose is a draft and will go through many changes in the future.
The <!doctype html> tag indicates the file is HTML5 - so the browser will render it as such. lang="en" should be set to the language you are working with. Be sure to use the <meta charset="utf-8"> tag to set the character set in the <head>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Template</title>
</head>
<body>
<pre>This is my stuff</pre>
</body>
</html>
Check your code with the browser's View Source and use the Validator at https://validator.w3.org/ to check the page.
Here what I tried.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<pre>Einstein said,"Once you stop learning, you start dying"</pre>
</body>
</html>
I also tried only this
<body>
<pre>Einstein said,"Once you stop learning, you start dying"</pre>
</body>
Still working
Related
Can anyone explain the difference between the different html options show in the vscode screenshot below? When to use each one. Thanks!
For me, html and html:xml only generate the opening and closing html tags.
html generates <html></html>
html:xml generates <html xmlns="http://www.w3.org/1999/xhtml"></html>
But html:5 generates a basic boilerplate for any html5 compatible html file. It contains some basic stuff like, doctype, head, body, title tags etc.
html: create only <html></html> tag
html:5 : create a basic html 5 template as below
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
</html>
html:xml : Usually a <!DOCTYPE> declaration is used to distinguish between versions of HTMLish languages (in this case, HTML or XHTML). More detail about it
I have linked my HTML code here. Why is it that when I open this file (locally) on my computer, some special characters will not show. For example, imagine I wrote this code: nwqidn wqindiwq dwqin <wiqndiw
When opened, the browser will not display the last line of gibberish (anything after and including the less-than symbol). I understand that the browser might have some confusion about when to end the tag, but surely the google browser is advanced enough to know the difference between the closing p tag and a random "<" symbol. I know that I can use the Unicode for "<" and it will display, but I'm trying to find a different solution. Is there any special something that I can put (maybe as metadata?) in my HTML file in order to solve this issue? Thanks in advance for any help.
Here's my entire code of the page below:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8">
<title>Test</title>
</head>
<body>
<p> dniqwn qwnid wqudn <inwqd </p>
</body>
You can use < for 'less than' and > for 'greater than' to insert < and > into html.
Otherwise, as you say, the browser will think you're opening a tag.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8">
<title>Test</title>
</head>
<body>
<p> dniqwn qwnid wqudn <inwqd </p>
</body>
I'm trying to include a link in my page that will link directly to google search results (as opposed to linking to a predetermined search, as in this question).
I tried this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
click me
</body>
</html>
The ampersand gets mangled, the url comes out as http://www.google.com%26q%3Dsports instead of http://www.google.com&q=sports.
What's the right way to do this?
I think this is format if you want to return results in the correct manner:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
click me
</body>
</html>
But here is the good resource and a duplicate to this question if that's the case - Do I encode ampersands in <a href...>?
I uploaded my website and one of the tab(more info) is in chinese for some reason and I dont know why. here is the the url http://bushdid911.net
http://pastebin.com/jFBUV1ga
At very least, you should add
<meta charset="utf-8">
to the html's <head> section.
A (very, very) basic html template you should use is
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Page title</title>
</head>
<body>
</body>
</html>
Another reason could be that Bush did this, too. Just to create another conspiracy theory..
I want to display a special caracter but when i used <h2></h2> this caracter does not appear on the web-site page.
<h2>Aéroport Tunis Carthage </h2>
on the web-site the text is: Arport Tunis Carthage.
<h2>Aéroport Tunis Carthage</h2> will do it.
Handy info on encoding can be found here and info on html character entities here.
There are two ways for displaying special characters in HTML:
1) Using HTML entities. For example:
Aéroport
2) Encoding the source HTML file appropriately (e.g. using UTF-8) and then indicating such encoding in the HTML head:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h2>Aéroport Tunis Carthage </h2>
</body>
</html>
Of course, you have to use a text editor capable of writing files in the desired encoding. Otherwise you should indicate in the <head> the encoding used by the editor.
Try adding this to your meta tags:
HTML4:
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
HTML5:
<meta charset="UTF-8">
Source:
http://www.w3schools.com/tags/att_meta_http_equiv.asp
EXAMPLE:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta Tag -->
<meta charset="UTF-8"> <!-- HTML5 -->
<title> Your title here </title>
</head>