/    Sign up×
Community /Pin to ProfileBookmark

Image Caption using CSS

Hi.

I’ve seen this used [B](see attachment)[/B] on websites everywhere and have tried everthing with CSS to make it happen (and i know it’s CSS [i think lol]), as i’ve looked at source codes from certain sites.

So was just wondering what i need to do with CSS in dreamweaver to do an image iwth a border and a caption. I know how to do a border and padding etc, but couldnt seem to be able to add a caption as part of it.

Hope you can help.

Ryan.

P.S- I use dreamweaver, so if any other stuff other than CSS is used, feel free to tell me how to do it in dreamweaver!?

[upl-file uuid=cc0bab41-6e0b-4794-87a2-d7280ab7acf2 size=3kB]caption-pic.gif[/upl-file]

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelAug 20.2007 — Here is a little thing I made a long time ago, -sort of like what you are showing:
<!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>

<title> New Document </title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<meta name="Generator" content="" />

<meta name="Author" content="" />

<meta name="Keywords" content="" />

<meta name="Description" content="" />

<style type="text/css">

* {margin:0; padding:0; border:0;} /* Re-sets IE to "zero" for these values */

body {min-height:100%; height:100%;

font:x-small Arial, Verdana, sans-serif;

voice-family: ""}"";voice-family:inherit;

font-size:small;/*
for IE 5.5 */

} html>body {font-size:small;}

/*
font-size: small; voice-family: ""}"";

voice-family: inherit; font-size: medium;*/} /* Assist IE rendering height, keyword-font sizes, etc. */

p {font-size: 90%; line-height:1.2em; margin-top:6px;}

h1, h2, h3, h4, h5, h6 {font-family: 'times new roman', arial, verdana, serif;

font-style:normal; font-variant:normal; font-weight:normal; margin:11px 0 0 10px;}

h1{font-size: 1.93em; margin-top:12px;}

h2{font-size: 1.72em; margin-top:12px;}

h3{font-size: 1.52em; margin-top:12px;}

h4{font-size: 1.42em; margin-top:12px;}

h5{font-size: 1.32em; margin-top:12px;}

h6{font-size: 1.21em; margin-top:12px;}

ul#photobook {position:relative; width:650px; height:410px; margin:70px auto; list-style-type:none;

font-family:arial, verdana, serif; border:5px double silver;}

ul#photobook h1 {position:absolute; left:105px; top:-55px; width:450px; margin:20px auto; text-align:center; border:3px double silver; border-bottom: 0 none;}

ul#photobook li {float:left; margin:7px;}

ul#photobook li img {border:1px solid blue; height:80px; width:144px; display:block;}

ul#photobook li p {text-align:center; margin:5px 0; width:140px; height:30px;}

.clear {clear:all;}

</style>

</head>

<body>

<ul id="photobook">

<li><img src="#" alt="this is a picture"/><p>L. Ips. Dolar</p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem Ipsum Dolar your visible descriptive text</p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem Ipsum Dolar </p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem Ipsum Dolar your descriptive text</p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem Ipsum Dolar your visible descriptive text</p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem Ipsum Dolar your descriptive text</p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem Ipsum Dolar </p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem<br />Ipsum Dolar</p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem Ipsum text</p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem Ipsum Dolar your descriptive text</p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem Ipsum text</p></li>

<li><img src="#" alt="this is a picture" /><p>Lorem Ipsum Dolar your descriptive text</p></li>

<li><h1>An all-CSS image-ready photobook</h1></li>

</ul>

</body>

</html>[/QUOTE]
The image you showed looks like a javascript thing I think I saw over on dynamicdrive.com, -a 'polaroid image viewer script' I think it was called(??). You set up the script and a 'class' is given to any number of images, and there are a few others steps to do but basically, the image is given a bottom 'padding' that allows you to enter a line or two of text...
Copy linkTweet thisAlerts:
@ryani210693authorAug 20.2007 — Ah right i see about the javascript.

The script you gave certainly works, but does not work right in the way ui'd like it to in my site design in dreamweaver, seen as the image is already in a CSS defined table and therefore dreamweaver doesn't like messing with it and decides to mess it all up for me.

But thanks for the help nevertheless.

thanks, Ryan.
×

Success!

Help @ryani210693 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...