Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Splitting a large HTML file into two or more HTML files without JavaScript
Parent
Splitting a large HTML file into two or more HTML files without JavaScript
I am developing a modular HTML-PHP-CSS no-JavaScript (JavaScriptless) contact form and the HTML is becoming increasingly large, around 80 lines (and could easily grow to be significantly larger as to say 160 lines), many of which are currently very broad (due to many HTML attributes and nesting) and require horizontal scrolling to edit, which is uncomfortable and raises the chance for typos which could break the code.
Is there a way to split the HTML file into several HTML files without JavaScript and without PHP (an HTML-only soulution)?
Post
You can not do it with HTML only. In the past there was HTML Imports
, but it is Obsolete since Chrome 73 according to MDN and deprecated in Chrome 80.
You might want to use iFrame
.
However I have seen iFrame is miss used as well. It should be never used as an integral part of your site, but as a piece of content within your site.
Since you have access to backend as PHP, You might implement HTML file via Include
Or via Require
.
Or you might want to use JavaScript Solution to add your HTML file.
Programmer Side Note: as @manassehkatz mentioned. 80 lines of code is not a big project. so, Good Luck and Happy Coding!
3 comment threads