1
   

Html/PHP Code Element Questions

 
 
B-truE
 
Reply Wed 16 Feb, 2005 02:24 am
Hi,

Is it necessary to put the following code at the top of HTML/PHP web pages (code)?

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">


Also, I see that some people use the following in method for the break tag:

Code:
<br /> rather than <br>


What is the difference?

And, one final question...

What is the following code for?

Code:
<div style="clear: both;"> </div>


I've noticed when I do use the above code in the bottom of my php (CSS formatted) pages, the columns don't stay sized properly...

You help with these issues is much appreciated.

Thank you.

B-truE
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 1,383 • Replies: 3
No top replies

 
Craven de Kere
 
  1  
Reply Wed 16 Feb, 2005 03:30 am
Re: Html/PHP Code Element Questions
B-truE wrote:
Hi,

Is it necessary to put the following code at the top of HTML/PHP web pages (code)?

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">




No, it is not necessary but it is useful to declare a doctype.

Doctypes tell the browser what kind of markup the page is written in, and influence how the browsers parse the markup.

For example, you posted the doctype for xhtml strict, meaning that it will likely need to be valid xhtml code to display properly.

IE, for example, will render that page in strict standard compliant xhtml mode, whereas if you use a transitional doctype it might render it in quirks mode (generally more forgiving for the webmaster who isn't freaky about writing perfect code).

Quote:
Also, I see that some people use the following in method for the break tag:

Code:
<br /> rather than <br>


What is the difference?


Code:<br />


is xhtml

Code:<br>


is html




Quote:
And, one final question...

What is the following code for?

Code:
<div style="clear: both;"> </div>


The css "clear" property disallows floats on the side specified. In your example it's disallowing floating elements on both sides but the purpose of the div is not clear. It's just empty.
0 Replies
 
B-truE
 
  1  
Reply Wed 16 Feb, 2005 11:57 am
Re: Html/PHP Code Element Questions
Craven de Kere wrote:

The css "clear" property disallows floats on the side specified. In your example it's disallowing floating elements on both sides but the purpose of the div is not clear. It's just empty.


I think the code shows a space or something, because it didn't show up in the example. Here's another go at it:


Code:<div style="clear: both;">& #160;</div>


I put a space between the & and the # (above) to get the code to show here.

B-truE
0 Replies
 
Jer
 
  1  
Reply Wed 16 Feb, 2005 12:05 pm
The answers to all of your questions can be found here:

W3Schools
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » Html/PHP Code Element Questions
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/24/2024 at 06:25:58