My company is building a website and we had some problems with a JavaScript library not replacing something. We decided to throw our HTML in to the W3C validator and it info
If you're using a form, you could change the button to be a clickable div instead. For example:
<div role="button" onclick="$(this).closest('form').submit()">
<!-- your child content here -->
</div>
Alternatively, if you know the form name or ID you could change the inline javascript to something like document.getElementById("form-id").submit()
If you want to use a custom button, you'll have to replace the button tag with a div or an input. It looks like a div is what you want in this case. You'll just have to add any necessary event handlers, (for your submit).
This might help clarify things a bit.
Well I posted a comment but no love.
You can achieve a W3C valid button by simply putting an image inside the button.
Granted you'll have to create your images and add the text to them. But since you've already created images for the corners that shouldn't be too hard.
Also image sprites are a great thing.
.test {
width: 258px;
height: 48px;
background: none;
border: 1px solid transparent;
}
.test:active {
outline: 0;
}
.test > img {
width: 258px;
height: 45px;
opacity: 1;
background: url('http://www.copygirlonline.com/wp-content/plugins/maxblogpress-subscribers-magnet/lib/include/popup1/images/btn/blue-button.png');
background-position: -3px 0px;
}
.test > img:hover {
background-position: -3px -50px;
}
<button class="test">
<img src="http://alistapart.com/d/cssdropshadows/img/shadowAlpha.png" />
</button>
If you want to stick with 3 images here's an updated version.
button {
margin: 0;
padding: 0;
border: none;
}
<button>
<img src="http://placehold.it/50x50" /><img src="http://placehold.it/50x50" /><img src="http://placehold.it/50x50" />
</button>
Also, without additional CSS, it seems you need to keep all of the <img />
tags on the same line or it treats the images as having space between them.
Per the HTML standard a <button>
may only contain Phrasing content. A div
element is not a valid element for Phrasing Content.