-1

我正在尝试以特殊格式在段落中设计一些单词。但它对我说,比在<p>标签内我不能使用标签<bank1>而且<bank2>我已经创建了。我不想关闭<p>标签,因为我不想换行,但我想留在段落内。任何人都可以帮助我...提前谢谢这是html行:

<p class="title">Welcome to <bank1>TACROX </bank1> <bank2> Bank </bank2>!</p>

这是CSS部分

bank1 {
    font-family: "Rockwell Extra Bold", serif;
    font-size: 1.2em;
    color: #d9531e;
}

bank2 {
    font-family: "Rockwell Extra Bold", serif;
    color: #22242b;
    font-size: 1.2em;
}
4

3 回答 3

4

尝试:

<p class="title">Welcome to <span class="bank1">TACROX</span> <span class="bank2">Bank</span>!</p>

和 CSS:

.bank1 {
    font-family: "Rockwell Extra Bold", serif;
    font-size: 1.2em;
    color: #d9531e;
}
.bank2 {
    font-family: "Rockwell Extra Bold", serif;
    color: #22242b;
    font-size: 1.2em;
}

没有 a bank1orbank2元素之类的东西,因此您可以将spans 与指定的class. 你不能只制作自己的元素。

此外,由于两者之间存在相似之处,您可以删除一些冗余:

.bank1, .bank2 {
    font-family: "Rockwell Extra Bold", serif;
    font-size: 1.2em;
}
.bank1
    color: #d9531e;
}
.bank2 {
    color: #22242b;
}
于 2013-11-05T14:09:09.523 回答
0

What you want is a span, you can't create random elements.

CSS

#bank1{
  font-family: "Rockwell Extra Bold", serif;
  font-size: 1.2em;
  color: #d9531e;
}
#bank2{
  font-family: "Rockwell Extra Bold", serif;
  color: #22242b;
  font-size: 1.2em;
}

HTML

<p class="title">Welcome to <span id="bank1">TACROX </span> <span id="bank2"> Bank </span>!</p>
于 2013-11-05T14:09:30.657 回答
0

您可能想尝试使用跨度类:

<p class="title">Welcome to <span class="bank1">TACROX </span> <span class="bank2"> Bank </span>!</p>

和CSS:

.bank1{font-family: "Rockwell Extra Bold", serif;
      font-size: 1.2em;
    color: #d9531e;}
.bank2{font-family: "Rockwell Extra Bold", serif;
    color: #22242b;
    font-size: 1.2em;}

您可以在此处找到有关 span 标签的更多信息:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span

于 2013-11-05T14:08:39.617 回答