How can I assign a HTML class to an object?
Say, I am creating a CSS, e.g.:
a {
display: inline-block;
padding: 5px 15 px;
}
a:hover {
background: red;
color: white;
}
How and where can I assign a HTML class, e.g.:
Best regards,
–Mardas
How can I assign a HTML class to an object?
Say, I am creating a CSS, e.g.:
a {
display: inline-block;
padding: 5px 15 px;
}
a:hover {
background: red;
color: white;
}
How and where can I assign a HTML class, e.g.:
Best regards,
–Mardas
Hello Mardas,
Thanks for writing in!
The code that you have shared is already having class name. For ex:
This is the HTML code:
<a href="https://www.google.com" class="test">Link2</a>
Now the corresponding CSS code with class name would be:
.test{
/*add CSS code here*/
}
For more information, please take a look at following resource:
https://www.htmldog.com/guides/css/intermediate/classid/
Thanks.
Hi,
Many thanks for the explanation and resource shared. Understood so far but it is not quite working.
I am creating an object with Cornerstone and assigning CSS attributes:
.a {
display: inline-block;
padding: 5px 30px;
background: yellow;
}
This is the result:
This is the generated HTML code saying class=“x-raw-content a”
Now, I would like to assign the following in addition:
Additional class=”test”
The link=”https://www.google.com”
The last HTML code which is assigning the link and an additional class, where and how can I enter it in Cornerstone?
Best regards,
–Mardas
Hi Mardas,
There are many ways on how you could add a text wrapped in an HTML tag in Cornerstone.
An easy option is to use some elements like but not limited to the Raw Content, Text, Content Area elements.
I will include an example adding it in a Text element.


If you edit the content of the Text element, by default, you will see the content in HTML mode so you can simply add you HTML code there:

Once you saved and check it in on the site you will see:

Then you can reference the link in CSS using the test class assigned to it.
Hope this helps.
Absolutely. Many thanks!
You’re most welcome, Mardas.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.