World class data recovery software and renowned raid recovery services

WestNIC provides reliable web hosting services

Ahosting.biz reseller hosting, managed dedicated server with 24/7 support

Site navigation below

This FAQ is part of the Code Style Help and FAQ section. Use the help request form below if your question is not answered here, but make sure you are asking the right question first.

Subscribe to this FAQ: RSS news feed

FAQ search

HTML and email

Q: How do I create a form to email in XHTML?

A: There is nothing specifically in XHTML that can generate email messages from form content. Markup only specifies how the form will be structured, the fields it has and what to do when it is submitted. You will need a server side script to format the submission as email and send it via an email server.

Premium Content: Follow this link for subscription information More details available to subscribers:
How do I create a form to email in XHTML?

Q: What are the guidelines for HTML formatted email?

A: The first (un-helpful) response is that email is a plain text medium and sending other MIME types is bound to be a problem for some users. One of the great advantages of email is that it is lightweight and usually takes a fraction of a second to download. If you include surplus HTML markup and perhaps image references you will significantly impair the user experience and turn subscribers away from your service, either by deleting the mail without reading or un-subscribing.

Premium Content: Follow this link for subscription information More details available to subscribers:
What are the guidelines for HTML formatted email?

HTML & XHTML questions

Q: How do I automatically refresh a page?

A: The simplest way to refresh a page on a regular basis is to use an HTML meta element like this:

<meta http-equiv="Refresh"
  content="10; URL=http://yoursite.example/Refresher.html" />
          

This suggests the page is reloaded after 10 seconds and is supported by most current browsers.

Q: Can I create my own DOCTYPE in XHTML?

A: The short answer is yes, you can adapt the XHTML DTD to create your own document structures. This works best where you are enforcing more strict rules on your documents, like making the width and height attributes of images compulsory for instance.

Premium Content: Follow this link for subscription information More details available to subscribers:
Can I create my own DOCTYPE in XHTML?

Q: How do I make an absolute file URL?

A: Web browsers are mainly used for accessing Internet URLs, so there is not a common standard for referring to documents on the local file system. Try opening files with a number of target Web browsers and check for variations in the reference scheme in the address bar.

Premium Content: Follow this link for subscription information More details available to subscribers:
How do I make an absolute file URL?

Q: How can I make CSS font-size the same as HTML <font>?

A: There are a number of issues in your question, but the key point is that there is no necessary correspondence between HTML font sizes and the CSS font-size property. Yes, these mechanisms affect fonts in a similar way, but any size match will be dependent on the browser and default font settings any user has. This will have to be a process of trial, error and approximation.

Premium Content: Follow this link for subscription information More details available to subscribers:
How can I make CSS font-size the same as HTML <font>?

Q: What is &nbsp; used for?

A: The HTML code &nbsp; is known as an entity. In effect it is a special symbol that represents a non-breaking space. HTML text may be displayed in a Web browser window at almost any width. The individual lines of text will "turn" or make a new lines according to the width of the window and the width of the HTML container elements they are displayed in. Web browsers normally use spaces between words as appropriate points to break lines, but this re-flow of text may split important phrases or pairs of words over two lines. The &nbsp; entity is used as a sort of "sticky" space between words; the non-breaking space is displayed as a space but Web browsers should not turn lines at these points.

Be careful not to use non-breaking spaces in place of regular spaces in an extended segment of text, the text may break out of the HTML container element and corrupt the page layout.

Markup techniques

Q: How do I insert an image in HTML?

A: To display an image in your HTML document, use the img element, which has a number of attributes to configure the image display.

<img
    src="./Example.jpg"
    width="200"
    height="150"
    alt="Example image">
      

The src attribute is for the name of the image file. In this example the image is named Example.jpg and is located in the same directory as your HTML document.

The width and height attributes specify the dimensions of your image in pixels, which helps Web browsers to render the image on screen. Finally, the alt attribute is for a description of the image content to display in case users have switched off image display, so they understand what they are missing.

Q: How do I make a "skip navigation" link?

A: All you need is a link before the navigation markup that you style display: none; with CSS. This example also includes an accesskey attribute.

Premium Content: Follow this link for subscription information More details available to subscribers:
How do I make a "skip navigation" link?

Q: How do I stop my navigation links from opening in a new window?

A: It sounds like you have target attributes on your links. When you have a target attribute on a link with a window name that does not exist, most browsers open the link in a new window.

Premium Content: Follow this link for subscription information More details available to subscribers:
How do I stop my navigation links from opening in a new window?

Q: How can I add a tool tip to a select element?

A: The title attribute is one of the core attributes in HTML and can be used on select elements and all other form inputs. In many graphical browsers the title attribute is displayed as a tool tip when the user hovers over the element.

Premium Content: Follow this link for subscription information More details available to subscribers:
How can I add a tool tip to a select element?

Q: How do I link to five separate tables on the same page?

A: To target different parts of a hyperlinked document, you must place so-called "fragment" anchors in the parts you want to jump to. In the first document, use hash characters in the hyperlink URL to signify the target fragment anchor...

Premium Content: Follow this link for subscription information More details available to subscribers:
How do I link to five separate tables on the same page?

Proprietary markup problems

Q: My marquee element doesn't show in Firefox or Opera!

A: The marquee element is proprietary markup that is only supported by Internet Explorer, it is not a standard HTML element and not supported by Mozilla Firefox, Opera or other standards compliant Web browsers. There are several other standards conformant ways to achieve a similar effect; you can use Javascript Document Object Model (DOM) scripting to dynamically update the text of a standard HTML element, use a Java applet or Flash movie.

See the Document Object Model FAQ for an example implementation of a text marquee using standards compliant markup and Javascript.

Validation with NSGMLS

Q: NSGMLS reports "numbers exceeding 65535 not supported"!

A: This error message indicates a known limitation of NSGMLS, that it cannot handle Unicode characters greater than 65535. That means there is a huge range of characters it does cover, known as the Basic Multilingual Plane (BMP). This first plane of Unicode characters includes almost all modern languages.

Help request

Use the form below to submit a help request or general enquiry about the Code Style Web site. Before you write read the guidelines on asking the right questions, and check this page for periodic updates.

Information: Your email address will not be mis-used. If you include your address you may be sent a personal reply, you will not be added to any mailing list unless you request it. Read the site privacy statement for details.

Style warning - please read

Home · CSS · Java · Javascript · HTML · Help · Log