css Bootstrap 值:窗体组标签样式

lsmepo6l  于 2023-02-10  发布在  Bootstrap
关注(0)|答案(3)|浏览(125)

我正在尝试t样式标签的形式组在 Bootstrap 的版本,但它不工作。我已经尝试一切,但没有运气。我真的需要一些帮助如何做到这一点。

.add-style label {

color: red;

}
<b-container>

<b-form-group class="add-style" label="Product Name">
          <b-form-input type="text" id="pName" required
                        placeholder="Enter product name"/>
        </b-form-group>

</b-container>
rdlzhqv9

rdlzhqv91#

你可以这样做:

<b-container>

<b-form-group class="add-style">
          <label style="color: red;" for="pName">Product Name:</label>
          <b-form-input type="text" id="pName" required
                        placeholder="Enter product name"/>
        </b-form-group>

</b-container>

或者,如果你不想使用内联css,那么你可以这样做:
CSS:

label {
    color: red;
}

网址:

<b-container>

    <b-form-group class="add-style">
              <label for="pName">Product Name:</label>
              <b-form-input type="text" id="pName" required
                            placeholder="Enter product name"/>
            </b-form-group>

    </b-container>
46scxncf

46scxncf2#

问题是如果你使用css,你必须使用selector(class或id)或者tag元素,而不是两者都用。你同时使用了两个元素,即**. add-style label**。这里**. add-style**是一个class,label是一个tag元素。
此外,您的标记中必须有一些文本才能看到效果。我使用的是简单文本。您可以根据您的要求替换为您自己的vue文本(或您在您的语言中调用的任何文本,例如{page. title}):

.add-style{

color: red;

}
<b-container>

<b-form-group class="add-style" label="Product Name">
          <b-form-input type="text" id="pName" required
                        placeholder="Enter product name"/>
                  test
        </b-form-group>

</b-container>

希望这个有用。

wvmv3b1j

wvmv3b1j3#

你试过label-class prop 了吗?

相关问题