Ok, so im trying to remake my website and i wanted to ask if this HTML syntax im using is proper.
The HTML code is something like this:
<a href="http://the_url.com" target="_blank">
<img src="..开发者_如何学Go/img/id.png" width="32" height="32" alt="id" />
<h4>Title</h4>
<p class="des">Description</p>
</a>
and for the CSS i mainly make the tag to display as block.
Is this proper coding or should i remake it a different way? You can see an example at http://varemenos.com
According to the HTML5 specification of the <a>
tag, this syntax is valid. It was not in former HTML versions.
If the construct suits its semantic meaning is still up to you and the actual content. If you use it for short snippets of text (esp. in the description), I think it's fine. If the content gets longer, you might want to think about splitting it up and moving the anchor a bit down the hierarchy to make it clearer to the users which parts of the page are actually link targets.
This website may interest you: W3 validator.
According to the validator, your website is HTML5 valid.
You are using block elements (h4
and p
) inside an inline element (a
). This isn't "proper".
This can be fixed by adding a CSS rule so that the a
has display:block
or display: inline-block
.
精彩评论