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> >
<a href="#">Page</a> >
<a href="#">Page</a> >
<a href="#">Page</a> >
<a href="#">Page</a> >
<a href="#">Page</a> >
<a href="#">Page</a> >
<a href="#">Page</a> >
<a href="#">Page</a> >
<a href="#">Page</a> >
<a href="#">Parent</a> >
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) */
}
精彩评论