We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
  • 2
WEB PAGE CODE HELP
Topic Started: Jan 12 2005, 01:12 PM (1,264 Views)
Ben
Member Avatar
Quantum-locked when observed.

You can put comment tags just inside the beginning and end of your style block so that older browsers will ignore it, but this causes validation errors. If you're using an external stylesheet, the best method is to use the @import way of calling the stylesheet.

Code:
 
<style type="text/css">
@import "somefile.css";
</style>


If you want to embed actual comments about your CSS, use the same comment tags as Ali mentioned you use for JavaScript. :yes:
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
Bluhd Relahyted, in this topic you have been just plain rude. Do not bump topics unless 24 hours have past. Be patient.
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
hmm...
i think you guys shouldn't be bothering him with .css and js.
he hardly knows html, so just learning that would be a lot easier.

html code for backgroundcolor
(somebody already gave it, but he seems to be ignored)


<html>
<head>
<title>site name</title>
</head>
<BODY BGCOLOR="#FFFFFF">
text and stuff
</body>
</html>


#FFFFFF=white
colorcharts are not really hard to find.



EDIT:
forgot </head> :$
Offline Profile Quote Post Goto Top
 
FearKiller
Member Avatar
www.drewscripts.com
[ *  *  *  *  * ]
Quote:
 
Huh? :huh: What are you on about? Browsers that don't support CSS will just ignore the rules. You're thinking JS. This is CSS. Putting comment tags in the middle of your CSS will break things.

I believe the CSS still works with the comment tags in place, although I only tested them in the current versions of IE, Firefox, and Netscape, the CSS is rendered successfully and that was the way I was taught to use internal CSS. There have been cases where really old browsers that do not support CSS have rendered the page wrong because of the CSS. When the browser reaches the style tag it is clueless, but when it moves on to see the comment tags it'll recognize those and comment out the CSS.

Quote:
 
you can put commment like this
Code:
 
</style><!--Comment here--><style type='text/css'>

or f you want it to show up on page like this
Code:
 
</style><body>ELRocco wuz here</body><style type='text/css'>

Why would you want to break out of the style tag and display something before the CSS is actually finished? :huh: Why not use the CSS comment tags
Code:
 
/* This line of text goes between my style tags and it gets commented out so I can say what ever I want lalalalalalala */


Quote:
 
You can put comment tags just inside the beginning and end of your style block so that older browsers will ignore it, but this causes validation errors.

A little test page with internal css using my method.
http://www.fearkiller.net/test/internal.html
The validation results for that page.
http://validator.w3.org/check?uri=http%3A%...2Finternal.html
Validation errors?

Quote:
 
hmm...
i think you guys shouldn't be bothering him with .css and js.
he hardly knows html, so just learning that would be a lot easier.

html code for backgroundcolor
(somebody already gave it, but he seems to be ignored)


<html>
<head>
<title>site name</title>
</head>
<BODY BGCOLOR="#FFFFFF">
text and stuff
</body>
</html>


#FFFFFF=white
colorcharts are not really hard to find.



EDIT:
forgot </head>  :$

You also forgot the doctype and the character encoding. CSS isn't hard to learn and should be learned along with HTML. HTML alone doesn't give you as much freedom as if it was used with CSS.
Offline Profile Quote Post Goto Top
 
Ben
Member Avatar
Quantum-locked when observed.

Oops . . . I was talking about external stylesheets when I said validation errors. I learned that one the hard way :D

For those who are just learning, I'm a little lenient when it comes to the use of HTML or CSS, but yes CSS is the preferred way to manipulate your background colours. If you teach both at the same time rather than one after the other, the transistion can probably be easier . . . :yes:
Offline Profile Quote Post Goto Top
 
Wartorious
Member
[ * ]
Hi man, go read a "basic HTML Guide for N00bs". It will tell you all you need to know, Just look for HTML Help on Google.com :)

also look up web Templates, because otherwise the page won't look good enoth for visitors without you having any knowledge of HTML. ;)

Good luck man :lol:
Offline Profile Quote Post Goto Top
 
