If I don't put in the <div> tag, I end up with objects sitting on the left side of the window. And, why do I have to enter both the align parameter and the class? The class has its margins set to auto. Is someone trying to give me more work?
If you want your .center class to work, you need to make sure that the div in question has a width other than "auto": "auto" means it will take up all available horizontal space, and the left edge of the div will be on the left edge of the page.
Because the rule form label applies to label elements, which are inline, while only block elements can have margins.
Originally Posted by timstring
Code:
form label {
text-align:center;
This applies to content inside the label, not ouside it. And the same goes when you set it on the div, since this style is inherited: text inside elements will be centered within the element and takes no regard to the space around the actual element.
The input element has to go inside the label element. At least I don't believe HTML 5 still supports the for attribute with matching id attribute, but even if it does, you'd still need to either put the input inside the label element, or give the input an id attribute and then give the label a for attribute with the same value.
Also, I believe that HTML5 still requires you to use only block level elements as descendants of forms. I.e., you labels, inputs etc all have to be wrapped in some other block element than the form element, such as fieldset, p etc.
Thus, the simplest valid code would probably be
I also took the liberty of changing <img /> to <img>, thus going from XHTML to HTML. Feel free to use whichever you like more, but I recommend HTML since document.write() is not available in XHTML documents, and a lot of ads and other content are still being delivered using document.write.
Also, the advantages of using XHTML vs HTML 4.01 are gone. Their used to be no parsing rules for HTML, just the DTD. Since there are now instead consistent parsing rules for every single element, your document will (well, according to the spec anyway) always be treated the same way. Thus, the only thing you get from XHTML is not allowing minimized attributes (selected="selected" rather than selected), requiring quotes around attributes (name="joe" rather than name=joe) and not allowing you to ditch end tags (<p>paragraph</p><p>new paragraph</p> rather than <p>paragraph<p>new paragraph). But there's still nothing preventing you from following those guide lines while using HTML 5 since it's still perfectly valid HTML code as well.
Alright. Pardon my ignorance, but how do I get the evil Dreamweaver to convert the xhtml to ordinary to an ordinary html file? I hope its not a bloody mess! My code may not be pretty, but it is working.
Now, I've got a proper code. But there is a border around the outline of the form. I've been all over my style sheet and the only border I have is in the style for "FormButton" Here's a pic if it works:
Conventional rendering for <fieldset> elements is to give them a border, since it is typically used to group related form elements. Needless to say, styling can be applied to remove the border.
I find tools like Firebug are great for diagnosing issues like this, as they allow you to highlight parts of your page, element by element and see the styles applied to them, both CSS files/inline styles and the default styles applied by the browser
Bookmarks