I have created a link rendering variant and put in css class of "btn login-button"

enter image description here

However in my markup where the link is using that rendering variant this does not appear

<div class="component link member-hub col-12">
    <div class="component-content">
        <a href="/Articles" data-variantfieldname="Link" data-variantitemid="{B7229055-B046-47D3-AAC4-6EA4815F2696}">Login</a>    

The only way I have gotten it to appear on the anchor is when inserting the link, adding a class explicitly to the link. I don't want to rely on the content editors doing this though.

<div class="component link col-12">
    <div class="component-content">
      <div class="field-link">
        <a class="btn login-button" href="/ract" data-variantfieldname="Link" data-variantitemid="{33E5529D-270D-4738-9DCB-96DDB34EC23B}">Another</a>

Why is my link field Css Class not appearing? I have explicitly published to ensure that the markup isn't showing EE related markup.

Update: we are trying to use the bootstrap button styling of the link which is why I was trying to put it on the anchor element.

  • 1
    Am I right that Tag field on your variant definition item is empty? If you set it to div link will be wrapped with additional div with expected classes: btn login-button and field-link. This is how it works right now. Commented Feb 6, 2019 at 6:58
  • @AlanPłócieniak I was trying to put the classes on the anchor rather than on a containing div - but good to know thanks!
    – Jen
    Commented Feb 6, 2019 at 21:39
  • @AlanPłócieniak I'm not sure the bootstrap styling will then apply to my link? Or do I have to clone this rendering to override this behaviour?
    – Jen
    Commented Feb 7, 2019 at 4:56
  • CSS class on a parent element is not a problem in styling world. I would update CSS selector instead Commented Feb 7, 2019 at 7:31
  • Try to add class into data attributes section - add as "class" and {class name} approptiately - it works for me.
    – Tery
    Commented Nov 29, 2019 at 21:46

1 Answer 1


I have faced similar problems. This is how I tried to resolve it.

We have a checkbox for Is Link. So if you use it, we can use the data attributes and CSS class accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.