コピペでできる!cssとhtmlで作るContact Form 7を使ったメールフォームセット 4選

CSS HTML wordpress
 
 

wordpressのメールフォームと言ったら、Contact Form 7が有名ですね。
利用されている方も多いかと思います。
今回は、そのContact Form 7を使ったメールフォームのテンプレートをご紹介します。

Contact Form 7側(フォーム内の部分)の設定はいずれも下記になります。

<div class="cp_cf7name">[text* cp_name placeholder "name"]</div>
<div class="cp_cf7email">[email* cp_email placeholder "email"]</div>
<div class="cp_cf7telephone">[tel cp_telephone placeholder "telephone"]</div>
<div class="cp_cf7subject">[select cp_subject first_as_label "Please select" "subject1" "subject2" "subject3"]</div>
<div class="cp_cf7textarea">[textarea cp_textarea placeholder "textarea"]</div>
<div class="cp_cf7submit">[submit "submit"]</div>

*フォームはデモモードになっていますので送信はされませんが、エラーのチェックは可能です。
*サンプルの必須項目は「Name」と「email」です。

インストールや基本的な使い方については、下記をご参照ください。

Contact Form 7のインストールについて

Contact Form 7の使い方

browser:  65 11 20 

Contact Form 7を使ったメールフォームセット[4種]

シンプルなメールフォーム

ニャン易度
<div class="cp_cont">
<h1>MAIL FORM</h1>
[contact-form-7 id="####" title="####"]
</div>
*, *::before, *::after { -webkit-box-sizing: border-box; box-sizing: border-box; }
.cp_cont {
	width: 90vw;
	max-width: calc(640px - 10px);
	margin: 3em auto 10em auto;
	padding: 16px;
	background: #F2F3EB;
	border: 1px solid #424242;
	box-shadow: #F2F3EB 0px 0px 0px 10px;
}
input[type='text'],
input[type='tel'],
input[type='email'],
textarea,
select {
	vertical-align: top; -webkit-appearance: none; appearance: none;-moz-appearance: none;
	width: 100%; height: 2em;
	padding-left: 0.4em; border: none; border-radius: 0;
	color:#757575;
	background: #F2F3EB;
	font-size: 1em;

}
input[type='text']:focus,
input[type='tel']:focus,
input[type='email']:focus,
textarea:focus,
select:focus {
	outline: none;
}
textarea {
	height: 10em; min-height: 2em;
	resize: none;
}
input[type='text']::placeholder,
input[type='tel']::placeholder,
input[type='email']::placeholder,
textarea::placeholder,
select {
	text-transform: uppercase;
}
input[type='submit'],
input[type='button'],
button {
	cursor: pointer;
	color:#757575;
	background: #F2F3EB;
	border:1px solid #424242;
	padding: 1em 2em;
	transition: all 0.3s;
	text-transform: uppercase;
}
input[type='submit']:hover,
input[type='button']:hover,
button:hover {
	color:#ffffff;
	background: #424242;
}
.cp_cf7name,
.cp_cf7email,
.cp_cf7telephone,
.cp_cf7subject,
.cp_cf7textarea {
	margin: 0 0 2em 0;
}
.cp_cf7name {
	float: left;
	width: 48%;
}
.cp_cf7email {
	float: right;
	width: 48%;
}
.cp_cf7telephone {}
.cp_cf7subject {
	position: relative;
}
.cp_cf7textarea {}
.cp_cf7submit {
	margin: 0 auto;
	text-align: center;
}
.cp_cf7name::after,
.cp_cf7email::after,
.cp_cf7telephone::after,
.cp_cf7subject::after,
.cp_cf7textarea:after {
	display: block;
	width: 100%;
	height: 4px;
	margin-top: -1px;
	content: '';
	border-width: 0 1px 1px 1px;
	border-style: solid;
	border-color: #424242;
}
.cp_cf7subject::before {
	position: absolute;
	top: 0.8em;
	right: 0.2em;
	width: 0;
	height: 0;
	padding: 0;
	content: '';
	border-style: solid;
	border-width: 6px 6px 0 6px;
	border-color: #666666 transparent transparent transparent;
	pointer-events: none;
	z-index: 1;
}
.cp_cont h1 {
	text-align: center;
	margin: 0 auto 2em auto;
	color: #424242;
	position: relative;
	width: 10em;
}
.cp_cont h1::before,
.cp_cont h1::after {
	position: absolute;
	content: '●';
	font-size: 0.3em;
	top: 1.6em;
}
.cp_cont h1::before {
	left: 2em;
}
.cp_cont h1::after {
	right: 2em;
}

