/    Sign up×
Community /Pin to ProfileBookmark

this will display the image with border and some space between the border and the image:

[CODE]<img src=”photo.jpg” alt=”Photo” style=”border: 1px solid #000000; padding: 4px;”>[/CODE]

i’m trying to use this with an image where tha size is specified but it doesn’t work:

[CODE]<img src=”img/photo.jpg” alt=”Sample Photo” width=”180″ height=”150″ style=”border: 1px solid #000000; padding: 4px;”>[/CODE]

What am i doing wrong?

to post a comment
CSS

15 Comments(s)

Copy linkTweet thisAlerts:
@KeveyMay 03.2007 — It works for me in FF, but not iE.
Copy linkTweet thisAlerts:
@cootheadMay 03.2007 — Hi there MikaWhat,

try it like this, instead....
[color=navy]&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;

&lt;style type="text/css"&gt;
#img_container {
width:180px;
height:150px;
padding:4px;
border:1px solid #000;
}
#img_container img {
width:180px;
height:150px;
display:block;
}
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div id="img_container"&gt;
&lt;img src="img/photo.jpg"" alt="Sample Photo" /&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
[/color]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@UbuntuniXMay 03.2007 — Hi there MikaWhat,

try it like this, instead....[/QUOTE]


Bad use of the HTML doctype...
Copy linkTweet thisAlerts:
@cootheadMay 03.2007 — Hi there UbuntuniX,
[color=navy]Bad use of the HTML doctype...[/color][/quote]
Would care to elucidate?

[i]coothead[/i]
Copy linkTweet thisAlerts:
@ray326May 03.2007 — I suspect this.
[code=html]<img src="img/photo.jpg"" alt="Sample Photo" />[/code]
Copy linkTweet thisAlerts:
@UbuntuniXMay 03.2007 — Hi there UbuntuniX,

Would care to elucidate?

[i]coothead[/i][/QUOTE]


You self-closed the image under a HTML doctype.
Copy linkTweet thisAlerts:
@cootheadMay 03.2007 — Hi there UbuntuniX,
[color=navy]You self-closed the image under a HTML doctype.[/color][/quote]
What is the problem with this?

[i]coothead[/i]
Copy linkTweet thisAlerts:
@KeveyMay 03.2007 — I suspect this.
[code=html]<img src="img/photo.jpg"" alt="Sample Photo" />[/code][/QUOTE]


Ray326 has it right. The double quote after jpg (assumed accidental) is an issue. Other wise it validates and works in FF and IE.
Copy linkTweet thisAlerts:
@UbuntuniXMay 03.2007 — Yes, but I was speaking of the slash ending the tag.
Copy linkTweet thisAlerts:
@MikaWhatauthorMay 04.2007 — Hi guys, thanks for your posts... this is what i'm actually using

[code=php]echo "<img src="images/$image" border="0" width="170" height="120" style="float:left; margin:4px 20px 10px 0; border-top: 1px #000033 solid; border-right: 1px #000033 solid;border-bottom: 1px #000033 solid; border-left: 1px #000033 solid; padding: 4px;" />";[/code] Does the doctype makes any difference?
Copy linkTweet thisAlerts:
@xnoiseMay 04.2007 — the doctype makes a lot of difference. just test some properties that are known to cause problems in IE under transitional on strict. most of them won't create same problems again (that from my experience). and for IE use a separate stylesheet always. it's the best thing to do, considering the large amount of "holes" in it.

Also IE7 seems to be no better than IE6, so good luck.

And self closing the tags IS NOT html, it's XHTML. so no need for self close tags.
Copy linkTweet thisAlerts:
@MikaWhatauthorMay 04.2007 — It works for me in FF, but not iE.[/QUOTE]Mine works too in FF, but not in IE7...but you can't just force everybody to use FF! That's what i hate about CSS, sometimes a website which looks great in IE it looks so ugly in FF.
Copy linkTweet thisAlerts:
@UbuntuniXMay 04.2007 — Mine works too in FF, but not in IE7...but you can't just force everybody to use FF! That's what i hate about CSS, sometimes a website which looks great in IE it looks so ugly in FF.[/QUOTE]
Blame MS. Not Mozilla.
Copy linkTweet thisAlerts:
@MikaWhatauthorMay 04.2007 — Blame MS. Not Mozilla.[/QUOTE]Yes i know but most people use IE
Copy linkTweet thisAlerts:
@UbuntuniXMay 04.2007 — Yes i know but most people use IE[/QUOTE]

Most people use Windows, that doesn't mean it's better or more important. ?
×

Success!

Help @MikaWhat 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 4.27,
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,
)...