SA-MP Forums Archive
Background for my website - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: Background for my website (/showthread.php?tid=431982)



Background for my website - Coltmaster - 20.04.2013

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?


Re: Background for my website - iMTube™ - 20.04.2013

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


Re: Background for my website - Mr.Anonymous - 20.04.2013

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

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



Re: Background for my website - Ash. - 20.04.2013

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.




Re: Background for my website - Mr.Anonymous - 20.04.2013

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.


Re: Background for my website - Vince - 20.04.2013

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>



Re: Background for my website - Mean - 20.04.2013

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.


Re: Background for my website - Coltmaster - 20.04.2013

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


Re: Background for my website - Mean - 20.04.2013

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>



Re: Background for my website - Vince - 20.04.2013

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">