If you want to center the whole container (like the form), but keep the text left-aligned, you have to give the container a max-width of (for example) 70% and margin: 0 auto.
By the way, your CSS selectors have some errors, you’re trying to target .form and .ul, but those elements don’t have a class, so you don’t need the dot. Currently those selectors don’t do anything on the page.
Does this what you expect?
form {
max-width:70%;
margin:0 auto;
text-align:left;
font-size: 20px;
}
ul {
text-align:left;
font-size: 20px;
}
That doesn’t really do anything, but yes that’s invalid HTML. In codepen, you don’t enter <html> or <body> tags, codepen does it for you behind the scenes, so maybe those tags just get ignored. Or it gets auto-corrected by the browser. In any case, running the HTML through a validator is a good idea.