【问题标题】:How to take html link from space between two hyperlinks?如何从两个超链接之间的空间获取html链接?
【发布时间】:2020-12-31 15:45:39
【问题描述】:

对于初学者的简单问题: 是否可以从我的标题文本链接之间的空间中获取(省略)超链接(参见下面的代码)。

body {
    background-color: #6B6B6B;
    font-family: Arial;
    color: #D7D7D7;
    font-size: 15px;
    margin: 0px;
}
.links {
    font-family: Arial;
    color: #8f8f8f;
    font-size: 20px;
    letter-spacing: 1px;
}
p.space { /* header space lenght */
    word-spacing: 50px;
}
<p class="space">Home Gallery</p>

<p class="space"><a href="home.htm">Home </a><a href="gallery.htm">Gallery</a></p>

【问题讨论】:

  • 你有 home.htm 而不是 home.html?

标签: html css text hyperlink


【解决方案1】:

是的,如果您将一个类应用到具有margin-left 的第二个链接:

body {
  background-color: #6B6B6B;
  font-family: Arial;
  color: #D7D7D7;
  font-size: 15px;
  margin: 0px;
}

.links {
  font-family: Arial;
  color: #8f8f8f;
  font-size: 20px;
  letter-spacing: 1px;
}

.space {
  /* header space lenght */
  word-spacing: 50px;
}

.space2 {
  margin-left: 50px;
}
<p class="space">Home Gallery</p>

<p><a href="home.htm">Home </a><a href="gallery.htm" class="space2">Gallery</a></p>

或者,如果您将空格视为单独的元素:

body {
  background-color: #6B6B6B;
  font-family: Arial;
  color: #D7D7D7;
  font-size: 15px;
  margin: 0px;
}

.links {
  font-family: Arial;
  color: #8f8f8f;
  font-size: 20px;
  letter-spacing: 1px;
}

.space {
  /* header space lenght */
  word-spacing: 50px;
}

.space2 {
  width: 50px;
  display: inline-block;
}
<p class="space">Home Gallery</p>

<p><a href="home.htm">Home </a><span class="space2"></span><a href="gallery.htm">Gallery</a></p>

【讨论】:

    【解决方案2】:

    只需将space 移出&lt;a&gt; 标记

    body {
        background-color: #6B6B6B;
        font-family: Arial;
        color: #D7D7D7;
        font-size: 15px;
        margin: 0px;
    }
    .links {
        font-family: Arial;
        color: #8f8f8f;
        font-size: 20px;
        letter-spacing: 1px;
    }
    p.space { /* header space lenght */
        word-spacing: 50px;
    }
    <p class="space">Home Gallery</p>
    
    <p class="space"><a href="home.htm">Home</a> <a href="gallery.htm">Gallery</a></p>

    添加:如果你想在&lt;a&gt;标签中使用空格,你可以这样写:

    <a href="about.htm">About&#8192;us</a>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-30
      • 1970-01-01
      • 1970-01-01
      • 2016-10-15
      • 1970-01-01
      • 2016-10-06
      • 2018-05-01
      • 1970-01-01
      相关资源
      最近更新 更多