SOLVED

Can you link a div in guided landing page template?

Go to solution
kana0_0ng
Level 2

Can you link a div in guided landing page template?

Hello,

I'm trying to link a div in a guided landing page template but the text editor keeps throwing out the <a> tag when it's wrapped around a div. Is there a way around this? I'd rather not move the mktoText to the inner div and make the link a variable since I'd like the user to be able to make that dynamic. 

<div class="tile mktoText" id="fourTileRow1Col1Title" mktoName="4 Tile Row 1 Col 1 Title">
<a class="text-link " href="#" target="_blank">
<div>
<h3>Title</h3>
<p>Text</p>
</div>
</a> 
</div>
1 ACCEPTED SOLUTION

Accepted Solutions
Dave_Roberts
Level 10

Re: Can you link a div in guided landing page template?

The way I've typically seen this done is to have them be separate elements inside a relatively positioned parent element. Here's a really loose example of something like that:

<div style="position:relative;">
  <div>...some stuff in a div... </div>
  <a href="#" style="position:absolute; top:0; left:0; height:100%; width:100%; z-index:1;"></a>
</div>

The idea is to use the inner div to create the height and width and "overlay" the link atop the inner div. 

 

 

View solution in original post

5 REPLIES 5
Abhinav_saini
Level 3

Re: Can you link a div in guided landing page template?

Hi,

 

You cannot use <div> or header tags (h1, h2) inside <a> tags. You can only use inline elements like span or something inside an anchor tag. 

I'll suggest use a span tag and give styles according to header and paragraph. 

Abhinav Saini
SanfordWhiteman
Level 10 - Community Moderator

Re: Can you link a div in guided landing page template?


You cannot use <div> or header tags (h1, h2) inside <a> tags.

You can in HTML5.

kana0_0ng
Level 2

Re: Can you link a div in guided landing page template?

Right, and I already have the HTML5 doctype in the template. Guess it's just a limitation of the text editor.

Dave_Roberts
Level 10

Re: Can you link a div in guided landing page template?

The way I've typically seen this done is to have them be separate elements inside a relatively positioned parent element. Here's a really loose example of something like that:

<div style="position:relative;">
  <div>...some stuff in a div... </div>
  <a href="#" style="position:absolute; top:0; left:0; height:100%; width:100%; z-index:1;"></a>
</div>

The idea is to use the inner div to create the height and width and "overlay" the link atop the inner div. 

 

 

kana0_0ng
Level 2

Re: Can you link a div in guided landing page template?

Thank you! I had forgotten that's how it used to be done.