Archived topic
Adding Additional CSS class(es) and Custom Attributes
5 replies · Started by Marcel on August 16, 2022
Hello,
I know how to add additional CSS classes and custom attributes to a container, but I would like to add both additional CSS class(es) and custom attributes to a single word or group of words within a headline (paragraph). Is it possible?
Thank you!
Hi there,
your simplest option is to use a HTML block. And to write the HTML with the class and attributes.
The alternative is to use a PHP Snippet to string replace some of the content with your new HTML. But that depends on what the HTML looks like.
Do you have an example of what HTML should be output ?
Hello David,
I put the address of the experiment I want to do in the private information area. The experiment is based on a tutorial seen on YouTube.
As you can see there, I have three tabs: Events, Groups and Future. You are presented with different content (images) if you click each tab.
Instead of the three tabs, I would like to use the following paragraph: "If you like these kinds of events, join one of our groups to benefit from the member-specific advantages in the future."
By clicking on "events", "groups", or "future", I would like to get the same result as when you click on tabs, that is, to be able to view the specific content of each tab.
'Events" tab has:
- HTML Anchor: tab-1;
- Additional CSS class: activeTab;
- Custom Attribute: data-attribute: data-tab and value:1
Please give me an example of how I could write these in a HTML block.
Thank you a lot!
So you could try wrapping each word in a span tag to add the attributes to eg.
<div class="your-class">If you like these kinds of <span id="tab-1" class="active-class" data-tab="1">events</span>, join one of our <span id="tab-2" class="" data-tab="2">groups</span> to benefit from the member-specific advantages in the <span id="tab-3" class="" data-tab="3">future</span></div>
Thank you, David!
I have made a small donation to show appreciation for your excellent customer support.
All the best,
Marcel
Thats really kind of you ! Its much appreciated.