Background for my website
#1

So I believe there is no more background tag in HTML? I now need to use CSS. How do I do that? I need to make a .css file as well or what?
Reply
#2

Yes, you do still have to make the css file.
Reply
#3

Huh?
http://www.quackit.com/html/codes/ht...mage_codes.cfm

also
Код:
<body background="URL of image">
Reply
#4

Quote:
Originally Posted by Mr.Anonymous
Посмотреть сообщение
Huh?
http://www.quackit.com/html/codes/ht...mage_codes.cfm

also
Код:
<body background="URL of image">
The funny thing is, you posted a link to a site that says this underneath the codeblock you are quoting:
Quote:

This is the old way of specifying a background image in HTML, and is now deprecated (outdated and not recommended) by the W3C. Instead of using this method, you should use the CSS method as described above.

Reply
#5

Quote:
Originally Posted by Ash.
Посмотреть сообщение
The funny thing is, you posted a link to a site that says this underneath the codeblock you are quoting:
iBlind.
Reply
#6

You can still use a css block in the head tags, as well as inline css. Having a separate css file might be tidier, though.

Код HTML:
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <style type="text/css">
            body {
                background-image:url(path/to/image.jpg);
            }
        </style>
    </head>
    <body>
        <!-- stuff -->
    </body>
</html>
Reply
#7

Quote:
Originally Posted by Mr.Anonymous
Посмотреть сообщение
Huh?
http://www.quackit.com/html/codes/ht...mage_codes.cfm

also
Код:
<body background="URL of image">
This doesn't validate and as far as I know it's unsupported by HTML5. Just do what Vince said.

You have to use css for many things in html5, such as centering, alignment, etc.
Reply
#8

Thanks, what exactly do I do to have it in a separate CSS file?
Reply
#9

Quote:
Originally Posted by Coltmaster
Посмотреть сообщение
Thanks, what exactly do I do to have it in a separate CSS file?
CSS can be and doesn't have to be in a seperate file. See what Vince did - you can put css inside style tags in the header of an HTML document.

Let me explain it with comments:
Код HTML:
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <!--BEGIN CSS, STYLE TAGS MEAN CSS!-->
        <style type="text/css"> 
            /*YOUR CSS GOES HERE!*/
            body {
                background-image: url(path);
            }
        </style> 
        <!--END CSS-->
    </head>
    <body>
        <!--Your shit goes here-->
    </body>
</html>
Reply
#10

Quote:
Originally Posted by Coltmaster
Посмотреть сообщение
Thanks, what exactly do I do to have it in a separate CSS file?
Everything between the <style> tags can be added to a css file. Plain. Nothing else needed. To use it, you would use this between the <head> tags:
Код HTML:
<link rel="stylesheet" type="text/css" href="mystyle.css">
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)