html/css no background image - html

Having problems getting my background image to appear tried a couple of different things and nothing seems to be working.

Probably you should try inline css like this:
<html>
<head>
</head>
<body style="background-image:url(image.png)">
Something inside
</body>
</html>

If you don't wanna use inline style css just let the body out of style tags, It will looks like this :
<html>
<head>
<style>
body {
background-image:url(image.png);
}
</style>
</head>
<body>
<form>
</form>
</body>
</html>
Sorry for my bad english. I'm Indonesian

Firstly, Please don't post screenshots of the code, and secondly WHERE style tag going? every thing looks messy out there. And check if the image is in the same directory (means folder) as the HTML file itself and use something like `body {background-image:url('2d_image.jpeg'). And write your code neatly!

Related

Title of the window appears in the body when use display: inline; in the universal * selector [duplicate]

<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<link rel="stylesheet" href="main.css" />
</head>
<body>
</body>
</html>
When I run this code, I see 'My Page' in my Browser's Title Bar and in Body too!
Why am I getting this?
Because <head> and <title> are just tags, like anything else. And the * selector picks them up too.
For kicks, take a look at this fiddle, which clearly demonstrates when you give head and title a display:block style, they indeed show up as text on the page:
HTML
<body>
<p>hi</p>
</body>
CSS
head, title {display:block}
Output
- jsFiddle demo
hi
For a bit more fun, we can color things too. And we even learn something about the inner workings of JSFiddle in the process. It looks like they inline your style in a <style> tag inside the <head>. Ha!
No. It doesn't and wouldn't output such a result. Have you tried refreshing/clearing the cache of your browser?

how to use the codes of a css document inline in html document

I wanted to create a contact-us page with HTML(no CSS document is allowed to use), then I found what I wanted but the code is written in 2 documents, HTML code is written in HTML document and the styles are in the CSS document. I'm looking for a way to use the CSS codes inline in the HTML document. Could you help me, please?
<html>
<head>
<style>
p {
color: green
}
</style>
</head>
<body>
<p>All your custom CSS can go in the head section of the HTML</p>
</body>
</html>
You will want to use a style tag like this: <style> </style> and inside will go the CSS.
It's good practice to keep your CSS in a seperate file to make the code look cleaner

Why does innerHTML behaves differently when it has <html> as a content?

Can anyone tell me why special here?
<html>
<head>
<script src="editor.js"></script>
</head>
<body>
<div id="scripts" class="scripts">
Editor.Execute('<html>Html String</html>');
Editor.Execute('<something>Html String</something>');
</div>
</body>
</html>
document.getElementById("scripts").innerHTML shows something however html dissapears.
Execute('Html String');
Execute('<something>Html String</something>');
It behaves the same way in Firefox and Chrome.
You're running into this issue.
Basically, the browser sanitizes out the HTML tags before your JavaScript can even access the page – you can check in the Chrome elements inspector, your <html> tag is not there.
I guess the answer depends on what exactly you're trying to do, but if you're just trying to output that code onto a web page, you can just escape the characters:
<html>
<body>
<div id="scripts" class="scripts">
Execute('<html>Html String</html>');
Execute('<something>Html String</something>');
</div>
</body>
</html>
Then document.getElementById('scripts').innerHTML will output:
Execute('<html>Html String</html>');
Execute('<something>Html String</something>');
And then you can replace the HTML entities in JavaScript.
Without knowing what you do in that Execute() it is hard to say what is going on there.
Just in case: HTML document can have one and only one <html> node.

Why am I seeing the 'title' in Web-page's body (Not only in Title Bar)?

<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<link rel="stylesheet" href="main.css" />
</head>
<body>
</body>
</html>
When I run this code, I see 'My Page' in my Browser's Title Bar and in Body too!
Why am I getting this?
Because <head> and <title> are just tags, like anything else. And the * selector picks them up too.
For kicks, take a look at this fiddle, which clearly demonstrates when you give head and title a display:block style, they indeed show up as text on the page:
HTML
<body>
<p>hi</p>
</body>
CSS
head, title {display:block}
Output
- jsFiddle demo
hi
For a bit more fun, we can color things too. And we even learn something about the inner workings of JSFiddle in the process. It looks like they inline your style in a <style> tag inside the <head>. Ha!
No. It doesn't and wouldn't output such a result. Have you tried refreshing/clearing the cache of your browser?

rare bug, cant do same width div with css and html, is it my computer?

im currently makeing some form
you can see at http://jsfiddle.net/AnMSa/
it is working fine
but when i run it on my localhost.. it turns like
ive countered this bug till yesterday, and now its time to me to look for help.
heres the html if anybody wants to download it http://www.mediafire.com/?vzi7kjgcdzldh48
please tell me everything that can reproduce this kinda bug.
The html file isn't valid html. it doesn't include the html or body tags or the doctype.
It works fine if you add your content in the following:
<!doctype html>
<html>
<body>
<!-- add content here -->
</body>
</html>
Or you can use the html5 boilerplate code from http://html5boilerplate.com/
You have to determinate your Doctype.
<!DOCTYPE html>
<html>
<head>
<style>
</style>
</head>
<body>
<!--- content -->
</body>
</html>
Do it and it will be fixed. You see it ok onjsfiddle because they have already defined the Doctype.