Questions tagged [xhtml]

XHTML is the traditional name for what is now formally called the XML syntax of HTML, as opposed to the more commonly used HTML syntax, both of which are defined by the HTML5 standard. It is a markup language commonly used for HTML pages which are generated using a XML based tool chain. Do NOT use this tag for Facelets. Use [facelets] instead.

XHTML (eXtensible HyperText Markup Language) is an application of XML and a syntax of HTML. This syntax is available as an alternative to the more common HTML syntax, which was formerly based on SGML. It is a markup language commonly used for HTML pages which are used within an XML based tool as part of server-side specific (MVC) framework, such as Facelets and ASP.NET Web Forms.

Initially, XHTML 1.0 and XHTML 1.1 were defined in separate specifications from HTML 4.01, but now the HTML5 specification covers both syntaxes together.

The XML syntax has an orthogonal rule set which takes no account of the element types being used, whereas the HTML syntax has different rules for different types of elements. For example, void elements in HTML such as <link>, <meta>, <br> and <hr> are marked up using only start tags in the HTML syntax, while <div>, <span>, <a> etc. must always have separate start and end tags. Other tags, for example <p>, <li> <td> etc. have special rules about when start and end tags need to be used. In contrast, in the XHTML syntax all elements must be closed, either using separate start and end tags: e.g. <div> and </div> or, if they have no content, by using a shortened form e.g. <div /> The two syntaxes are mutually incompatible, and XML tools do not work directly on documents written in the HTML syntax.

XHTML was introduced to allow developers to exploit the simplification that this orthogonality brings.

XHTML is often used as the basis for server-side markup languages, so that the can be manipulated by XML-based tools. The final output of these tool chain might be generated documents in the regular HTML syntax or in the XHTML syntax prior to sending to the browser.

One common confusion with XHTML is over the use of doctypes and content types. Using one of the XHTML 1 doctypes (now all obsolete) caused HTML validators to check whether document were consistent with the XHTML syntax, while browsers treated the same documents as being in the regular HTML syntax. Browsers do not use the doctype to determine which syntax the document is in. Instead they use an HTTP header: content-type. An XHTML syntax document must be supplied to the browser with an XML content type, usually application/xhtml+xml or application/xml. Regular HTML syntax documents should be supplied with a content type of text/html. Modern validators now, like browsers, use the content type HTTP header to determine which syntax to check against, and for both syntaxes the doctype in the form <!DOCTYPE html> should be used.

The XML syntax of HTML requires the following which are optional in the regular HTML syntax:

  1. Root XML namespace attribute as in <html xmlns="http://www.w3.org/1999/xhtml">
  2. Elements must be nested. e.g. <b><i></b></i> is an error that will cause parsing to stop
  3. Start and end Tags must always be matched, or elements self-closed. (e.g. use <input></input> or <input /> but not <input>)
  4. Tag and attribute names must be all in lowercase (e.g. use 'onclick, notonClick`)
  5. Attribute values must be quoted with matching single or double quotes (e.g use class='foo', or class="foo", not class=foo)
  6. Attribute minimization is forbidden (e.g. use disabled="disabled" or disabled="", not disabled)

Resources:

6730 questions
2
votes
6 answers

z-index order for draggable div

I want to create draggable a media player (blue box in my example) in my website and I need to put media player in front of all divs. How can i do this? My page template is like that: You can try it: http://jsfiddle.net/krMhY/ …
ogun
  • 1,314
  • 2
  • 16
  • 40
2
votes
0 answers

menuitem issue on migration Primefaces 6.2 to Primefaces 8.0

I'm involved in a migration of a Java Web Application from Primefaces 6.2 to Primefaces 8.0. After resolving all issues as per official migration guides the application works properly except for the behavior on a p:menubutton component. It regards a…
mulivieri
  • 21
  • 3
2
votes
1 answer

opera mini - problem with loading page

I'm developing xhtml page for wap applications and have a problem with the first page load in Opera Mini. Not the entire page content is displayed correctly the first time on screen, a lot of graphics elements are absent. But right after the page…
Alex
  • 21
  • 1
  • 2
2
votes
0 answers

Losing MathML when converting from HTML to Docx using LibreOffice

I am using LibreOffice to convert a .docx file to an XHTML file. Mathematics is converted to MathML. My plan is to use LibreOffice in headless mode (or tools based on it) to convert back the XHTML file to a Docx file but after this conversion…
Opusci
  • 21
  • 2
2
votes
4 answers

Emded XHTML snippet in XML document, and validate against a schema

Essentially I want to embed some XHTML in an XML document that must validate against a custom schema. Full background: I have a webservice that consumes an XML document. This XML document is validated against a custom schema. The data in the XML is…
handles
  • 7,639
  • 17
  • 63
  • 85
2
votes
1 answer

margin-top isn't calculated as expected

I try to center a div on my page. It should use just relative values, so its size depends just on the window size. I found a solution and it centers the box, but it seems that the margin isn't calculated correctly. Instead the size of the body gets…
Scolytus
  • 16,338
  • 6
  • 46
  • 69
2
votes
1 answer

Setting up a fake admin login

After having my Paypal account compromised I got a bit paranoid and wanted to secure everything in my sites. One of them includes renaming the admin/ page to something else, then I will put something like a honeypot to see which IP's they are coming…
Banana
  • 23
  • 3
2
votes
1 answer

Extending HTML5 video element with XSLT

I've created some markup/css and JavaScript for a custom UI to be used with the HTML5
2
votes
3 answers

Menu style "...." - fill in with periods

I have been trying to find the best way to create the "....." effect like in a dinner menu: http://cl.ly/0g263j04322m3F140D40 Not sure if it has to be done with just adding in the periods myself or if there is a way to have jQuery or CSS3 to fill it…
user39980
2
votes
1 answer

Chart.js Stacked Group Bar model after updating version Chart.js 2.9.4 -> Chart.js 3.5.0

I use Primefaces together with Chart.js in the last update they migrated from Chart.js 2.9.4 to Chart.js 3.5.0 And with that, the graphic model that I used was not configured, see the 2 small videos of the before and after. See how my chart was and…
Jarciano
  • 53
  • 8
2
votes
2 answers

Resizing pictures automatically in css

I have built a small blog/webpage using CSS and HTML, but I seem to have a small problem. I insert images using CSS, and when doing so, I use the following: #blogpic { background-image: url(bpic.png); display: block; background-repeat:…
AJW
  • 5,569
  • 10
  • 44
  • 57
2
votes
1 answer

Hpricot search all the tags under one specific namespace

For example I have the following code: <io:content part="title" />
arkxu
  • 31
  • 2
2
votes
1 answer

how to generate different div id inside ui:repeat for javascript code

I have one ui:repeat component and inside that ui:repeat there is one div which is using in my javascript code. I have to dynamically change this div id on each ui:repeat call. how can i make it possible? Please find the below code for your…
Anandha
  • 47
  • 10
2
votes
1 answer

How to best use JSF2 resources from Javascript

Using resources in JSF2 is a great thing because you can store the resource at some location and then reference them using different alternatives in HTML or in JSF2. I use the resources like this in XHTML pages:
2
votes
2 answers

Autosizing departure board using Html, CSS and JQuery

I've got to develop an auto scaling arrivals and departures board at work. It's started out easily enough with me creating a table with percentage based column widths (and the overall table being 100% width). For now, I've got a small piece of…
Simon
  • 984
  • 1
  • 8
  • 24
1 2 3
99
100