Jump to content

HTML img tags?

handymanshandle

So I know pretty much nothing about coding/programming, I mean I know about the langauges like HTML, C+, C++, C#, Java, JavaScript, etc. However, I was kind of curious if there was more than one way to do an HTML img tag and if there was like a more effective way or something like that. I had seen one example do it like this.

 

<img> img <img>

But the way I thought might be better and used on a site I'm doing for a US History 10B project about a certain decade and Google Sites wasn't allowing me to insert an image for whatever reason, so I just figured to try doing it through html.

 

<img src="url" alt="imgtext">

 

I'm not sure if there's one way that's better or not for adding an image into a website with HTML. I mean the second one worked. But I just kinda wanted input/thoughts about putting an image in with HTML.

a Moo Floof connoisseur and curator.

:x@handymanshandle x @pinksnowbirdie || Jake x Brendan :x
Youtube Audio Normalization
 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, thekeemo said:

img src is how you do it

I didn't try the first one, I did the second one and it worked just fine. I just had seen an example somewhere where it had done the first one I put in my OP.

a Moo Floof connoisseur and curator.

:x@handymanshandle x @pinksnowbirdie || Jake x Brendan :x
Youtube Audio Normalization
 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, wcreek said:

I didn't try the first one, I did the second one and it worked just fine. I just had seen an example somewhere where it had done the first one I put in my OP.

maybe on a forum that uses a syntax that uses < > instead of [ ]

Thats that. If you need to get in touch chances are you can find someone that knows me that can get in touch.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, wcreek said:

I didn't try the first one, I did the second one and it worked just fine. I just had seen an example somewhere where it had done the first one I put in my OP.

img src is the only way to do it as far as i know.

Ryzen 5 3600 stock | 2x16GB C13 3200MHz (AFR) | GTX 760 (Sold the VII)| ASUS Prime X570-P | 6TB WD Gold (128MB Cache, 2017)

Samsung 850 EVO 240 GB 

138 is a good number.

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, thekeemo said:

maybe on a forum that uses a syntax that uses < > instead of [ ]

It's possible.

1 hour ago, themctipers said:

img src is the only way to do it as far as i know.

Would seem that way.

a Moo Floof connoisseur and curator.

:x@handymanshandle x @pinksnowbirdie || Jake x Brendan :x
Youtube Audio Normalization
 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, wcreek said:

So I know pretty much nothing about coding/programming, I mean I know about the langauges like HTML, C+, C++, C#, Java, JavaScript, etc. However, I was kind of curious if there was more than one way to do an HTML img tag and if there was like a more effective way or something like that. I had seen one example do it like this.

 


<img> img <img>

But the way I thought might be better and used on a site I'm doing for a US History 10B project about a certain decade and Google Sites wasn't allowing me to insert an image for whatever reason, so I just figured to try doing it through html.

 


<img src="url" alt="imgtext">

 

I'm not sure if there's one way that's better or not for adding an image into a website with HTML. I mean the second one worked. But I just kinda wanted input/thoughts about putting an image in with HTML.

That first one will never work in html

 

<img src="url" alt="alt text" width="xx" height="xx">

Basically it's a self closing tag, and you don't need to close it

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, jkeasley said:

That first one will never work in html

 


<img src="url" alt="alt text" width="xx" height="xx">

Basically it's a self closing tag, and you don't need to close it

 

latest?cb=20131224233033

 

That's cool to know that if I ever need to do any more images  in HTML because Google Sites decided to remain to be fussy that I can just skip out on doing the ending tag.

 

I suspect that if I don't put the width and height it defaults to whatever the native width and height of the image is from the image source?

a Moo Floof connoisseur and curator.

:x@handymanshandle x @pinksnowbirdie || Jake x Brendan :x
Youtube Audio Normalization
 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, wcreek said:

latest?cb=20131224233033

 

That's cool to know that if I ever need to do any more images  in HTML because Google Sites decided to remain to be fussy that I can just skip out on doing the ending tag.

 

I suspect that if I don't put the width and height it defaults to whatever the native width and height of the image is from the image source?

Yeah it will default. You can use pixels or percentages

Link to comment
Share on other sites

Link to post
Share on other sites

6 hours ago, wcreek said:

latest?cb=20131224233033

 

That's cool to know that if I ever need to do any more images  in HTML because Google Sites decided to remain to be fussy that I can just skip out on doing the ending tag.

 

I suspect that if I don't put the width and height it defaults to whatever the native width and height of the image is from the image source?

And mark as solved for the post which helped the most

Judge a product on its own merits AND the company that made it.

How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill | (Probably) Why LMG Merch shipping to the EU is expensive

Oneplus 6 (Early 2023 to present) | HP Envy 15" x360 R7 5700U (Mid 2021 to present) | Steam Deck (Late 2022 to present)

 

Mid 2023 AlTech Desktop Refresh - AMD R7 5800X (Mid 2023), XFX Radeon RX 6700XT MBA (Mid 2021), MSI X370 Gaming Pro Carbon (Early 2018), 32GB DDR4-3200 (16GB x2) (Mid 2022

Noctua NH-D15 (Early 2021), Corsair MP510 1.92TB NVMe SSD (Mid 2020), beQuiet Pure Wings 2 140mm x2 & 120mm x1 (Mid 2023),

Link to comment
Share on other sites

Link to post
Share on other sites

On 07/06/2016 at 1:19 AM, jkeasley said:

That first one will never work in html

 


<img src="url" alt="alt text" width="xx" height="xx">

Basically it's a self closing tag, and you don't need to close it

 

Self-closing tags are a browser feature, not a language one. It doesn't work in all.

Eien nante naito iikitte shimattar  /  Amarinimo sabishikute setsunai deshou
Dare mo ga hontou wa shinjitai kedo  /  Uragirarere ba fukaku kizu tsuite shimau mono

Link to comment
Share on other sites

Link to post
Share on other sites

On 07/06/2016 at 2:19 AM, jkeasley said:

That first one will never work in html

 


<img src="url" alt="alt text" width="xx" height="xx">

Basically it's a self closing tag, and you don't need to close it

 

I had never used the width and height attributes, isn't it better to use CSS for it?

Link to comment
Share on other sites

Link to post
Share on other sites

7 hours ago, Gachr said:

I had never used the width and height attributes, isn't it better to use CSS for it?

depends. Css is good for styleing all images to a size or groups of images to a size but creating a class or id in css for 1. Image seems pointless so you can just do it inline but yes css os the preferred why to style html.

 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

14 hours ago, Gachr said:

I had never used the width and height attributes, isn't it better to use CSS for it?

I use inline stuff for width and height, thataway you can adjust it per image...much easier in the end

Link to comment
Share on other sites

Link to post
Share on other sites

On ‎08‎/‎06‎/‎2016 at 10:32 PM, jkeasley said:

I use inline stuff for width and height, thataway you can adjust it per image...much easier in the end

ideally images should be uniform not different sizes. What I mean say images in a blog post should be the same size and thumbnails should also be the same size.

 

it's always better to break it down into groups or classes and style in css.

 

your website will look much better for it.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×