Aha, ok - that's a pretty common thing to do, although there are a few steps involved because what you're describing needs to be split between the browser (front end) and a web server (back end).
The short answer is that you probably wouldn't actually write "pure" HTML, and instead you'd use a web app framework on your server, to automatically generate some HTML using Python, and do a lot of heavy lifting with the web app framework. (but of course, the browser wouldn't see any Python, it would only see pure HTML)
Firstly, remember that HTML and CSS are "front end" languages used for the browser. Python is a "back end" language which can be used to build a web service, and it can very easily auto-generate HTML if you use one of its web frameworks, such as
Flask or
Django.
There's a good tutorial which starts out by doing exactly the thing you're talking about here, using Flask:
https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-worldFlask uses a hybrid-language called
Jinja to auto-generate HTML pages (this doesn't actually solve your login page problem on its own, it's just a piece of the puzzle)
Jinga is the "glue" which auto-generates HTML pages from Python using 'templates' - a Jinja template is just a way of having a server auto-generate HTML instead of writing plain old html pages for yourself -- realistically speaking web developers very rarely write "static" .html pages these days because web servers like Flask and hybrid languages like Jinga are a lot more flexible and powerful for making web apps compared with plain HTML. The reason for using Jinga is that it gives you all the tools you need for using Python to create a fully-blown web app which serves up HTML to the browser.
So, Jinga can help you create the HTML form, which a browser can use to send login data back to Flask (python), but then after that you also need Flask to be able to receive the username/password, and "do something" (e.g. look up in a database), eventually sending something back to the web browser, depending on whether the user had a valid login or not.
Using your login form as an example, it would work something like this:
1) The web browser navigates to a Flask app's "GET" URL for a login page - e.g.
http://example.com/login/ (the browser sends an HTTP-GET request)
2) Flask receives the HTTP-GET request from the web browser and passes it into some Python code
3) The Python code uses a Jinja template to automatically generate some HTML
4) the Python code (using Flask) sends the generated HTML back to the web browser in an HTTP-OK response
5) The web browser receives the HTTP-OK response, containing the HTML, and displays the HTML
6) user clicks a
<button type="submit"> on the HTML page within the login
<form>.
7) the web browser sends an HTTP-POST request to to the Flask app's login URL (e.g.
http://example.com/do_login/ ) -- the HTTP-POST contains all the
<input> data from the
<form> (this is standard web browser Form behaviour, you don't need to worry about this!)8) Flask receives the HTTP-Post request from the web browser and passes it into some Python code
9) The python code does something with the username and password - e.g. calling into a database to validate the name/password
10) The python code (using flask) sends an HTTP-REDIRECT response
11) the web browser receives the HTTP-REDIRECT response, and then loads a page for the logged-in user.
Don't worry if that sounds like a lot - this is just how the web works (lots of request and response messages to/from the server) - the code to write it is probably simpler than the way I've explained it here. I'd strongly recommend following the first few lessons in the flask tutorial I've linked above - it should all make more sense once you see it working.
Also, the total amount of code you need to actually get this working is barely anything because Flask actually does most of this heavy lifting.