React组件:- 这是react组件,具有该表单中的表单i具有固定宽度为100%的文本区域
import React from 'react'
import '../../Components/utilities.css'
import './Form.css'
export default function Form() {
return (
<div className='container-form card'>
<h2>Request a Demo</h2>
<form action="https://formsubmit.co/ccf63a53d8e3631e23be6f390b5c9d9d" method="POST" name="contact" >
<input type="text" name="_honey" style={{display:'none'}}/>
<input type="hidden" name="_captcha" value="false"/>
<input type="hidden" name="_next" value="http://127.0.0.1:5500/index.html"/>
<div className="form-control">
<input type="text" name="name" placeholder="Full Name" required/>
</div>
<div className="form-control">
<input type="email" name="email" placeholder="Email" required id="email"/>
</div>
<div className="form-control">
<input type="tel" name="number" placeholder="Mobile Number" required/>
</div>
<div className="form-control">
<input type="text" name="country code" placeholder="Country Code" required/>
</div>
<div className="form-control">
<input type="text" name="tenative budget" placeholder="Tenative Budget" required/>
</div>
<div className="form-control">
<input type="text" name="company" placeholder="Company Name" required/>
</div>
<div className="form-control">
<textarea type='text' name="" className="description"
placeholder='Please explain what kind of web application do you want to build.'
/>
</div>
<input type="submit" value="Send" className="btn btn-primary" ></input>
</form>
</div>
)
}
字符串
这是CSS:-
.container-form{
position: relative;
top: 60px;
right: -60rem;
height: 600px;
width: 400px;
padding: 40px;
z-index: 100;
overflow: hidden;
}
.container-form h2{
font-size: 300;
font-weight: bold;
margin: auto;
}
.container-form .form-control {
margin: 30px 0;
}
.container-form input[type="text"],
.container-form input[type="email"],
.container-form input[type="tel"]
{
border: 0;
border-bottom: 1px solid #b4b3cb;
width: 100%;
padding: 3px;
font-size: 16px;
}
.container-form textarea[type='text']{
border: 1px solid #b4b3cb;
width: 100%;
max-width: 100%;
min-width: 100%;
padding: 3px;
font-size: 16px;
height: 8rem;
font-family: Arial, Helvetica, sans-serif;
}
.container-form input:focus {
outline: none;
}
型
实用CSS:-
:root{
--text: #010304;
--background: #eaf3fa;
--primary: #2b73b6;
--secondary: #d6e6f5;
--accent: #3082cf;
--white: #fff;
}
/* Utilities */
.container{
max-width: 1100px;
margin: 0 auto;
overflow: auto;
padding: 0 40px;
}
.container-form{
max-width: 600px;
margin: 0 auto;
padding: 0 40px;
}
.card{
background-color: #fff;
color: #333;
border-radius: 10px;
box-shadow: 0 3px 10px rgba(0,0,0, 0.2);
padding: 20px;
margin: 10px;
}
.btn{
display: inline-block;
padding: 10px 30px;
cursor: pointer;
background-color: var(--primary);
color: #fff;
border: none;
border-radius: 5px;
}
.btn-block{
width: 40%;
display: block;
margin: auto;
padding: 10px 30px;
cursor: pointer;
background-color: var(--primary);
color: #fff;
border: none;
border-radius: 5px;
}
.btn-outline{
background-color: transparent;
border: 1px #fff solid ;
}
.btn:hover{
transform: scale(0.98);
}
/* Backgrounds & colored buttons */
.bg-primary, .btn-primary{
background-color: var(--primary);
color: #fff;
}
.bg-secondary, .btn-secondary{
background-color: var(--secondary-color);
color: #fff;
}
.bg-dark, .btn-dark{
background-color: var(--dark-color);
color: #fff;
}
.bg-light, .btn-light{
background-color: var(--light-color);
color: #333;
}
.bg-primary a, .btn-primary a,
.bg-secondary a, .btn-secondary a,
.bg-dark a, .btn-dark a{
color: #fff;
}
/* Text colors */
.text-primary{
color: var(--primary-color);
}
.text-secondary{
color: var(--secondary-color);
}
.text-dark{
color: var(--dark-color);
}
.text-light{
color: var(--light-color);
}
/* Text Sizes */
.lead{
font-size: 20px;
}
.sm{
font-size: 1rem;
}
.md{
font-size: 2rem;
}
.mdl{
font-size: 2.5rem;
}
.lg{
font-size: 3rem;
}
.xl{
font-size: 4rem;
}
.text-center {
text-align: center;
}
/* font weights */
.bw{
font-weight: bold;
}
/* Alert */
.alert{
background-color: var(--light-color);
padding: 10px 20px;
/* font-weight: bold; */
margin: 15px 0;
}
.alert i{
margin-right: 10px;
}
.alert-success{
background-color: var(--success-color);
color: #fff;
}
.alert-error{
background-color: var(--error-color);
color: #fff;
}
.alert-attention{
background-color: var(--dark-color);
color: #fff;
}
.flex {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.grid{
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20px;
justify-content: center;
align-items: center;
height: 100%;
}
.grid-3{
grid-template-columns: repeat(3, 1fr);
}
.grid-4{
grid-template-columns: repeat(4, 1fr);
}
/* Margin */
.my-1{
margin: 1rem 0;
}
.my-2{
margin: 1.5rem 0;
}
.my-3{
margin: 2rem 0;
}
.my-4{
margin: 3rem 0;
}
.my-5{
margin: 4rem 0;
}
.mx-1{
margin: 0 1rem;
}
.mx-2{
margin: 0 2rem;
}
.m-1{
margin: 1rem;
}
.m-2{
margin: 1.5rem;
}
.m-3{
margin: 2rem;
}
.m-4{
margin: 3rem;
}
.m-5{
margin: 4rem;
}
/* Padding*/
.py-1{
padding: 1rem 0;
}
.py-2{
padding: 1.5rem 0;
}
.py-3{
padding: 2rem 0;
}
.py-4{
padding: 3rem 0;
}
.py-5{
padding: 4rem 0;
}
.p-1{
padding: 1rem;
}
.p-2{
padding: 1.5rem;
}
.p-3{
padding: 2rem;
}
.p-4{
padding: 3rem;
}
.p-5{
padding: 4rem;
}
.pb{
padding-bottom: 2rem;
}
型
我尝试使用溢出,但它增加了一个滚动条。我想让卡片在文本区域元素增加高度和溢出时增加其长度。
1条答案
按热度按时间a64a0gku1#
你可以考虑删除
.container-form
规则中的height
声明,转而应用一个等效的min-height
声明: