Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomeLatest imagesRegisterLog in

 

 *Actual* HTML

Go down 
2 posters
AuthorMessage
MrEinStain
Banne
avatar


Posts : 2
Rep : 0
Join date : 2012-02-13

*Actual* HTML Empty
PostSubject: *Actual* HTML   *Actual* HTML EmptySat Feb 18, 2012 3:33 am

I’ve been reading this section recently and I noticed just how flawed some of the topics are, especially about HTML.

It’s really hard for me as a developer to see people instructing others incorrectly, so I’m going to post a few corrections.

Let’s start.

Simple HTML by Desu
Code:
<html>
<head>
<title>Desu</title>
</head>
<body>
<body bgcolor="#000000"> </body>
</body>
</html>
WRONG! There are two body tags which isn’t correct. Imagine your head having two noses and four nostrils!
Furthermore, background colour can and SHOULD be done via CSS.
And there, mistakes don’t end! EVERY HTML page should have a doctype. Old browsers, such as older versions of Internet Explorer, will otherwise not display the page correctly. And it has to have a doctype to be valid HTML. We’ll use HTML 4.1 Strict as an example.

So the correct way to have this code would be something like this:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>*Page title*</title>
<style type="text/css">body { background-color:#000000; color:#FFFFFF }</style>
</head>
<body>Page contents</body>
</html>
Note that I also added color:#FFFFFF; to the CSS because black (default colour) text wouldn’t be visible on black background.

Anyone Know Html (reply by Apocalypse)
Code:
<html>
<head>
<title>YOUR TITLE HERE</title>
HEADER HERE
</head>
<body>
BODY OF PAGE HERE
</body>
</html>
Again, the HEADER HERE is incorrect. The head tag should contain links to CSS (link rel), CSS (style), title, META tags etc. Body should contain everything that’s visible to a regular viewer, for example:
Code:
<!DOCTYPE html>
<html>
<head>
<title>YOUR TITLE HERE</title>
<meta robots="noindex,nofollow" />
<link rel="stylesheet" type="text/css" href="/style.css" />
<link rel="icon" type="image/png" href="/favicon.png" />
</head>
<body><table><tr><td><a href="/"><img src="/header.jpg" /></a></td></tr>
<tr><td><a href="/">Index</a> | <a href="/memberlist">Memberlist</a></td></tr>
<tr><td>BODY OF PAGE HERE</td></tr></table>
</body></html>
Please note that TABLES should not be used for styling the page, but I did it anyway to make it easier to understand and because we don’t know what’s defined in the CSS and what isn’t.
Again, a DOCTYPE is required. I used the HTML5 doctype here, however HTML5 is still experimental, so it isn’t recommended to use it.

And last but not least:
{HTML} Font size by Desu
Quote :
Set the size of your font with size. The range of accepted values is from 1(smallest) to 7(largest).The default size of a font is 3.

Code:
<p>
<font size="5">Here is a size 5 font</font>
</p>

  1. The range of accepted values is from 1 (smallest) to 7 (largest). - Really? By default, if no type of measurement is specified, the unit is em. You can also specify % (percentage) OR pixels (px).
  2. Code:
    <font size="5">...</font>
    The font tag has been deprecated for as long as I remember. Here is an old article I found on WWWC: Forget font, use CSS.

The correct way of specifying font size would be:
Code:
<p style="font-size:15px">15 pixels</p>
<p style="font-size:150%">150% of the default size</p>
<p style="font-size:10em">10 em</p>
<p style="font-size:12pt">12 pt</p>
OR via the style tag:
Code:
<!DOCTYPE html>
<html><head><title>...</title><style type="text/css">p { font-size:10px; }</style></head>
<body><p>10 pixels</p></body></html>

If any of you have any questions , feel free to leave them as a reply Smile

~MrEinStain,
independent web designer and PHP developer

Edit: I have also taken the privilege to add black background to the post via the CSS in the Administrator panel. The text was hard to read because of the background image. Wink
Back to top Go down
Apocalypse
Administrator
Administrator
Apocalypse


Posts : 306
Rep : 10
Join date : 2010-09-30
Age : 29
Location : Indio CA

*Actual* HTML Empty
PostSubject: Re: *Actual* HTML   *Actual* HTML EmptyMon Feb 20, 2012 1:18 pm

Smart Cookie! haha, thx for the legitimate info bro! ;D
Back to top Go down
https://apocalypseforums.darkbb.com
 
*Actual* HTML
Back to top 
Page 1 of 1
 Similar topics
-
» Anyone Know Html
» Simple HTML
» {HTML} Font size

Permissions in this forum:You cannot reply to topics in this forum
 :: Technology and Software :: Programming-
Jump to:  
Make a forum | ©phpBB | Free forum support | Report an abuse | Forumotion.com