シンプルなメールフォーム2

ニャン易度
<div class="cp_cont">
<h1>MAIL FORM</h1>
[contact-form-7 id="####" title="####"]
</div>
*, *::before, *::after { -webkit-box-sizing: border-box; box-sizing: border-box; }
.cp_cont {
	width: 90vw;
	max-width: calc(640px - 10px);
	margin: 3em auto;
	padding: 16px;
	background: #B2DFDB;
}
input[type='text'],
input[type='tel'],
input[type='email'],
textarea,
select,
input[type='submit'],
input[type='button'],
button {
	vertical-align: top; -webkit-appearance: none; appearance: none;-moz-appearance: none;
	width: 100%;
	height: 3em;
	padding-left: 0.4em;
	border: none;
	border-radius: 0;
	color:#757575;
	background: #B2DFDB;
	font-size: 1em;
	transition: all 0.3s;
	text-transform: uppercase;
}
input[type='submit'],
input[type='button'],
button {
	cursor: pointer;
	padding: 1em 2em;
	border-style: solid;
	border-width: 1px;
	border-color: #00796B;
}
input[type='text']:focus,
input[type='tel']:focus,
input[type='email']:focus,
textarea:focus,
select:focus,
input[type='submit']:focus,
input[type='button']:focus,
button:focus {
	outline: none;
}
input[type='text']:hover,
input[type='tel']:hover,
input[type='email']:hover,
textarea:hover,
select:hover,
input[type='submit']:hover,
input[type='button']:hover,
button:hover {
	color:#ffffff;
	background: #00796B;
}
textarea {
	height: 10em; min-height: 2em;
	resize: none;
}
input[type='text']::placeholder,
input[type='tel']::placeholder,
input[type='email']::placeholder,
textarea::placeholder,
select {
	text-transform: uppercase;
}
input[type='text']:hover::placeholder,
input[type='tel']:hover::placeholder,
input[type='email']:hover::placeholder,
textarea:hover::placeholder {
	color:#ffffff;
}
.cp_cf7name,
.cp_cf7email,
.cp_cf7telephone,
.cp_cf7subject,
.cp_cf7textarea {
	margin: 0 0 0 0;
	border-style: solid;
	border-width: 1px 1px 0 1px;
	border-color: #00796B;
	position: relative;
}
.cp_cf7name::after,
.cp_cf7email::after,
.cp_cf7telephone::after,
.cp_cf7subject::after,
.cp_cf7textarea:after {
}
.cp_cf7subject::before {
	position: absolute;
	top: 1.5em;
	right: 0.7em;
	width: 0;
	height: 0;
	padding: 0;
	content: '';
	border-style: solid;
	border-width: 6px 6px 0 6px;
	border-color: #00796B transparent transparent transparent;
	pointer-events: none;
	z-index: 1;
}
.cp_cf7subject:hover::before {
	border-color: #ffffff transparent transparent transparent;
}
.cp_cont h1 {
	text-align: center;
	margin: 0 auto 1em auto;
	color: #00796B;
	position: relative;
	width: 10em;
}

プロフィールカード付きのメールフォーム

