Read a txt file and apply a font

0

I'm trying to do with HTML and CSS, a code that allows me to read a txt file, extract the text that is stored there, and then put it on the web page with a font, and I can not. I'm not an advanced programmer, I'm just the base.

<style type="text/css">
	@font-face {
		font-family: "Montserrat";
		src: url(https://fonts.googleapis.com/css?family=Montserrat:400,700) format("truetype");
	}
	p.montserrat { 
		font-family: "Montserrat", Verdana, Tahoma;
	}
</style>

<div class="montserrat" style="overflow: hidden; float: left;">
	<object type="text/plain" data="sub.txt" width="400" height="300"></object>
</div>
    
asked by Enzo Giova 05.07.2018 в 19:22
source

2 answers

0

For that, it is not enough to use HTML or JavaScript in the best case. You should use PHP. The include function () of php will help you, here I leave you how it works link

    
answered by 05.07.2018 / 19:40
source
0

As you said you must use some language so you can read a txt file could be PHP

<?php

$ file = fopen ("1.txt", "r") or exit ("Unable to open file!"); // Output a line of the file until the end is reached while (! feof ($ file)) { echo fgets ($ file). "
"; } fclose ($ file); ? >

WHERE fgets ($ file) IS THE TEXT OF 1.txt that you can put anywhere on your page.

    
answered by 05.07.2018 в 19:49