FearKiller
Member Avatar
www.drewscripts.com
[ *  *  *  *  * ]
Wartorious
January 16, 2005 06:15 AM
Hi man, go read a "basic HTML Guide for N00bs". It will tell you all you need to know, Just look for HTML Help on Google.com :)

also look up web Templates, because otherwise the page won't look good enoth for visitors without you having any knowledge of HTML. ;)

Good luck man :lol:

He/she doesn't have to search google as I have already given an online tutorial on the first page that not only teaches HTML, but teaches it in the proper way that it should be used.
Offline Profile Quote Post Goto Top
 
The Legendary Sam
Feck j00, mate!
[ *  *  * ]
He needs web page advice >.>

If you want to make background color in the simplest way, you can do it without hex colors.

EX:
Code:
 

<HTML>
<HEAD>
<TITLE>Color</TITLE>
</HEAD>
<BODY BGCOLOR=RED>
<FONT COLOR=BLUE>Insert Text here</FONT COLOR>
</BODY>
</HTML>


That would be the simplest way, but you can aslo do this:

Code:
 

<BODY>
<BODY BGCOLOR = "color">
</BODY>


You can put the body background in a separate tag, and let the </body> tag close them both, or (the simplest way) just put body in the same bracket. You can also do combinations.

Code:
 
<BODY TOPMARGIN=70 BG COLOR=RED>
</BODY>


You can fit as much as you can and allow the </body> tag to close it all. I just made the webpage have a 70 pixle top margin and the background a simple red color. Don't forget, if you want more complex colors, you can use hex.

Hex has 6 numbers: ######, they represent: RRGGBB. Red, Green, and Blue, which are the REAL Primary Colors. You can go from 00 to FF. FF represents 255 which is a widely used hex number. Why would it be hex if it is odd? Because the number is actually 256, however, we are counting 00 as a number in this case, but in other cases, where 00 is not applicable, we need all 256. FFF would be 65535, but that's not important ;)

If you want images as your background you can do this:

Code:
 
<BODY BACKGROUND IMG="url of background image.">
</BODY>


You can (once again) put it in the same, or different tag. But to cover over more browsers, it's best to get as raw as possible, because some concepts haven't been invented during older browsers. I use HTML 4.0, but that's not important ;)
If you want an image to fix itself into the background, meaning it will stay in the background even if the person scrolls down, then you put this:

Code:
 

<BODY BACKGROUND IMG="url of background image." BG PROPERTIES=FIXED>
</BODY>


TaDaa! There you go.

And of course there's the linking image to site thing which was already explained.

Code:
 

<A HREF="link"><IMG SRC="image"></A>


Instead of putting text as the trigger, we put a link code inside the A brackets. There's also a somewhat complicated A Name trick that can bring you to the same page, but on a different line, but I won't get into that.

I explained in detail the codes you wanted, and even niched around them a little, I hope this will help you make your web page.
Offline Profile Quote Post Goto Top
 
FearKiller
Member Avatar
www.drewscripts.com
[ *  *  *  *  * ]
Quote:
 
He needs web page advice >.>

Thats what we gave him >.>

You gave the old-fashioned way of using HTML. I gave the standards compliant way of using (X)HTML

Code:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html>
<head>
<title>My Web Site That You Will Go To Every Day</title>
<meta http-equiv="content-type" content="application/xml; charset=ISO-8859-1" />

<style type="text/css">
<!--
body {
color: #0000FF;
background-color: #FF0000;
text-align: center;
text-decoration: none;
font-size: 12pt;
}

.main {
width: 100%;
margin: auto;
text-align: left;
}
-->
</style>
</head>

<body>
<div class="main">
My page content goes here YAY!!!
</div>
</body>
</html>

is much better than...

Code:
 
<HTML>
<HEAD>
<TITLE>Color</TITLE>
</HEAD>
<BODY BGCOLOR=RED>
<FONT COLOR=BLUE>Insert Text here</FONT COLOR>
</BODY>
</HTML>

Your code does not specify a doctype or a character encoding which are two very important and required attributes in order to validate your page. You also used HTML rather than CSS to style the page. CSS can give you alot more freedom than HTML ever could.

Quote:
 
That would be the simplest way, but you can aslo do this:
Code:
 
<BODY>
<BODY BGCOLOR = "color">
</BODY>

