Be a Supporter!

Image Html Code.

  • 675 Views
  • 27 Replies
New Topic Respond to this Topic
15DAVE15
15DAVE15
  • Member since: Mar. 19, 2008
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Image Html Code. 2009-06-05 19:23:08 Reply

Hello, l have an image on my webpage l would like to align to center, here is the code:
<img border="1" src="Header1.jpg" align="middle" width="1000" height="150"/>
It will not align to the center but, have l done something wrong???

Jon-86
Jon-86
  • Member since: Jan. 30, 2007
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to Image Html Code. 2009-06-05 19:36:00 Reply

At 6/5/09 07:23 PM, 15DAVE15 wrote: align="middle"

Will not do anything. Learn about the align attribute and its values. The image has to be in a container be that a div or even the body of the document. You could then center it using CSS and setting the margin appropriatly.

Google CSS centring using margin or something. In fact googling how to centre content would give you and answer. So don't ask a simple question like this again, google it! Read the programming forum rules after you read this!


PHP Main :: C++ Main :: Java Main :: Vorsprung durch Technik
irc.freenode.net #ngprogramming

BBS Signature
Super-Yombario
Super-Yombario
  • Member since: Mar. 16, 2007
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Image Html Code. 2009-06-05 22:03:46 Reply

At 6/5/09 07:36 PM, Jon-86 wrote: Google CSS centering using margin or something. In fact googling how to center content would give you and answer.

Or you could let him do what he's trying to do, damn css junkie.

align="left"
align="right"
align="center"

Those all work

Relish
Relish
  • Member since: Jan. 22, 2008
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to Image Html Code. 2009-06-05 23:23:14 Reply

At 6/5/09 10:03 PM, Super-Yombario wrote: align="left"
align="right"
align="center"

Those all work

Align is deprecated. Use CSS.

15DAVE15
15DAVE15
  • Member since: Mar. 19, 2008
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Image Html Code. 2009-06-05 23:42:13 Reply

Yea l have read the forum rules and l have searched google, that is how l got the current code l am using...
l can get it to align left and right but not center...

DearonElensar
DearonElensar
  • Member since: Jun. 10, 2002
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to Image Html Code. 2009-06-06 07:43:48 Reply

At 6/5/09 10:03 PM, Super-Yombario wrote: Or you could let him do what he's trying to do, damn css junkie.

Just because you suck at it or don't get it doesn't mean that it is the best solution 99% of the time.


BBS Signature
Super-Yombario
Super-Yombario
  • Member since: Mar. 16, 2007
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Image Html Code. 2009-06-08 15:42:25 Reply

I LOVE CSS, I use it all the time. The website I am making would never remotely look nice without CSS. But he asked how to align it to the center WITH THE ALIGN ATTRIBUTE. He never mentioned CSS. I hate how this forum shoves CSS down the throat of every beginner who asks a question about attributes.

Jon-86
Jon-86
  • Member since: Jan. 30, 2007
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to Image Html Code. 2009-06-08 15:49:01 Reply

At 6/8/09 03:42 PM, Super-Yombario wrote: I hate how this forum shoves CSS down the throat of every beginner who asks a question about attributes.

He said:
"l would like to align to center, here is the code:"
and
"It will not align to the center but, have l done something wrong???"

He never specified anything other than "what am I doing wrong" if your looking for help and you don't know the answer. Dose it matter what answer you get as long as it works for you? I could jave just as easily said centre the image using a table. But I didn't..! Nothing was shoved down the persons throat. Its not as if I got a CSS book and said swallow that ya bas! CSS isn't even that hard to start doing even for a complete beginner.


PHP Main :: C++ Main :: Java Main :: Vorsprung durch Technik
irc.freenode.net #ngprogramming

BBS Signature
Afro-Ninja
Afro-Ninja
  • Member since: Mar. 2, 2002
  • Offline.
Forum Stats
Moderator
Level 44
Game Developer
Response to Image Html Code. 2009-06-08 15:53:04 Reply

At 6/8/09 03:42 PM, Super-Yombario wrote: I LOVE CSS, I use it all the time. The website I am making would never remotely look nice without CSS. But he asked how to align it to the center WITH THE ALIGN ATTRIBUTE. He never mentioned CSS. I hate how this forum shoves CSS down the throat of every beginner who asks a question about attributes.

so we should continue to explain/teach old and deprecated methods of design, without any mention of the right way to do it?


BBS Signature
Super-Yombario
Super-Yombario
  • Member since: Mar. 16, 2007
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Image Html Code. 2009-06-08 18:22:38 Reply

He asked what he was doing wrong with the align attribute. I'm not saying it's okay to always use deprecated attributes, but he just asked about how to align the image to the center and he was already using the proper tag, he just incorrectly filled the attribute.

Jon-86
Jon-86
  • Member since: Jan. 30, 2007
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to Image Html Code. 2009-06-08 18:25:37 Reply

He didn't know what he was doing wrong! He didn't know it was the attribute. If he knew what was wrong he would have fixed it himself.


PHP Main :: C++ Main :: Java Main :: Vorsprung durch Technik
irc.freenode.net #ngprogramming

