首页 > 解决方案 > 需要 HTML 方面的帮助,初学者在这里

问题描述

所以,最近我试图弄乱 html,它进展顺利,直到我试图添加一个链接。所以链接不起作用,它把我带到 html 文件所在的文件目录并说 err_file_not_found

<!DOCTYPE html>
    <title>hello World</title>
    <head>Hello World !</head>
    <header>2nd sentence</header>
    <h1>3rd sentence</h1>
    <h2>4th sentence</h2>
    <h3>5th sentence</h3>
    <h4>6th sentences</h4>
    <h5>7th sentence</h5>
    <h6>8th sentence</h6>
    <p>this is a regular sentence.<br>
        regular sentences contain many words.<br>
        by the end of this day , i will learn new 
    things and remember old ones.<br>
        i learned how to write words in 
    <em>diagonal</em> .<br>
        i also learned how to write words in 
    <strong>bold</strong><br>
    <ul>my first list
        <p>list item 1</p>
        <p>list item 2</p>
        <p>list item 3</p>
        <p>list item 4</p>
    </ul>
    <ol>my secon list
        <p>list item 1</p>
        <p>list item 2</p>
        <p>list item 3</p>
        <p>list item 4</p>
        </ol>
        <hr> some thing horizontal
        <a href="www.wikipedia.org">this is an example 
    of a web page</a>
    </p>

标签: html

解决方案


只是作为一个指南 - 更正您的 HTML 标记也许这将是有用的,因为它封装了我在上面所做的评论。

<!DOCTYPE html>
<html>
    <head>
        <title>hello World</title>
    </head>
    <body>
    
        <header>2nd sentence</header>
        
        <h1>3rd sentence</h1>
        <h2>4th sentence</h2>
        <h3>5th sentence</h3>
        <h4>6th sentences</h4>
        <h5>7th sentence</h5>
        <h6>8th sentence</h6>
        
        <p>
            this is a regular sentence.<br>
            regular sentences contain many words.<br>
            by the end of this day , i will learn new 
            things and remember old ones.
            
            <br>
            
            i learned how to write words in 
            <em>diagonal</em> .
            
            <br>
            
            i also learned how to write words in 
            <strong>bold</strong>
            
            <br>
            
            <ul>
                <li>my first list</li>
                <li><p>list item 1</p></li>
                <li><p>list item 2</p></li>
                <li><p>list item 3</p></li>
                <li><p>list item 4</p></li>
            </ul>
            <ol>
                <li>my secon list</li>
                <li><p>list item 1</p></li>
                <li><p>list item 2</p></li>
                <li><p>list item 3</p></li>
                <li><p>list item 4</p></li>
            </ol>
            
            <hr> some thing horizontal
            
            <a href="https://www.wikipedia.org" target='_blank'>this is an example of a web page</a>
        </p>
    
    </body>
</html>

需要注意的一件事可能是target='_blank'在超链接中的使用。这将在新窗口/选项卡中打开链接,以便原始页面保持打开状态~毕竟,您不希望将访问者送走!但是,如前所述 - 在添加远程链接时使用该方案,否则它们将被视为相对于当前站点。

<img src='//example.com/images/img1.jpg' />
<script src='//example.com/script.js'></script> ...etc

对于某些类型的内容(img、css、javascript 等),您可以省略该方案,而是使用双斜杠//- 这会强制使用与当前页面相同的协议加载内容。


推荐阅读