- This topic is empty.
March 9, 2013 at 2:05 am #43261Krish1980Participant
And I found that
a) I cannot use a div inside an ‘a’ tag?! If that’s the case, I’d be restricted by a great deal. It tells me that I cannot use a block level element inside an ‘a’ tag(never mind that in many cases, whenever I wish to show a background for the link, I use display ‘block’.)
b) Normally, whenever I create a menu, I give a background to the ul, give it an auto height, and then use `
` before the ul ends(when the li’s are floated). Apparently, even that’s not allowed. ( I usually do this to avoid using a container div for the ul befotre which I’d use the clearboth class)
Are these fatal errors? Because they seem to display quite well on modern browsers.March 9, 2013 at 2:28 am #127570CrocoDillonParticipant
In html5 (a) is allowed. Can’t see what (b) is about.March 9, 2013 at 7:01 am #127588wolfcry911Participant
CrocoDillon is correct, a block level is allowed inside an anchor in html5, but I have a feeling you don’t even need it. You can make an element (like an anchor) display block and apply a background to it without failing validation. In other doctypes you probably want to use a span instead of a div.
Didn’t fully understand b), but I’m guessing you used some element inside the ul to clear the floating li – you can’t. li is the only child allowed in ul and ol. Why not use overflow: hidden or .clearfix on the ul (or simply give it a height) instead?March 9, 2013 at 7:03 am #127589Kitty GiraudelParticipant
> In html5 (a) is allowed. Can’t see what (b) is about.
Same here.March 9, 2013 at 7:12 am #127590MerriParticipant
Clearfixes you can or can’t use with a menu:
/* can’t use this – you won’t see the child dropdowns as they go outside UL! */
/* pseudo clearfix element */
width: 100%; /* give any width (to trigger hasLayout in older IEs, gives the same end result) */
I find it a bit odd people keep on writing their CSS-minded elements and attributes in HTML. I mean things like this:
Personally I rather just keep it all in CSS and not add extra stuff to HTML just because I need a clearfix.March 9, 2013 at 11:35 am #127601TheDocMember
I think everyone has hit the nail on the head here. I also think you should get that clearing line break out of there. It has no business being in your HTML!March 9, 2013 at 8:53 pm #127633__Participant
(b) is throwing an error because a `
` is not allowed as a direct child of a list. Lists can only hold `
- ` elements (or `
- ` elements, in the case of a definition list).March 9, 2013 at 10:42 pm #127639MerriParticipant
The meaning of…
> The meaning of… `` … is “the latest and greatest HTML”.
kinda. To the validator, it means to use HTML5 rules for validation.
To browsers, it means nothing more or less than any other doctype. That’s why it was chosen: all major browsers read as far as `` “working” inside of an `` won’t be a problem despite being “not allowed” in earlier versions of HTML – it *works* just fine in almost all cases (IE8+, AFAIK). That’s *why* HTML5 allows it.
- ` elements (or `
> Now, this may seem like a stupid question, but if I use the doctype for html 5 and start using html5 , will the pages be displayed properly on older browsers?(like say, IE8)
However if you ever use HTML5 elements like
article and such, you might want to use [html5shiv](http://code.google.com/p/html5shiv/).
- The forum ‘CSS’ is closed to new topics and replies.