html-validation

Does a <tr> have to be inside a <tbody>

送分小仙女□ 提交于 2019-12-01 00:39:40
问题 Does a table row ( <tr> ) have to be in a table body ( <tbody> ), if the table has a table body, or can it exist outside of the table body? <table> <tr> <td colspan='2'>...</td> </tr> <tbody> <tr> <td>...</td> <td>...</td> </tr> </tbody> <tr> <td colspan='2'>...</td> </tr> <tbody> <tr> <td>...</td> <td>...</td> </tr> </tbody> </table> 回答1: No, the <tr> can be in the <thead> , <tbody> , <tfoot> or it doesn't have to be in any of them. 回答2: Contrary to what Terrill Thomson said, a table with

w3c validator gives 'document type does not allow element “input” here…' error

风流意气都作罢 提交于 2019-11-30 19:30:41
I got this error when validating my page with w3c's validator. Source: <form action="form.php" method="post"> <input type="text"/> </form> Can someone show me why I may have gotten this error? Thanks in advance! This answer applies to XHTML, not HTML5. The form and body element only accept block level children <form action="/"> <input type="submit"> </form> … will produce the error: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag. In Strict variants of (X)HTML, a form element

How to find the unclosed div tag [closed]

女生的网名这么多〃 提交于 2019-11-28 17:44:44
A unclosed div problem almost make me crazy. It is very difficult to track especially when the page is long and complex. Any suggestions? As stated already, running your code through the W3C Validator is great but if your page is complex, you still may not know exactly where to find the open div. I like using tabs to indent my code. It keeps it visually organized so that these issues are easier to find, children, siblings, parents, etc... they'll appear more obvious. EDIT: Also, I'll use a few HTML comments to mark closing tags in the complex areas. I keep these to a minimum for neatness.

How to validate HTML from Java?

巧了我就是萌 提交于 2019-11-28 11:02:00
What is a fast and simple way to validate HTML from Java? I’m looking for an open-source/PD class (or set of classes) that describes the various properties of the 100-odd HTML tags, such as: Is the tag optional? Empty? Is it legal to omit its closing tag? Which other tags can this tag contain (if any)? Which attributes are legal for this tag, and what are their types? (not required, but nice to have) Thanks! EDIT I'm looking to do to a tag-by-tag analysis of an HTML document, so I'm less interested in whether the document as a whole is valid, but rather what the specific requirements are for

What's a valid HTML5 document?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 22:43:21
I've just been reading the HTML5 author spec. It states that the <html> , <head> and <body> tags are optional . Does that mean that you can leave them out completely and still have a valid HTML5 document? If I'm interpreting this correctly, it means this should be completely valid: <!DOCTYPE html> <p>Hello!</p> Is this correct? You can check out the spec here: http://dev.w3.org/html5/spec-author-view/syntax.html#syntax "8.1.2.4 Optional tags" is the bit out about it being OK to omit <html> , <head> and <body> This is the minimal HTML5-valid document: <!doctype html><title> </title> The title

How to Call a JS function using OnClick event

ぃ、小莉子 提交于 2019-11-27 18:29:16
I am trying to call my JS function that I added in the header. Please find below code that shows my problem scenario. Note: I don't have access to the body in my application. Everytime I click on the element with id="Save" it only calls f1() but not fun() . How can I make it call even my fun() ? Please help. <!DOCTYPE html> <html> <head> <script> document.getElementById("Save").onclick = function fun() { alert("hello"); //validation code to see State field is mandatory. } function f1() { alert("f1 called"); //form validation that recalls the page showing with supplied inputs. } </script> <

How to find the unclosed div tag [closed]

允我心安 提交于 2019-11-27 10:41:56
问题 A unclosed div problem almost make me crazy. It is very difficult to track especially when the page is long and complex. Any suggestions? 回答1: As stated already, running your code through the W3C Validator is great but if your page is complex, you still may not know exactly where to find the open div. I like using tabs to indent my code. It keeps it visually organized so that these issues are easier to find, children, siblings, parents, etc... they'll appear more obvious. EDIT: Also, I'll use

w3c html validation error - Section lacks heading. Consider using h2-h6 elements to add identifying headings to all sections

给你一囗甜甜゛ 提交于 2019-11-27 04:44:45
I am getting a warning when I try to validate my page in http://validator.w3.org : Section lacks heading. Consider using h2-h6 elements to add identifying headings to all sections. My code is as below : <section id="slider-wrapper-new"> <div class="slider-container-new"> // some code.. </div> </section> How can I remove this error ? Do I compulsory need to add h1 - h6 tags inside section heading ? Either: Add a heading ( h1 , ..., h6 ) tag to your section element. Replace your section element with a div element. Ignore the warning. The message you're seeing is a non-normative usage

How to validate HTML from Java?

你离开我真会死。 提交于 2019-11-27 03:54:48
问题 What is a fast and simple way to validate HTML from Java? I’m looking for an open-source/PD class (or set of classes) that describes the various properties of the 100-odd HTML tags, such as: Is the tag optional? Empty? Is it legal to omit its closing tag? Which other tags can this tag contain (if any)? Which attributes are legal for this tag, and what are their types? (not required, but nice to have) Thanks! EDIT I'm looking to do to a tag-by-tag analysis of an HTML document, so I'm less

Using sprites with IMG tag?

早过忘川 提交于 2019-11-27 03:29:24
I understand how to use sprites, however, isn't a "src" attribute required for IMG tags? I could always use a SPAN or other tag and set the background/width/etc but it won't be semantically correct. Basically, I'd like to omit the SRC for an IMG tag and use just sprites, but am concerned about the HTML not being technically valid because of it. Thanks. About semantical correctness: When an image has semantical meaning, so it is considered to be content, use an IMG tag , without sprites, and a correctly set up ALT. When an image is just decoration, like the background of a box, background of a