Reputation: 193
I am using Contact Form 7 to design a booking form for a hotel.
I can't figure out how to customize the layout. I'd like some of the text fields to be displayed on the same line but I don't find the correct identification for the elements and/or which CSS styling to use to achieve this very simple goal.
Here is the code :
<div id="responsive-form" class="clearfix">
<label> Your Name (required)
[text* your-name] </label>
<label> Your Email (required)
[email* your-email] </label>
<label> Arrival date
[date date-79 id:Arrivaldate date-format:mm/dd/yy] </label>
<label> Departure date
[date date-80 id:Departuredate date-format:mm/dd/yy] </label>
<label> How many guests?
[text your-guests] </label>
<div class="form-row">
<p>Number of adults [text your-adults]</p>
<p>Number of children under 6 years old [text your-little-children]</p>
<p>Number of children under 12 years old [text your-big-children]</p>
</div>
Select your preferred accomodation
[checkbox your-accomodation use_label_element "Wayan (Two-story villa)" "Kadek (Two-story villa)" "Nyoman (Garden bungalow)" "Kehut (Garden bungalow)" "Pasca (Garden bungalow)"]
Do you need transportation to the hotel ?
[radio your-pickup default:1 use_label_element exclusive "No transport needed" "Transport from Denpasar airport" "Transsport from Gilimanuk Ferry"]
<label> Do you want us to arrange motorbike rental for you ?
[text your-motorbikes] </label>
<label> Tell us more about what brings you to Balian
[textarea your-message] </label>
[submit "Send"]
</div>
I want to display the p elements of the form-row elements on a single line. I have tried this CSS line :
.form_row p{
display: inline-block
}
But it does not do anything. I feel I am missing something, can anybody help ?
Many thanks in advance,
Benjamin
Upvotes: 10
Views: 80988
Reputation: 23
Your code is working well for me, you just have a syntax error in your CSS. The name of your element in the HTML is form-row
but in CSS you have written form_row
. I just changed the CSS selector to form-row
and everything works as expected.
.form-row p {
display: inline-block;
}
Upvotes: 1
Reputation: 401
You can simply use HTML table structure!!!
<table>
<tr>
<td colspan="2">[text* Name placeholder "Your Name"]</td>
</tr>
<tr>
<td>[text* Class placeholder "Enter Class"]
</td>
<td>
[text* Medium placeholder "Enter Medium"]
</td>
</tr>
</table>
[submit "Submit"]
Upvotes: 7
Reputation: 1
Hope this video instruction will help you
Here is the CSS code for my contact form 7:
/* Create two equal columns that floats next to each other */
.column {
float: left;
width: 50%;
padding: 10px;
}
/* Clear floats after the columns */
.row:after {
display: table;
clear: both;
}
#knopka
{
color: #fffff;
background: #8F8CA0;
width: 90%;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
Upvotes: 0
Reputation: 2279
I have been quite frustrated with the lack of design solutions for Contact Form 7. A year ago, I was tasked with creating multiple forms in cf7, with complex layout requirements. To solve this problem I set about creating a plugin that allows for responsive grid-layout designs as well as the ability to have a modular approach to form building, ie being able to reuse existing forms into larger form constructs. I just released the Smart Grid-layout design for CF7, it gives a grid UI editor in the dashboard that allows you to build a 3 columns layout in a single row. You don't need to mess around with css, the layout will be rendered on your page. It is also responsive, to it will default to 3 rows on a mobile phone.
Give it a try and let me know what you think.
Upvotes: 1
Reputation: 21
You can use an HTML table as follows :
<table>
<tr>
<td>Number of adults [text your-adults]</td>
<td>Number of children under 6 years old [text your-little-children]</td>
<td>Number of children under 12 years old [text your-big-children]</td>
</tr>
</table>
Upvotes: 2
Reputation: 2295
You probably have a CSS rule that makes the <p>
element full-width.
Why not use <div>
and use the theme's classes?
<div class="form-row">
<div class="grid-33">Number of adults [text your-adults]</div>
<div class="grid-33">Number of children under 6 years old [text your-little-children]</div >
<div class="grid-33">Number of children under 12 years old [text your-big-children]</div>
</div>
Upvotes: 12
Reputation: 2699
You can use your theme grid to make it in two column. see below snippet
<div id="responsive-form" class="clearfix">
<div class="vc_row ">
<div class="vc_col-sm-6">
<label> Your Name (required)
[text* your-name] </label>
</div>
<div class="vc_col-sm-6">
<label> Your Email (required)
[email* your-email] </label>
</div>
</div>
<label> Arrival date
[date date-79 id:Arrivaldate date-format:mm/dd/yy] </label>
<label> Departure date
[date date-80 id:Departuredate date-format:mm/dd/yy] </label>
<label> How many guests?
[text your-guests] </label>
<div class="form-row">
<p>Number of adults [text your-adults]</p>
<p>Number of children under 6 years old [text your-little-children]</p>
<p>Number of children under 12 years old [text your-big-children]</p>
</div>
Select your preferred accomodation
[checkbox your-accomodation use_label_element "Wayan (Two-story villa)" "Kadek (Two-story villa)" "Nyoman (Garden bungalow)" "Kehut (Garden bungalow)" "Pasca (Garden bungalow)"]
Do you need transportation to the hotel ?
[radio your-pickup default:1 use_label_element exclusive "No transport needed" "Transport from Denpasar airport" "Transsport from Gilimanuk Ferry"]
<label> Do you want us to arrange motorbike rental for you ?
[text your-motorbikes] </label>
<label> Tell us more about what brings you to Balian
[textarea your-message] </label>
[submit "Send"]
</div>
Upvotes: 3