When it comes to front-end web development, 'ivory towered idealism' is a particular bugbear of mine. While we should always endeavor try to do things 'the right way', pragmatism must always win out. Let me give you an example (the finished code is example_10-02). Suppose we have a button to style that opens an off-canvas menu. Our natural inclination might be to mark it up something like this:
<button class="menu-toggle js-activate-off-canvas-menu">
<span aria-label="site navigation">☰</span> menu
</button>Nice and simple. It's a button so we have used the button element. We have used two different HTML classes on the button, one will be a hook for CSS styling (menu-toggle), and the other as a JavaScript hook (js-activate-off-canvas-menu). In addition, we are using the aria-label attribute (ARIA is covered in more detail in Chapter 4, HTML5 for Responsive Web Designs) to communicate to screen readers the meaning of the character inside the span. In this example, we have used the HTML entity ☰ which is the Unicode character 'Trigram for Heaven'. It's used here merely because it looks like the 'Hamburger icon' often used to symbolize a menu.
If you'd like some solid advice on when and how to use the aria-label attribute I thoroughly recommend the following post on the Opera developer site by Heydon Pickering: https://dev.opera.com/articles/ux-accessibility-aria-label/
At this point, we seem to be in good shape. Semantic, highly accessible markup and classes to separate concerns. Great. Let's add some styling:
.menu-toggle {
appearance: none;
display: inline-flex;
padding: 0 10px;
font-size: 17px;
align-items: center;
justify-content: center;
border-radius: 8px;
border: 1px solid #ebebeb;
min-height: 44px;
text-decoration: none;
color: #777;
}
[aria-label="site navigation"] {
margin-right: 1ch;
font-size: 24px;
}Open this up in Firefox and this is what we see:

Not exactly what we were hoping for. In this case, the browser has decided we've gone too far; Firefox simply won't allow us to use a button element as a Flex container. This is a very real conflict for a developer. Do we choose the right element or the right aesthetic? Given that ideally, we would like to have the menu 'hamburger icon' on the left and the word 'menu' on the right.
You can see in the prior code we have used the appearance property. It's used to remove the browsers default styling for form elements, and has had a potted history. It was specified by the W3C for some time and then later dropped, leaving behind vendor-prefixed versions of the property in both Mozilla and WebKit browsers. Thankfully, it's now back on the standards track: http://dev.w3.org/csswg/css-ui-4/#appearance-switching
I won't lie. Given this conundrum, I usually opt for the latter. Then I try and make up for the fact I'll be using the wrong element by choosing the next best element and changing the ARIA role where possible. In this case, while our menu button is certainly not a link (after all, it doesn't take the user anywhere), it's an a tag that I will be using. I've decided it's the next best thing—more like a button than any other element. And by using a link we can achieve the desired aesthetic. Here's the markup I'd go with. Note the added ARIA role on the a tag to indicate its role as a button (and not a link which is the default) to assistive technology:
<a class="menu-toggle js-activate-off-canvas-menu" role="button">
<span aria-label="site navigation">☰</span> menu
</a>It's not perfect but it's a pragmatic solution. Here's the two (button element on the left, a tag on the right) next to each other in Firefox (version 39.0a2 if you're curious):

Of course, for this simplistic example, we could change the display from flex to block and play around with the padding until our desired aesthetic was achieved. Or, we could keep the button element and nest another semantically meaningless element (span) and make that a Flex container. There are trade-offs whichever approach you favor.
Ultimately, it's up to us to markup documents as sensibly as possible. At one end of the scale, there are developers that only markup with divs and spans to ensure no unwanted styles from the browser. The cost being no inherent meaning from their elements and in turn, no 'free' accessibility. At the other end of the scale are markup purists, who will only ever markup content in what they consider to be the correct element, regardless of how 'off' the visuals might end up as a result. There is a middle ground. I feel that's the sensible and most productive place to be.