A
A
Artyom2015-11-15 20:46:58
css
Artyom, 2015-11-15 20:46:58

How to insert html file into another html file?

The html code is too long, how can I load another html with a piece of code in html?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
U
Umid, 2015-11-15
@DarCKoder

iframe

A
Alexander, 2015-11-15
@zkelo

...or HTML import :
<link rel="import" href="/index.html">

A
Alexander Zachinalov, 2015-11-16
@SanDiesel

Ways to include html without using server languages:
1) Using project build systems (Gulp, Grunt, Yeoman, Brunch) in combination with html preprocessor - Jade, Haml and analogues
2) Using helpers from MVC framework libraries (React, Angular, Ember , Khockout, etc.)
3) Using js template engines separately (Mustache, Handlebars, Twigjs, Closure Templates, etc.)
4) Using templating plugins (Jquery Template, _.template utility from Underscore, Tempo, etc.)

H
Hooudini, 2021-12-15
@Houdini

This can be done with a single line of js

<div id="value" style="display: inline-block"></div>

document.getElementById('value').textContent = '<div>текст</div>';

eventually get<div>текст</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question