18910140161

编辑HTML的CSS(Bluedict)-堆栈溢出

顺晟科技

2022-10-18 13:06:47

124

我是个初学者,我需要帮助。我想在两个边界

之间放一个词。

我的代码

<代码>#HW{FONT-FAMILY:纳扎宁;字体大小:200%;字体粗细:正常;方向:RTL;文本对齐:居中;颜色:#6DBAEE;}.H1{上边框:1px实线#00bdf2;底部边框:1px实线#00BDF2;填充:10px 0;行高:150%;位置:相对;}
<代码><;p ID=“ HW ”>;美容<;/p>;

应该怎么做才能把我的单词放在两个边框之间(就像我的CSS中的那个)?


顺晟科技:

你可以做更简单的事情。将Word放入<p id="hw">beauty</p>标记中,并给他一个ID.对于标记<p id="hw">beauty</p>,您不应使#hw { font-family: Nazanin; font-size: 200%; font-weight: normal; direction: rtl; text-align: center; color: #6dbaee; } .h1{ border-top: 1px solid #00bdf2; border-bottom: 1px solid #00bdf2; padding: 10px 0; line-height: 150%; position: relative; }成为选择器,而应使h1

<代码><;H1 ID=“ HW ”>;美容<;/H1>;

你已经拥有了你所需要的一切。只需将类<p id="hw">beauty</p>添加到段落元素,如下所示:

<代码><;P ID=";硬件";类=";H1";>;美容<;/p>;

完美!ð。

您的示例中,您使用了#hw { font-family: Nazanin; font-size: 200%; font-weight: normal; direction: rtl; text-align: center; color: #6dbaee; } .h1{ border-top: 1px solid #00bdf2; border-bottom: 1px solid #00bdf2; padding: 10px 0; line-height: 150%; position: relative; },但是在您的HTML中没有名为<p id="hw">beauty</p>的类。

CSS中,这些东西被称为选择器

对于HTML,我们可以直接使用.h1选择器将CSS绑定到它。

注意:这将在文档中的每个.h1元素上设置,因此考虑将什么CSS绑定到什么元素是很重要的。

<代码>#HW{字体系列:纳扎宁;字体大小:200%;字体粗细:正常;方向:RTL;文本对齐:居中;颜色:#6DBAEE;}P{上边框:1px实线#00bdf2;底部边框:1px实线#00bdf2;填充:10px 0;行高:150%;位置:相对;}
<代码><;p ID=“ HW ”>;美容<;/p>;

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航