I have an html tree which is mostly consisting of nested unordered lists.
I need to create a full width hover effect for each leaf, something similar with windows fi
I've had the same problem as you, after some trying and testing I came up with this. It allows you to add scrollbars and put the padding on the inner .
HTML
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit
CSS
.tree {
position:relative;
display: block;
overflow: auto;
border: 1px solid #8B9097;
background-color: #fff;
margin-left:200px;
/*! margin-left: just for testing */
}
.tree > div {
display:block;
position:absolute;
min-width:100%;
}
.tree * {
white-space: nowrap;
}
.tree ul {
margin:0;
list-style-type: none;
padding-left: 20px;
}
.tree li > div {
position:relative;
margin-left:-100000px;
padding-left:100000px;
border: 1px solid transparent;
display:block;
}
.tree li div:hover {
background-color: #B6BABF;
color: #fff;
}
.tree li.collapsed > ul {
display:none;
}
.tree li.expanded > ul {
display:inherit;
}
http://jsfiddle.net/WknDZ/17/