Reputation: 3464
I have an HTML component I want to reuse on several pages. For the sake of elegance, I would like to reuse the component rather than copy and paste it.
This is a tricky question, in my searches I have found this post, which simply says it is not possible in pure html. But then I also found this post, which seems like it could accomplish exactly what I want.
So, which one is right?
For reference, here is the component that I'm trying to reuse:
<div id="topbar" class="container">
<div class="test1">
<p> Style1
</div>
<div class="test2">
<p> Style2
</div>
<div id="test3">
<p> Style3
</div>
</div>
Upvotes: 0
Views: 448
Reputation: 1156
Pure html does not have the reusable component architecture, however there are several options.
<!--#include file="my fragment file name"-->
@MyStringVariable
include("my fragment file name");
Your question is one of the first of stepping into the huge world of software engineering and web development.
Upvotes: 2
Reputation: 1041
you can do this with server side languages, so if you're using PHP you can do this
include("MyMarkup.php");
or if you're using ASP , you can do this
<!--#include file="includefile.asp"-->
Upvotes: 1