Darksidezoo
Darksidezoo

Reputation: 31

CSS styles not applying to element with class

I'm trying to add separate properties to a text section on my website using the extra class name function. I tried using the custom css fields of my theme and those of visual composer but both have no effect. I'm running the startuply theme by Vivaco on WordPress 4.3.1

This is the code I'm using

about1 {
  background: rgb(0, 0, 0); /* fallback color */
  background: rgba(0, 0, 0, 0.7);
}

This is what I want the text to look like - https://css-tricks.com/text-blocks-over-image/

Is there any other way I can do this?

Thanks.

Upvotes: 2

Views: 396

Answers (1)

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167220

You need to add a . before:

.about1 {
  background: rgb(0, 0, 0); /* fallback color */
  background: rgba(0, 0, 0, 0.7);
}

And give this in HTML:

<div class="about1"><!-- No dot (.) here -->

Without anything, it is for tags. Eg:

h1 {}
p {}

With a ., it is for classes:

.newClass {}
.centerText {text-align: center;}

And with a #, it is for ids:

#btnSubmit {padding: 5px;}

In HTML:

<a class="newClass">Blah</a>
<div class="newClass centerText">Blah</div>
<input id="btnSubmit" name="submit" />

Upvotes: 3

Related Questions