Forum Moderators: not2easy
I've ended up with a reasonable "Up Shadow" - but not what I had in mind.
body{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 2em;
color: #009;
background : #fff;
padding : 10px;
position:relative;
}
#toptext{
color: #ccc;
background: transparent;
}
#shadow{
position : relative;
left: .05em;
top : -1.1em;
background: transparent;
z-index: 2; /*changing this to a neg. value "drop shadow" it does not display in NN7 or Moz*/
}
<div id="toptext">Shadow Text</div>
<div id="shadow">Shadow Text</div>
Is there something I have missed or am I approaching this from the wrong angle?
Spook
From the W3C - Text Shadows [w3.org]
Text shadow effects can be achieved in CSS1 using negative margins and duplicated text. The results can be visually stunning, but have unfortunate side-effects for non-visual readers and people using browsers that don't support style sheets.
More information...
By adjusting what you've got, I've created the drop shadow effect by having the second line of text being on top like this:
<div>Top text</div>
<div style="color:red; position:relative; top:-1.2em; left:-.05em">Top text</div>
By adjusting the offsets carefully, you can have the shadow go in any direction.
If anybody had a CSS2 compliant voice reader, you could add 'volume: silent' to the shadow.
I had considered the potential spamming issues [possibly doubling-up on key text etc.] but I can't immagine you would want to use it too many times on a page. However I have little or no experience at all with screen readers so hadn't considered that issue.
I dare say I'm not alone in my ignorance so, if I were to add 'volume: silent' to the shadow, does this solve the problem completely or are there millions of CSS1 compliant voice readers out there?
Thanks
Spook
This works well for me for a "drop shadow" (based on your example):
body {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 2em;
color: black;
background: #ffffff;
padding: 10px;
position: relative;
}
#toptext {
color: gray;
background: transparent;
}
#shadow {
position: relative;
left: -0.02em;
top : -1.28em;
background: transparent;
z-index: 2;
} <div id="toptext">Shadow Text</div>
<div id="shadow">Shadow Text</div> --------
This* is also kind of cool when clicked (text 'pressed' effect) or when the text is selected (try selecting the line; once you mouse button up, the 'top' layer will be displayed again making for a 'shadowed selection').
#shadow:active {
display: none;
} * NN only
--------
Overall, nice effect. :)
Ps. Note that your "shadow" text is actually my "top" text and vise versa.
Shelumi`El
Jordan
S.D.G
Works well indeed! Playing with colours gives some nice effects too.
I decided not to use the drop shadow effect because of pageoneresults comments above. Seems a shame, but I'm still a little ignorant about voice readers so consigned this effect to my "library" for future use.
Spook.