Forum Topic: Image Html Code.

(411 views • 27 replies)

This topic is 1 page long.

<< < > >>
Elated

15DAVE15

Reply To Post Reply & Quote

Posted at: 6/5/09 07:23 PM

15DAVE15 NEUTRAL LEVEL 09

Sign-Up: 03/19/08

Posts: 423

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???


None

Jon-86

Reply To Post Reply & Quote

Posted at: 6/5/09 07:36 PM

Jon-86 NEUTRAL LEVEL 13

Sign-Up: 01/30/07

Posts: 3,929

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 :: irc.freenode.net

BBS Signature

None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 6/5/09 10:03 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,178

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

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

Relish

Reply To Post Reply & Quote

Posted at: 6/5/09 11:23 PM

Relish NEUTRAL LEVEL 06

Sign-Up: 01/22/08

Posts: 780

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

Those all work

Align is deprecated. Use CSS.


Elated

15DAVE15

Reply To Post Reply & Quote

Posted at: 6/5/09 11:42 PM

15DAVE15 NEUTRAL LEVEL 09

Sign-Up: 03/19/08

Posts: 423

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...


None

DearonElensar

Reply To Post Reply & Quote

Posted at: 6/6/09 07:43 AM

DearonElensar LIGHT LEVEL 18

Sign-Up: 06/10/02

Posts: 1,731

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

None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 6/8/09 03:42 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,178

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.

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

Jon-86

Reply To Post Reply & Quote

Posted at: 6/8/09 03:49 PM

Jon-86 NEUTRAL LEVEL 13

Sign-Up: 01/30/07

Posts: 3,929

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 :: irc.freenode.net

BBS Signature

None

Afro-Ninja

Reply To Post Reply & Quote

Posted at: 6/8/09 03:53 PM

Afro-Ninja EVIL LEVEL 38

Sign-Up: 03/02/02

Posts: 13,467

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

None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 6/8/09 06:22 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,178

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.

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

Jon-86

Reply To Post Reply & Quote

Posted at: 6/8/09 06:25 PM

Jon-86 NEUTRAL LEVEL 13

Sign-Up: 01/30/07

Posts: 3,929

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 :: irc.freenode.net

BBS Signature

None

TheRyoku

Reply To Post Reply & Quote

Posted at: 6/8/09 08:08 PM

TheRyoku NEUTRAL LEVEL 09

Sign-Up: 11/08/07

Posts: 780

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.


None

DearonElensar

Reply To Post Reply & Quote

Posted at: 6/9/09 06:53 AM

DearonElensar LIGHT LEVEL 18

Sign-Up: 06/10/02

Posts: 1,731

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

None

Jessii

Reply To Post Reply & Quote

Posted at: 6/9/09 07:40 AM

Jessii DARK LEVEL 36

Sign-Up: 02/10/05

Posts: 9,181

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.


None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 6/9/09 05:46 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,178

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?

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

Afro-Ninja

Reply To Post Reply & Quote

Posted at: 6/9/09 06:14 PM

Afro-Ninja EVIL LEVEL 38

Sign-Up: 03/02/02

Posts: 13,467

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

None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 6/9/09 09:54 PM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,178

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

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


Questioning

citricsquid

Reply To Post Reply & Quote

Posted at: 6/10/09 04:12 AM

citricsquid DARK LEVEL 23

Sign-Up: 06/25/05

Posts: 16,078

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?


None

DearonElensar

Reply To Post Reply & Quote

Posted at: 6/10/09 07:06 AM

DearonElensar LIGHT LEVEL 18

Sign-Up: 06/10/02

Posts: 1,731

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

None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 6/10/09 10:25 AM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,178

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

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


None

DearonElensar

Reply To Post Reply & Quote

Posted at: 6/10/09 11:18 AM

DearonElensar LIGHT LEVEL 18

Sign-Up: 06/10/02

Posts: 1,731

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

None

DannyIsOnFire

Reply To Post Reply & Quote

Posted at: 6/10/09 11:35 AM

DannyIsOnFire DARK LEVEL 19

Sign-Up: 04/14/05

Posts: 7,211

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.


None

urbn

Reply To Post Reply & Quote

Posted at: 6/10/09 01:53 PM

urbn FAB LEVEL 18

Sign-Up: 06/10/07

Posts: 2,301

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

None

bgraybr

Reply To Post Reply & Quote

Posted at: 6/10/09 02:29 PM

bgraybr DARK LEVEL 09

Sign-Up: 06/30/08

Posts: 2,167

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.

The following sentence is true. The previous sentence is false. O_o PARADOX!
Linux Users Club | Linketylinklinklinklink...


None

nyboywonder

Reply To Post Reply & Quote

Posted at: 6/17/09 04:55 AM

nyboywonder NEUTRAL LEVEL 02

Sign-Up: 01/14/09

Posts: 68

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


None

smulse

Reply To Post Reply & Quote

Posted at: 6/17/09 10:42 AM

smulse EVIL LEVEL 30

Sign-Up: 03/24/05

Posts: 5,928

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

None

blah569

Reply To Post Reply & Quote

Posted at: 6/17/09 12:56 PM

blah569 DARK LEVEL 21

Sign-Up: 01/18/05

Posts: 2,701

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?

PHP: Main | AS3: Main | Get Firefox | Host large files (fast and free)!
"Thank you for learning me English."

BBS Signature

None

smulse

Reply To Post Reply & Quote

Posted at: 6/17/09 03:30 PM

smulse EVIL LEVEL 30

Sign-Up: 03/24/05

Posts: 5,928

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

All times are Eastern Standard Time (GMT -5) | Current Time: 05:25 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!