You are not logged in.

#1 2022-06-01 19:58:55

yoquec
Member
Registered: 2022-06-01
Posts: 2

I'm unable to open images on my own coded HTML files in any browser

Im unable to make images appear in an HTML document, but the browser can open them on their own with no problem.

Neither firefox, chromium, brave nor qutebrowser are able to open the images inside my local HTML files.

The HTML code is

```html
<!DOCTYPE html>
<html>

    <head><!--{{{-->
            <meta name="viewport" content="width=device-width">
            <title>Vieml</title>
    </head><!-- }}} -->

    <body>
        <h1>My first webpage</h1>
        <p>this is sample text</p>

        <img scr="mountain.jpg" alt="image of a mountain"/>

    </body>

</html>
```

And the directory i'm opening it from contains:

.
├── BR.jpg
├── index.html
├── mountain.jpg
└── test.html

where obviously `index.html` is the file I am opening.

I post it here in the Arch wiki bevause I have an Debian machine to test on, and everything seems to work ok over there.

Offline

#2 2022-06-01 20:37:07

mpan
Member
Registered: 2012-08-01
Posts: 1,369
Website

Re: I'm unable to open images on my own coded HTML files in any browser

You are mixing up HTML and XHTML to start with. One does not close an `img` element in HTML.⁽¹⁾

Also no, that file certainly does not work on Debian. You have misspelled “src” as “scr”.
____
⁽¹⁾ (Edit) As frabjous noted below, extra slash in empty elements is having predictable behavior in HTML5.

Last edited by mpan (2022-06-02 16:45:52)


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#3 2022-06-02 07:14:26

yoquec
Member
Registered: 2022-06-01
Posts: 2

Re: I'm unable to open images on my own coded HTML files in any browser

I'm certainly retarded as you may say, it was the f**cking src tag, but in debian I have a linter which auto-lints the file on save.
Thanks for noting!

Offline

#4 2022-06-02 13:38:55

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: I'm unable to open images on my own coded HTML files in any browser

mpan wrote:

One does not close an `img` element in HTML.

While both unnecessary and pointless, it's not invald to use a self-closing / in a void element in HTML5. (Source.)

Offline

#5 2022-06-02 16:49:13

mpan
Member
Registered: 2012-08-01
Posts: 1,369
Website

Re: I'm unable to open images on my own coded HTML files in any browser

So many years and I still keep forgetting HTML5 made errors well-defined behavior. :D


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#6 2022-06-03 06:23:24

seth
Member
Registered: 2012-09-03
Posts: 60,950

Re: I'm unable to open images on my own coded HTML files in any browser

it was the f**cking src tag

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Online

Board footer

Powered by FluxBB