How to use the HTML5 Boilerplate ir class with inline elements?

喜你入骨 提交于 2019-12-08 09:15:45

The text-indent: -9999px method has some drawbacks. The main are:

  • does not work in IE6 and IE7 on inline-block elements.
  • 1st gen. iPads have proven to have performance issues with this technique, with page rendering slowing down quite a bit.
  • Even if we don't see it, any browser in any device has to draw a huge div (more than 9999px) that overflows the screen. This is bad for performance as it adds page load time and requires more memory resources.

The .ir technique in HTML5 Boilerplate has proven much more performant and reliable. You're doing the right thing.

Having said that, I'm not 100% sure of what you're trying to achieve in your code. I have restructered the html a bit in this fiddle.

As you can see I have put red borders to understand where exactly elements are and how much space they take up. Every image/text is now in its own <li> which is semantically logic (one link/one list item), like so:

 <ul>
     <li>facebook<li>
     <li>twitter</li>
     <li>example page</li>
 <ul>

I've also removed the float:left to the nav as you need to float the elements inside it, not the container itself. Hope this clears it up a bit and helps you get to where you want. I'm ready to edit this answer if any improvement is needed or if I have misunderstood what you're trying to achieve.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!