ニャン易度
<div class="cp_cont">
<div class="cp_photo">
<h1>MAIL FORM</h1>
<h2>Name</h2>
<p>Profile Comment</p>
<ul>
<li><a href="#"><i class="fa fa-facebook fa fa-fw"></i></a></li>
<li><a href="#"><i class="fa fa-twitter fa fa-fw"></i></a></li>
<li><a href="#"><i class="fa fa-google-plus fa fa-fw"></i></a></li>
<li><a href="#"><i class="fa fa-instagram fa fa-fw"></i></a></li>
</ul>
</div>
<div class="cp_form">
[contact-form-7 id="####" title="####"]
</div>
</div>
*, *::before, *::after { -webkit-box-sizing: border-box; box-sizing: border-box; }
.cp_cont {
	width: 90vw;
	max-width: calc(790px - 10px);
	margin: 3em auto;
	display: flex;
	flex-flow: row nowrap;
	align-items: center;
	justify-content: center;
}
.cp_photo {
	background: url('image.jpg');
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center;
	height: 590px;
	width: 45%;
	border-radius: 6px;
	color: #ffffff;
	position: relative;
	box-shadow:rgba(0,0,0,0.1) -1px 0px 2px 1px;
}
.cp_form {
	border-radius: 0 6px 6px 0;
	padding: 16px;
	box-shadow:rgba(0,0,0,0.1) 1px 0px 1px 1px;
	width: 55%;
}
input[type='text'],
input[type='tel'],
input[type='email'],
textarea,
select {
	vertical-align: top; -webkit-appearance: none; appearance: none;-moz-appearance: none;
	width: 100%;
	height: 3em;
	padding-left: 0.4em;
	border: none;
	border-radius: 0;
	color:#757575;
	font-size: 1em;
	transition: all 0.3s;
	text-transform: uppercase;
	background: #ffffff;
	border-style: solid;
	border-width: 0 0 2px 0;
	border-color: #FCE4EC;
}
input[type='submit'],
input[type='button'],
button {
	border: none;
	color:#ffffff;
	background: #F48FB1;
	cursor: pointer;
	padding: 1em 2em;
	margin-top: 1em;
	border-radius: 6px;
	transition: all 0.3s;
}
input[type='text']:focus,
input[type='tel']:focus,
input[type='email']:focus,
textarea:focus,
select:focus {
	border-style: solid;
	border-width: 0 0 2px 0;
	border-color: #EC407A;

	outline: none;
}
input[type='text']:hover,
input[type='tel']:hover,
input[type='email']:hover,
textarea:hover,
select:hover {
	background: #FCE4EC;
}
input[type='submit']:hover,
input[type='button']:hover,
button:hover {
	background: #EC407A;
}
textarea {
	height: 10em; min-height: 2em;
	resize: none;
}
input[type='text']::placeholder,
input[type='tel']::placeholder,
input[type='email']::placeholder,
textarea::placeholder,
select {
	text-transform: uppercase;
}
input[type='text']:hover::placeholder,
input[type='tel']:hover::placeholder,
input[type='email']:hover::placeholder,
textarea:hover::placeholder {
}
.cp_cf7name,
.cp_cf7email,
.cp_cf7telephone,
.cp_cf7subject,
.cp_cf7textarea,
.cp_cf7submit {
	margin: 0 0 0 0;
	position: relative;
}
.cp_cf7submit {
	border-width: 0;
	text-align: center;
}
.cp_cf7name::after,
.cp_cf7email::after,
.cp_cf7telephone::after,
.cp_cf7subject::after,
.cp_cf7textarea:after {
}
.cp_cf7subject::before {
	position: absolute;
	top: 1.5em;
	right: 0.7em;
	width: 0;
	height: 0;
	padding: 0;
	content: '';
	border-style: solid;
	border-width: 6px 6px 0 6px;
	border-color: #F48FB1 transparent transparent transparent;
	pointer-events: none;
	z-index: 1;
}
.cp_cf7subject:hover::before {
	border-color: #EC407A transparent transparent transparent;
}
.cp_photo h1 {
	text-align: center;
	margin: 1em auto 0.5em auto;
	position: relative;
	width: 10em;
}
.cp_photo h2 {
	margin: 0 0 0.5em 0;
	padding: 0;
	padding-left: 2em;
	position: relative;
}
.cp_photo h2::before {
	font-family: Fontawesome;
	position: absolute;
	content: '\f007';
	top: 5px;
	left: 0.7em;
}
.cp_photo p {
	margin: 0;
	padding: 0;
	padding-left: 1em;
	position: relative;
}
.cp_photo ul {
	list-style: none;
	position: absolute;
	bottom:1em;
	left: 0;
	margin: 0;
	padding: 1em 1em 0 1em;
}
.cp_photo ul li {
	display: inline;
}
.cp_photo ul li a {
	transition: all 0.3s;
	color: #ffffff;
}
.cp_photo ul li a:hover {
	color: #F06292;
}
@media all and (max-width:480px) {
	.cp_cont {
		display: block;
		height: auto;
		border-radius: 6px;
		box-shadow:rgba(0,0,0,0.1) 0px 1px 1px 1px;
	}
	.cp_photo {
		border-radius: 6px 6px 0 0;
		width: 100%;
		height: 260px;
		box-shadow:none;
	}
	.cp_form {
		border-radius: 0;
		width: 100%;
		box-shadow:none;
	}
}

