html - CSS relative element obstructs float -
code:
<style> div { width: 500px; } ul { list-style-type: none; line-height: 1.25em; } ul > li { position: relative; } ul > li:before { content: "\2022"; position: absolute; font-weight: bold; font-size: 30px; line-height: inherit; left: -0.75em; } </style> <div> <span style="float:right"><a href="http://google.com">test link</a><br/> <a href="http://google.com">test link</a><br/> <a href="http://google.com">test link</a><br/> <a href="http://google.com">test link</a><br/> <a href="http://google.com">test link</a></span> <ul> <li>the <a href="http://google.com">glowing steel</a> extremely hot , harm touches it. jumping slag bucket instant death, regardless of [[damage threshold]].</li> <li>the ''"lucky 38 executive override"'' option on terminal on second level supposed part of quest [[the moon comes on tower]], section cut. see quest's notes section details.</li> <li>the 3 mr. steels found inside, fiends, respawn every 3 game days.</li> </ul> </div>
in above example links inaccessible. intended css behavior? there proper fixes?
so far came few inferior solutions:
- make float elements
position:relative
,z-index:1
: obviously not general solution. overflow:hidden
onul
element: links accessible, list elements stop wrapping around float.overflow:hidden
onli
element: links accessible, list elements wrapping around float.:before
content becomes invisible.z-index: -1
onli
elements: links in floats become accessible in exchange of links in list becoming inaccessible.
and, after further thought ended on giving :link
elements position:relative
, z-index:1
. not ideal obviously, guess it's 1 least drawbacks far.
can wrap links in div , set wrapper style:
.link-wrapper{ position:relative; z-index:9; }
like in fiddle.
update
another possible solution might set z-index
of <li>
's below 0. this:
ul > li { position: relative; z-index:-1; }
here fiddle.
update 2
here possible solution involves setting negative margin , using transform :before
content. bit hacky might work in situtation.
add these styles:
ul > li:before { display:inline-block; margin-left:-20px; margin-right:10px; transform:translatey(5px); }
and remove style:
ul > li { position:relative; }
here fiddle.
Comments
Post a Comment