Why would you use two body tags? That is not correct HTML.

Quote:
 
You can put the body background in a separate tag, and let the </body> tag close them both, or (the simplest way) just put body in the same bracket. You can also do combinations.
Code:
 
<BODY TOPMARGIN=70 BG COLOR=RED>
</BODY>

Topmargin only works properly in IE and "BG COLOR" does not work it's "bgcolor" Besides, there are much better ways of doing this with CSS.

Quote:
 
Hex has 6 numbers: ######, they represent: RRBBGG. Red, Blue, and Green, which are the REAL Primary Colors.

It actually goes RRGGBB because #FF0000 represents a red, #00FF00 represents a green, and #0000FF represents a blue.

Quote:
 
If you want images as your background you can do this:
Code:
 
<BODY BACKGROUND IMG="url of background image." BG PROPERTIES=FIXED>
</BODY>

This code is also incorrect there is no "BACKGROUND IMG" it's just "background" and yet again I recommend CSS to do this.
Code:
 
body {
background-image: url(marble.gif);
background-attachment: fixed;
}


I definetly should make an HTML tutorial :D
Offline Profile Quote Post Goto Top
 
The Legendary Sam
Feck j00, mate!
[ *  *  * ]
He said he doesn't want CSS help ;)
I don't know xHTML ;)
I did not use two body tags, the points is that I could get that done only using one ;)
Old fashioned? Yes. Simple and gets the job done? Yes.
Offline Profile Quote Post Goto Top
 
purge.exe
Member
[ *  *  *  * ]
The Legendary Sam
January 17, 2005 12:46 PM
He said he doesn't want CSS help ;)
I don't know xHTML ;)
I did not use two body tags, the points is that I could get that done only using one ;)
Old fashioned? Yes. Simple and gets the job done? Yes.

Maybe not in the future :ph34r:

It's good to have your document in pre-xhtml format. When the time comes to convert it to xHTML (if ever), it will be much easier to do.

I like xHTML,
purge.exe
Offline Profile Quote Post Goto Top
 
FearKiller
Member Avatar
www.drewscripts.com
[ *  *  *  *  * ]
Quote:
 
He said he doesn't want CSS help ;)

If he doesn't want to use CSS then he can expect the freedom of styling and positioning his pages will be very limited.

Quote:
 
I did not use two body tags, the points is that I could get that done only using one ;)

Quote:
 
<BODY>
<BODY BGCOLOR = "color">
</BODY>
:huh:

Quote:
 
Old fashioned? Yes. Simple and gets the job done? Yes.

Parses slower than xhtml? Yes. Will most likely be obsolete in the near future so you'll have to update your page anyway? Yes. Is invalid code? Yes. ;)
Offline Profile Quote Post Goto Top
 
korn_mosher_4life-ZNS
the korn mosher 4life
[ *  *  *  * ]
FearKiller
January 17, 2005 12:21 PM
Your code does not specify a doctype or a character encoding which are two very important and required attributes in order to validate your page.


You don't have to have the doctype stuff in there. it's not in the syntax rules that you must so there for you dont need it. Also with the css, you would save your self alot of time if you just linked to a css file (just like a JS file) so if you need to change your background color or whatever you don't have to go to everypage and change it (so if you were UNT and have 8,000 web pages just simple change the hex code in one place.


Quote:
 
I definetly should make an HTML tutorial  :D


Please save us and your self the time and don't. :yawn:
Offline Profile Quote Post Goto Top
 
FearKiller
Member Avatar
www.drewscripts.com
[ *  *  *  *  * ]
Quote:
 
You don't have to have the doctype stuff in there. it's not in the syntax rules that you must so there for you dont need it. Also with the css, you would save your self alot of time if you just linked to a css file (just like a JS file) so if you need to change your background color or whatever you don't have to go to everypage and change it (so if you were UNT and have 8,000 web pages just simple change the hex code in one place.

Ok genius lets see you make a valid page without a doctype. If your page doesn't have a doctype, it will fall back and render your page as HTML 4.01 (not a good idea if your using XHTML 1.1.) I am also aware of the fact that you can link to an external style sheet as I explained on page one of this topic. <_<
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply
  • Pages:
  • 1
  • 2