[Resolved] Sections remove a tags

Home Forums Support [Resolved] Sections remove a tags

Home Forums Support Sections remove a tags

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #872821
    Nikola

    When i change from visual editor to text editor in sections my “a” tags are deleted. I want to create a hover, clickable block with content inside of that block.

    Thanks in advance.

    Best regards
    Nikola

    GeneratePress 2.2.2
    #873048
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Are you trying to wrap block elements (<div> etc..) in the <a> elements? If so, that’s not valid HTML, and WordPress will strip it from your code (unfortunately).

    #873235
    Nikola

    Yes, that i want to achieve. Do you know another way?

    #873322
    David
    Staff
    Customer Support

    Hi there,

    do you have an example of what you’re trying to achieve?

    #873612
    Nikola

    Something like this.

    <a class="box" href="#">
         <div class="content">
         <h2> Text </h2>
         <p> text </p>
         <span> Learn more</span>
      </div>
    </a>

    Imagine clickable box with content inside of that box. And i want to make entire box (block) clickable, not just “Learn more” link for example.

    #873633
    David
    Staff
    Customer Support

    So instead try this:

    <div class="box">
        <h2>Text</h2>
        <p class="box-text">Text</p>
        <span class="box-span">Learn more</span>
        <a class="box-link" href="#"><!-- link --></a>
    </div>

    Then this CSS:

    .box {
        postition: relative;
        /* Add box styles here */
    }
    
    .box-link {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }

    The editor may throw in a random P tag but it should do the trick and if the span has a class and the a tag has a comment inside it won’t strip them out.

    #873712
    Nikola

    Great. It works! Thank you, David. ๐Ÿ™‚

    #873741
    David
    Staff
    Customer Support

    Awesome – glad to be of help ๐Ÿ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.