开发者

Create a breadcrumb that shrinks with window but obscures content to the left

I need to make a breadcrumb nav that could be quite long, that shrinks with the wi开发者_Python百科ndow for small screens but the links inside it disappear to the left ie the most recently visited pages are always the ones in view, percentage width in CSS not working so was thinking JQuery.


Simply use a combination of direction: rtl; and overflow: hidden;. For example, try this example code (demo).

HTML

<div id="breadcrumb">
  <a href="#">Home</a> &gt;
  <a href="#">Page</a> &gt; 
  <a href="#">Page</a> &gt; 
  <a href="#">Page</a> &gt; 
  <a href="#">Page</a> &gt; 
  <a href="#">Page</a> &gt; 
  <a href="#">Page</a> &gt; 
  <a href="#">Page</a> &gt; 
  <a href="#">Page</a> &gt; 
  <a href="#">Page</a> &gt; 
  <a href="#">Parent</a> &gt; 
  Current Page
</div>

CSS

#breadcrumb {
  overflow: hidden;
  direction: rtl;
  white-space: nowrap; /* keeps everything on one line */
  width: 50%; /* change this to whatever you want (for example, 300px) */
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