Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

How to align form fields and buttons together

Started by Muut Archive 10 years ago · 2 replies · 749 views
10 years ago

I'm using the Antimatter theme. in a page I have defined a standard form with a name and a email field as in the example page. I modified the standard default.html.twig file to look like this:
{% extends 'partials/base.html.twig' %}
{% block content %}
{{ page.summary }}
<table>
<tr >
<td align="center">
{% include "forms/form.html.twig" with { form: forms('contact-form') } %}
</td>
</tr>
</table>
<br><br>
{{ page.content|slice(page.summary|length) }}
{% endblock %}
This happens:
The two fields and their labels get centered but the Submit and Rest buttons are still left alingned. How come?

10 years ago

The alignment is related to CSS. Do you have a live site I can see to be able to point you in the right direction?

10 years ago

Dear rhukster. Thank you. I seemed to have missed the yaml-file user/config/plugins/custom-css.yaml with the following content:
enabled: true
css_inline: ".input[type="text"] {\r
width: 50%;}\r
input[type="email"]{\r
width:50%;\r
}\r
\r
button {\r
float:center;}"
Unfortunately I can't remember having set this up. Maybe it is set-up by the admin panel. I don't know. Anyway, this solved my problem.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1360 9 years ago
Archive · by Muut Archive, 9 years ago
2 938 9 years ago
Archive · by Muut Archive, 9 years ago
2 4068 9 years ago
Archive · by Muut Archive, 9 years ago
1 2958 9 years ago
Archive · by Muut Archive, 9 years ago
3 1122 9 years ago