プロフィールカード付きのメールフォーム2

ニャン易度
<div class="cp_cont">
<div class="cp_photo">
<h1>MAIL FORM</h1>
<h2>Name</h2>
<p>Profile Comment</p>
<ul>
<li><a href="#"><i class="fa fa-facebook fa fa-fw"></i></a></li>
<li><a href="#"><i class="fa fa-twitter fa fa-fw"></i></a></li>
<li><a href="#"><i class="fa fa-google-plus fa fa-fw"></i></a></li>
<li><a href="#"><i class="fa fa-instagram fa fa-fw"></i></a></li>
</ul>
<div class="cp_circle"></div>
</div>
<div class="cp_form">
[contact-form-7 id="####" title="####"]
</div>
</div>
/*ALERT----------------------------------------------*/
span.wpcf7-not-valid-tip {
    display: inline-block;
    position: absolute;
    top: 0.7em;
    left: 9em;
    width: 14em;
    z-index: 2;
}
div.wpcf7-response-output {
    margin: 0.5em 0em 0em;
    padding: 0;
    font-size: 0.8em;
    border: none;
    color: #f00;
    text-align: center;
}
div.wpcf7-validation-errors, div.wpcf7-acceptance-missing {
    border: none;
}
@media all and (max-width:480px) {
	span.wpcf7-not-valid-tip {
		font-size:0.8em;
	}
}
/*----------------------------------------------ALERT*/
/*LAYOUT---------------------------------------------*/
*, *::before, *::after { -webkit-box-sizing: border-box; box-sizing: border-box; }
.cp_cont {
	width: 90vw;
	max-width: calc(790px - 10px);
	height: 500px;
	margin: 3em auto 6em;
	display: flex;
	flex-flow: row nowrap;
	align-items: center;
	justify-content: center;
	box-shadow:rgba(0,0,0,0.1) 0px 1px 1px 1px;
	border-radius: 6px;
}
.cp_photo {
	border-radius: 6px 0 0 6px;
	height: 100%;
	width: 45%;
	color: #ffffff;
	position: relative;
	overflow: hidden;
}
.cp_circle {
	position: absolute;
	top: 0;
	left: 0;
	height: 200%;
	width: 200%;
	background: url('https://copypet.jp/contents/wp-content/uploads/sample6.jpg');
	background-repeat: no-repeat;
	background-size: cover;
	background-position: left 110px;
	border-radius: 50%;
	-webkit-transform: translateX(-50%) translateY(-25%);
	transform: translateX(-50%) translateY(-25%);
	z-index: -1;
}