BBS Signature
TheRyoku
TheRyoku
  • Member since: Nov. 8, 2007
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Image Html Code. 2009-06-08 20:08:31 Reply

At 6/8/09 03:42 PM, Super-Yombario wrote: The website I am making would never remotely look nice without CSS. But he asked how to align it to the center WITH THE ALIGN ATTRIBUTE. He never mentioned CSS. I hate how this forum shoves CSS down the throat of every beginner who asks a question about attributes.

1.) CSS is the new standard pretty much. It's not difficult, and people should start using it.

2.) Your site looks like garbage. The background image is horrible, the layout's terrible, etc.

3.) What Dearon said.

DearonElensar
DearonElensar
  • Member since: Jun. 10, 2002
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to Image Html Code. 2009-06-09 06:53:02 Reply

At 6/8/09 08:08 PM, TheRyoku wrote: 1.) CSS is the new standard pretty much. It's not difficult, and people should start using it.

2.) Your site looks like garbage. The background image is horrible, the layout's terrible, etc.

3.) What Dearon said.

And on top of that, the html and the css both have problems.


BBS Signature
Jessii
Jessii
  • Member since: Feb. 10, 2005
  • Offline.
Forum Stats
Member
Level 36
Movie Buff
Response to Image Html Code. 2009-06-09 07:40:24 Reply

At 6/9/09 06:53 AM, DearonElensar wrote: And on top of that, the html and the css both have problems.

And I absolutely LOVE the whole "your internet browser is not supported by this website" thing that comes up at the top when you use IE 7, which means that you're putting at least 80% of internet users out in the cold. I suggest you start supporting IE but I also suggest fixing your own website first before giving people advice on how to fix their HTML and CSS.

Super-Yombario
Super-Yombario
  • Member since: Mar. 16, 2007
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Image Html Code. 2009-06-09 17:46:46 Reply

At 6/9/09 07:40 AM, Jessii wrote:
And I absolutely LOVE the whole "your internet browser is not supported by this website" thing that comes up at the top when you use IE 7, which means that you're putting at least 80% of internet users out in the cold. I suggest you start supporting IE but I also suggest fixing your own website first before giving people advice on how to fix their HTML and CSS.

25% of the internet use any IE version, so you know

At 6/9/09 06:53 AM, DearonElensar wrote: And on top of that, the html and the css both have problems.

I don't know how to fix the CSS error, so I'll just keep it there. And the invalid HTML is because of the links. Apparently you can't have anything like &, =, or ? in your links. Maybe that's my bad. But just because I don't know how to make my code perfect doesn't mean I don't know what it does. So I daree you to find anything in my source that I can't explain, huh?

Afro-Ninja
Afro-Ninja
  • Member since: Mar. 2, 2002
  • Offline.
Forum Stats
Moderator
Level 44
Game Developer
Response to Image Html Code. 2009-06-09 18:14:49 Reply

At 6/9/09 05:46 PM, Super-Yombario wrote: 25% of the internet use any IE version, so you know

where did you get that statistic from? According to my google analytics report, 65% of my traffic uses IE

I don't know how to fix the CSS error, so I'll just keep it there. And the invalid HTML is because of the links. Apparently you can't have anything like &, =, or ? in your links. Maybe that's my bad. But just because I don't know how to make my code perfect doesn't mean I don't know what it does. So I daree you to find anything in my source that I can't explain, huh?

& must be written as &amp; because '&' is the character that signifies an escaped html entity.


BBS Signature
Super-Yombario
Super-Yombario
  • Member since: Mar. 16, 2007
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Image Html Code. 2009-06-09 21:54:01 Reply

Oh, okay, I'll change that now then :P
A quick Ctrl+F

But aside from that, I got my statistics from w3schools.com, and according to them, 40% use any IE, and 21% use IE7

citricsquid
citricsquid
  • Member since: Jun. 25, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to Image Html Code. 2009-06-10 04:12:52 Reply

At 6/9/09 09:54 PM, Super-Yombario wrote: But aside from that, I got my statistics from w3schools.com, and according to them, 40% use any IE, and 21% use IE7

So how did you come to the 25% total?

DearonElensar
DearonElensar
  • Member since: Jun. 10, 2002
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to Image Html Code. 2009-06-10 07:06:02 Reply

At 6/9/09 09:54 PM, Super-Yombario wrote: Oh, okay, I'll change that now then :P
A quick Ctrl+F

But aside from that, I got my statistics from w3schools.com, and according to them, 40% use any IE, and 21% use IE7

Market share put's it at 70%, The Counter at 75%, One Stat at 80%, Statcounter at 65% and Adtech at 66%.
So even if they all overestimate it you still have way more than 25% of even 40% and most of the general users use IE.


BBS Signature
Super-Yombario
Super-Yombario
  • Member since: Mar. 16, 2007
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Image Html Code. 2009-06-10 10:25:10 Reply

If this has to go from answering his question without disrupting his learning to why my website doesn't support IE, I'm out.

DearonElensar
DearonElensar
  • Member since: Jun. 10, 2002
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to Image Html Code. 2009-06-10 11:18:51 Reply

