Refactor CSS, small style updates

This commit is contained in:
Alexey Yerin 2021-01-18 21:59:14 +03:00
parent 03cb53d0a3
commit 9c754f8fea
2 changed files with 41 additions and 30 deletions

View File

@ -6,43 +6,42 @@ body {
text-align: center; text-align: center;
} }
.form { .main-section {
display: flex;
flex-direction: column;
max-width: 90rem; max-width: 90rem;
margin: 5px auto; margin: 5px auto;
} }
.form__item { .form {
margin: 4px; display: flex;
flex-direction: column;
font-size: 1.2rem;
} }
.form__field { .form__field {
display: flex; display: flex;
align-items: center; align-items: center;
margin: 4px;
} }
.form__input { .form__field .form__label {
margin-right: 8px;
}
.form__input,
.textarea,
.translation {
font-size: 1rem;
padding: 4px; padding: 4px;
font-size: 1.1rem;
}
.form__field .form__input {
margin-left: 8px;
} }
.form__button { .form__button {
padding: 5px; padding: 4px 10px;
} }
.textarea { .textarea {
resize: vertical; resize: vertical;
} height: 5rem;
.textarea, .translation { /* Stretch to form width */
font-size: 1.2rem width: 100%;
} }

View File

@ -10,21 +10,33 @@
<body> <body>
<h1 class="title">Translate</h1> <h1 class="title">Translate</h1>
<section class="main-section">
<form action="/" method="POST" class="form"> <form action="/" method="POST" class="form">
<label class="form__item form__field"> <div class="form__field">
Source language: <input class="form__input" name="from" placeholder="en,de" value="{{.From}}"> <label for="from" class="item form__label">
Source language:
</label> </label>
<input class="form__input" name="from" placeholder="en,de" value="{{.From}}">
</div>
<label class="form__item form__field"> <div class="form__field">
Translate to: <input class="form__input" name="to" placeholder="fr,ru" value="{{.To}}"> <label for="to" class="item form__label">
Translate to:
</label> </label>
<input class="form__input" name="to" placeholder="fr,ru" value="{{.To}}">
</div>
<textarea name="text" class="form__item form__input textarea" placeholder="Text to translate">{{.Text}}</textarea> <div class="form__field">
<textarea name="text" class="textarea" placeholder="Text to translate">{{.Text}}</textarea>
</div>
<button type="submit" class="form__item form__button">Translate!</button> <div class="form__field">
<button type="submit" class="form__button">Translate!</button>
<pre class="form__item translation">{{.Translation}}</pre> </div>
</form> </form>
<pre class="translation">{{.Translation}}</pre>
</section>
</body> </body>
</html> </html>
{{end}} {{end}}