/    Sign up×
Community /Pin to ProfileBookmark

Centering an Image

I can’t center an image! I know, it sounds stupid. After it wouldn’t work, I even copy and pasted the code off Active Jump and changed the URL.
[URL=http://freewebs.com/goataid]Here[/URL] is the link. At the moment, the code for the image is

[CODE]<p align=”center”>
<img src= “http://www.freewebs.com/goataid/Goat%20Aid.gif”>
</p>[/CODE]

I don’t know what wrong.
While you’re at it, does the image look weird? I’m using Firefox.
Thanks in advance

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJul 15.2005 — Here's how I'd do it (welcome to the world of CSS):
[code=html]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
<title>Goat Aid</title>
<style type="text/css">
<!--
h1 {
text-align: center;
margin: 10px;
padding: 0;
}
-->
</style>
</head>
<body>
<h1>
<img src="http://www.freewebs.com/goataid/Goat%20Aid.gif" alt="Goat Aid"
width=300 height=400>
</h1>
<p style="text-align: center">UNDER CONSTRUCTION</p>
<script type="text/javascript" src="/i.js"></script>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@FurbybrainauthorJul 15.2005 — OK, thanks. Seems a long code for something so simple lol, but it'll probably have other advantages.
Copy linkTweet thisAlerts:
@NogDogJul 15.2005 — OK, thanks. Seems a long code for something so simple lol, but it'll probably have other advantages.[/QUOTE]
You could just style the <p> tag in your original sample:
[code=html]
<p style="text-align: center"><img...blah...blah...blah></p>
[/code]

But going the CSS style section route means you can tweak the appearance of the relevant elements within the style section, without messing around with the content section. When this becomes truly powerful is when certain content and stylistic elements carry across multiple pages on your site. Then you can use a single external style sheet referenced by one HTML line on each page, applying those stlyings to all those pages. Then when you decide to change some visual aspect of the pages, you just need to change the relevant line(s) in one place: the style sheet.

[i]Note: some of the other things I added are just things to make the markup valid HTML 4.01, such as the alt, width, and height attributes of the img tag, adding a doctype at the beginning, etc. Using H1 instead of P tags for the logo seemed more semantically meaningful.[/i]
×

Success!

Help @Furbybrain 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

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