The right solution I think is for Anki to support shared template snippets {{SnippetA}}, {{SnippetB}} etc but for now here’s a hack:
Front:
<div class="front">
Here is the top of the front.
<div class="shared-content">
Here is the shared content.
</div>
Here is the bottom of the front.
</div>
Back:
<div class="back">
Here is the top of the back.
{{FrontSide}}
Here is the bottom of the back.
</div>
If you want to go that route then you probably should use this instead
Front:
<div class="hidden-content">
Here is the top of the front.
</div>
Here is the shared content.
<div class="hidden-content">
Here is the bottom of the front.
</div>
Back:
Here is the top of the back.
<div class="back">{{FrontSide}}</div>
Here is the bottom of the back.
Styling:
.back .hidden-content {
display: none;
}
Or you can use custom tags like <hidden></hidden> if writing <div class="hidden-content"> is too much for you.