At 6/10/09 10:25 AM, Super-Yombario wrote: If this has to go from answering his question without disrupting his learning to why my website doesn't support IE, I'm out.

You were the one who advised on faulty, deprecated HTML and when we said the original poster should use CSS you felt the need to bitch about it, so it's pretty much your own fault for starting this.


BBS Signature
DannyIsOnFire
DannyIsOnFire
  • Member since: Apr. 14, 2005
  • Offline.
Forum Stats
Member
Level 21
Movie Buff
Response to Image Html Code. 2009-06-10 11:35:28 Reply

At 6/9/09 09:54 PM, Super-Yombario wrote: But aside from that, I got my statistics from w3schools.com, and according to them, 40% use any IE, and 21% use IE7

You can't use W3Schools as an accurate portrayal of Internet Explorer users. Think of the W3Schools userbase. More often than not it's people who know a thing or two about web-development. People often smarter than your average Internet user. Therefore people who know that Firefox/Opera/Chrome/Safari are better alternatives.


|| Portfolio || Facebook || Twitter ||

BBS Signature
urbn
urbn
  • Member since: Jun. 10, 2007
  • Offline.
Forum Stats
Member
Level 18
Programmer
Response to Image Html Code. 2009-06-10 13:53:55 Reply

At 6/9/09 09:54 PM, Super-Yombario wrote: Oh, okay, I'll change that now then :P
A quick Ctrl+F

But aside from that, I got my statistics from w3schools.com, and according to them, 40% use any IE, and 21% use IE7

Yes these are the statistics, but what you don't realise is that you can't rely on them! Web developers should ALWAYS be looking for maximum compatibility.

If you NEED a feature not available in Internet Explorer then you should always provide an alternative of some kind, or a least an apology, and how you wish you could be more awesome by making it compatible. You can't just shun people from your site based on your own personal preference.

And you may like to quote W3 but I don't think you ACTUALLY read the page.

Statistics Are Often Misleading
You cannot - as a web developer - rely only on statistics. Statistics can often be misleading.

Scroll down next time.


BBS Signature
Entice
Entice
  • Member since: Jun. 30, 2008
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to Image Html Code. 2009-06-10 14:29:22 Reply

At 6/9/09 05:46 PM, Super-Yombario wrote: I don't know how to fix the CSS error, so I'll just keep it there.

What do you mean? It says

157  #light2   Property opacity doesn't exist in CSS level 2.1 but exists in [css3] :  0.7

. Either start using CSS3 (if it's available yet) or just remove the part thats causing the error. It even tells you what line its on.

nyboywonder
nyboywonder
  • Member since: Jan. 14, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Image Html Code. 2009-06-17 04:55:01 Reply

Here is the code <div style="text-align: center;"><IMG SRC="image.gif" ALT="image"></div>. This will definitely work.

smulse
smulse
  • Member since: Mar. 24, 2005
  • Offline.
Forum Stats
Member
Level 31
Blank Slate
Response to Image Html Code. 2009-06-17 10:42:01 Reply

At 6/17/09 04:55 AM, nyboywonder wrote: Here is the code <div style="text-align: center;"><IMG SRC="image.gif" ALT="image"></div>. This will definitely work.

Wow, lets take a look at what's wrong with this:
Inline CSS, capital HTML tags, not closing the image. It's also highly inefficient and unnecessarily bloated.

5 errors in about 70 characters, that's a new record?


BBS Signature
blah569
blah569
  • Member since: Jan. 18, 2005
  • Offline.
Forum Stats
Member
Level 25
Programmer
Response to Image Html Code. 2009-06-17 12:56:13 Reply

At 6/17/09 10:42 AM, smulse wrote:
At 6/17/09 04:55 AM, nyboywonder wrote: Here is the code <div style="text-align: center;"><IMG SRC="image.gif" ALT="image"></div>. This will definitely work.
Wow, lets take a look at what's wrong with this:
Inline CSS, capital HTML tags, not closing the image. It's also highly inefficient and unnecessarily bloated.

5 errors in about 70 characters, that's a new record?

With inline CSS though, do you consider it necessary to define a new CSS entry (if you're only using one line of CSS?) Such as this:

<div style="margin: 0 auto;"><img src="images/myImage.png" /></div>
Even though you might reuse the above a lot, but think of it as you might not reuse it, so then would creating an entry be more time consuming?

BBS Signature
smulse
smulse
  • Member since: Mar. 24, 2005
  • Offline.
Forum Stats
Member
Level 31
Blank Slate
Response to Image Html Code. 2009-06-17 15:30:41 Reply

At 6/17/09 12:56 PM, blah569 wrote: With inline CSS though, do you consider it necessary to define a new CSS entry (if you're only using one line of CSS?) Such as this:
<div style="margin: 0 auto;"><img src="images/myImage.png" /></div>
Even though you might reuse the above a lot, but think of it as you might not reuse it, so then would creating an entry be more time consuming?

I guess it depends entirely on the context you're using it in. If you want all images centred, or you're going to use it cross-pages you might as well add in a style. But, it's not like the CSS would be much weight.


BBS Signature