View Single Post
  #5 (permalink)  
Old 08-28-2008, 02:09 AM
Jonathan N. Little
Guest
 
Posts: n/a
Diggs:
Default Re: position of text on image

Roderik wrote:
> Hi,
>
> I guess I am missing something. I tried to put a caption on my photo (on
> the bottom) but the caption appears to be a bit higher and overshooting
> the area of the image with a few pix.
>
> You can see it on:
> http://www.roderik.net/caption.php
>
>
> Any idea btw. whether some standard JS framework provides a function for
> slide in caption as you can see on the images of:
> http://www.guardian.co.uk/
>
>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-language" content="en-us">
<title>Test</title>

<style type="text/css">
.richimage {
margin: 0; padding: 0;
position: relative; background: #ff0;
--
.richimage img {
/* else img inline and will have descender space */
display: block;
--
.richimage p {
position: absolute;
margin: 0; padding: 7px;
left: 0; bottom: 0;
color: #fff; background: #000;
opacity:0.7;
--

.richimage img.normal { display: inline; --


</style>

<script type="text/javascript">
</script>

</head>
<body>
<h2>An example on image captions with css image as block</h2>
<div class="richimage">
<img alt="photo"
src="http://www.roderik.net/lib/img/latest/chaekith-brighton-shore.jpg">
<p>Some text on the image</p>
</div>

<h2>If image is inline you get a space for descenders</h2>
<div class="richimage">
<img class="normal" alt="photo"
src="http://www.roderik.net/lib/img/latest/chaekith-brighton-shore.jpg">
<p>Some text on the image</p>
</div>
</body>
</html>



--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Reply With Quote