Problem with an anchor link on content band

Hi, I have some problems with anchor links.

Since I have a fixed header I have adopted the solution to give some negative margin-top equal to an height of pseudo element ::before of element I have linked in anchor.

Example

Anchor link: https://lesgomines.it/una-giornata-a-les-gomines/#grid-195

.one-day #grid-195:before {
    display: block;
    content: " ";
    margin-top: -250px;
    height: 250px;
    visibility: hidden;
    pointer-events: none;
} 

And it works veri well.

I have made the same thing in another page and the trick doesn’t work. The problem is in the page https://lesgomines.it/stanze

I have tried on first element

Anchor link: https://lesgomines.it/stanze/#blue-room

.stanze #x-content-band-4::before {
  display: block;
  content: " ";
  margin-top: -250px;
  height: 250px;
  visibility: hidden;
  pointer-events: none;
}

But when I click on link the target page doesn0t take care of ::before rules. I have tried to pute these rules on pseudo element of several element (external div, columns), but the results is the same: doesn’t work.

Can you help me?

Thank you very much

Hello Alessandro,

Thanks for posting in!

The negative margin is applied to the content band. It will only work if you use the ID of the content band like this:

Hope this helps.

Thank you for your response. If I put https://lesgomines.it/stanze/#x-content-band-4 it takes me to content band of the same page where already I am. In this case the homepage. It doesn’t take care of page “stanze”. Infact I don’t understand this beahaviour, do you have some idea?

Thanks

I entered https://lesgomines.it/stanze/#x-content-band-4 in the browser and it opened your “stanze” and displayed the x-content-band-4 .

If you have just used the fragment only like #x-content-band-4, it won’t go to the “stanze” page. You need to use the full URL to go to the “stanze” page.

If I’m not understanding you correctly, please provide more details with screenshots.

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.