.cp_form {
	height: 100%;
	width: 55%;
	padding: 16px;
}
input[type='text'],
input[type='tel'],
input[type='email'],
textarea,
select {
	vertical-align: top; -webkit-appearance: none; appearance: none;-moz-appearance: none;
	width: 100%;
	height: 3em;
	padding-left: 0.4em;
	border: none;
	color:#757575;
	font-size: 1em;
	transition: all 0.3s;
	text-transform: uppercase;
	background: #ffffff;
	border-style: dashed;
	border-width: 0 0 2px 0;
	border-color: #FFECB3;
	border-radius: 6px;
	margin-bottom: 0.5em;
}
input[type='submit'],
input[type='button'],
button {
	border: none;
	color:#ffffff;
	background: #FF8F00;
	cursor: pointer;
	padding: 1em 2em;
	margin-top: 1em;
	border-radius: 6px;
	transition: all 0.3s;
	text-transform: uppercase;
	font-size: 0.8em;
}
input[type='text']:focus,
input[type='tel']:focus,
input[type='email']:focus,
textarea:focus,
select:focus,
input[type='submit']:focus,
input[type='button']:focus,
button:focus {
	border-style: solid;
	border-width: 0 0 2px 0;
	border-color: #FF8F00;
	background: #FFECB3;

	outline: none;
}
input[type='text']:hover,
input[type='tel']:hover,
input[type='email']:hover,
textarea:hover,
select:hover {
	background: #FFECB3;
}
input[type='submit']:hover,
input[type='button']:hover,
button:hover {
	background: #FFECB3;
	color: #757575;
}
textarea {
	height: 10em; min-height: 2em;
	resize: none;
}
input[type='text']::placeholder,
input[type='tel']::placeholder,
input[type='email']::placeholder,
textarea::placeholder,
select {
	text-transform: uppercase;
}
input[type='text']:hover::placeholder,
input[type='tel']:hover::placeholder,
input[type='email']:hover::placeholder,
textarea:hover::placeholder {
}
.cp_cf7name,
.cp_cf7email,
.cp_cf7telephone,
.cp_cf7subject,
.cp_cf7textarea,
.cp_cf7submit {
	margin: 0 0 0 0;
	position: relative;
}
.cp_cf7submit {
	border-width: 0;
	text-align: center;
}
.cp_cf7name::after,
.cp_cf7email::after,
.cp_cf7telephone::after,
.cp_cf7subject::after,
.cp_cf7textarea:after {
}
.cp_cf7subject::before {
	position: absolute;
	top: 1.5em;
	right: 0.7em;
	width: 0;
	height: 0;
	padding: 0;
	content: '';
	border-style: solid;
	border-width: 6px 6px 0 6px;
	border-color: #FF8F00 transparent transparent transparent;
	pointer-events: none;
	z-index: 1;
}
.cp_cf7subject:hover::before {
	border-color: #FF8F00 transparent transparent transparent;
}
.cp_photo h1 {
	margin: 1em 0 0.5em 0;
	padding-left: 0.5em;
	position: relative;
	width: 10em;
}
.cp_photo h2 {
	margin: 0 0 0.5em 0;
	padding: 0;
	padding-left: 2em;
	position: relative;
}
.cp_photo h2::before {
	font-family: Fontawesome;
	position: absolute;
	content: '\f007';
	top: 5px;
	left: 0.7em;
}
.cp_photo p {
	margin: 0;
	padding: 0;
	padding-left: 1em;
	position: relative;
}
.cp_photo ul {
	list-style: none;
	position: absolute;
	bottom:1em;
	left: 0;
	margin: 0;
	padding: 1em 1em 0 1em;
}
.cp_photo ul li {
	display: inline;
}
.cp_photo ul li a {
	transition: all 0.3s;
	color: #ffffff;
}
.cp_photo ul li a:hover {
	color: #FF8F00;
}
@media all and (max-width:480px) {
	.cp_cont {
		display: block;
		height: auto;
	}
	.cp_photo {
		border-radius: inherit;
		width: 100%;
		height: 260px;
	}
	.cp_circle {
		width: 320%;
		top:-130px;
		left: 50%;
		background-size: contain;
		background-position: 250px 200px;
	}
	.cp_form {
		width: 100%;
	}
}
/*---------------------------------------------LAYOUT*/

copypet.jp

CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。

More Info

こんな記事はいかがですか?