How can I put a specific font to an input text?

0

I would like you to tell me the whole code of a HTML empty web page that only contains an input text element where you can type in a specific font such as Comic Sans MS

I tried like this but it did not work:

<html>
<head>
</head>
<body>
  <input type="text" font-family="helvetica">
</body>
</html>

Thank you very much

    
asked by NotNu 08.03.2018 в 00:04
source

2 answers

0

you can use CSS

HTML

<body>
  <input type="text" class="input1">
</body>

CSS

.input1 { 
   font-size: 24px; 
   font-family: monospace; //aqui estableces el tipo de fuente
}
    
answered by 08.03.2018 в 00:07
0

What you have done is put font-family as an HTML attribute, which is not correct. To modify the source of an html element, you need to use CSS .

Here's the example:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		input {
			font-family: helvetica;
		}
	</style>
</head>
<body>
	<input type="text">
</body>
</html>

Any questions, leave a comment.

    
answered by 08.03.2018 в 00:07