Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS positioning

Status
Not open for further replies.

Bebe56

MIS
Jan 21, 2006
16
US
I was wondering if there is a way to show the span to the left (or right) of the “more” link using css only (no javascript) … in other words, to have the span position related to <a href..> Here’s what I’m talking about:

<html><head>
<title>Show More</title>

<style>
body {text-align:center;}
#wrapper {width:75%;margin:0 auto;text-align:left;}
a.smore {text-decoration:none;font-size:.80em;}
a.smore span{display:none;}
a.smore:hover{background:#556B2F;color:#fff;}
a.smore:hover span {
position:absolute;
right:20em;
width:50%;
max-width:50%;
// margin:0 auto;
display:block;
z-index:100;
padding:7px 9px;
background-color:#f0f0f0;
border:1px solid #cecece;
color:#00008b;
-moz-border-radius:6px;opacity:0.95;cursor:pointer;
}
</style>
</head>
<body>

<div id="wrapper">
<hr>
<div>Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis..
<a href="#" class="smore" onclick="return false;">more...<span>...aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et
harumd und lookum dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda.</span></a>
test, test, test.
</div>
bla bla bla bla
<hr>
</div><!-- wrapper ends here //-->

<div style="text-align:left;">Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis...
<a href="#" class="smore" onclick="return false;">more &#187;<span>...aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque
civiuda.</span></a>
test, test, test.
</div>

</body></html>


Thanks a bunch!
 
It is. Use [tt]auto[/tt] for [tt]left[/tt] and [tt]top[/tt] (or omit them) and use margins to position it wherever you want it relative to the link. I have used this technique successfully before.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top