gpt4 book ai didi

html - CSS - 使用 2 个宽度相同的文本框编辑响应式表单

转载 作者:行者123 更新时间:2023-11-28 01:08:20 25 4
gpt4 key购买 nike

我正在尝试编辑模板中的表单。该表单将是一个非常常见的搜索表单,带有两个文本框(WhatWhere)和按钮 Search

两个文本框应具有相同的宽度,并用垂直灰线分隔。

我将与表单相关的完整代码放在以下几行中,无论如何,为了完整起见,我还提供了模板的链接:

https://demo.themeregion.com/jobs-updated/details.html

这是表单的代码:

<form action="#">
<!-- category-change -->
<div class="dropdown category-dropdown">
<a data-toggle="dropdown" href="#"><span class="change-text">Job Category</span> <i class="fa fa-angle-down"></i></a>
<ul class="dropdown-menu category-change">
<li><a href="#">Customer Service</a></li>
<li><a href="#">Software Engineer</a></li>
<li><a href="#">Program Development</a></li>
<li><a href="#">Project Manager</a></li>
<li><a href="#">Graphics Designer</a></li>
</ul>
</div><!-- category-change -->

<!-- language-dropdown -->
<div class="dropdown category-dropdown language-dropdown">
<a data-toggle="dropdown" href="#"><span class="change-text">Job Location</span> <i class="fa fa-angle-down"></i></a>
<ul class="dropdown-menu category-change language-change">
<li><a href="#">Location 1</a></li>
<li><a href="#">Location 2</a></li>
<li><a href="#">Location 3</a></li>
</ul>
</div><!-- language-dropdown -->

<input type="text" class="form-control" placeholder="Type your key word">
<button type="submit" class="btn btn-primary" value="Search">Search</button>
</form>
</div><!-- banner-form -->

这是CSS的代码:

/* ==========================================================================
banner-form
========================================================================== */

.banner-form {
background-color: rgba(0, 0, 0, 0.14);
padding: 8px;
max-width: 750px;
margin: 12px auto;
border-radius: 5px;
text-align:left;
}

.banner-form form {
border-radius:4px;
background-color:#fff;
position:relative;
}

.category-dropdown {
background-color: #fff;
border-right: 1px solid #e6e6e6;
border-radius: 5px 0px 0px 5px;
min-width: 200px;
line-height: 45px;
text-align: left;
padding: 0 20px;
}

.category-dropdown a i{
margin-left: 5px;
}

.category-dropdown a {
font-size: 16px;
margin: 0;
color: #000;
border: none;
border-radius: 5px 0 0 5px;
text-transform: capitalize;
font-family: 'MyriadPro-Regular', sans-serif;
}

.banner-form input {
min-width: 375px;
padding:0 18px 0;
margin: 0;
font-family: 'MyriadPro-Regular', sans-serif;
border: none;
margin-left: -4px;
}

.banner-form .form-control,
.banner-form .category-dropdown {
display:inline-block;
width:30%;
height:46px;
font-size:16px;
color: #000;
}

.banner-form button.btn.btn-primary {
position:absolute;
right:-2px;
bottom:0;
font-size: 16px;
max-width: 114px;
background-color: #00a651;
border-radius: 0 5px 5px 0 ;
color: #fff;
text-transform: uppercase;
border-color:#00a651;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
height:100%;
padding: 10px 20px;
}

.banner-form button:hover {
background-color: #0072bc;
border-color: #0072bc;
}

.banner-socail li {
display: inline-block;;
}

.banner-socail li a {
color: #fff;
font-size: 20px;
background-color:transparent;
display: block;
height: 35px;
width: 35px;
line-height: 35px;
border:1px solid transparent;
border-radius:3px;
}

.banner-socail li i{
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}

.banner-socail li a:hover .fa-facebook {
color: #405D9B;
}

.banner-socail li a:hover .fa-twitter {
color: #29C5F6;
}

.banner-socail li a:hover .fa-google-plus {
color: #CA3E27;
}

.banner-socail li a:hover .fa-youtube {
color: #EB2429;
}

.category-items {
background-color: #fff;
display: inline-block;
padding:40px 0px 10px;
border-radius: 3px;
}

.category a {
color: #505050;
display:block;
}

.banner-form .dropdown-menu {
min-width:100%;
padding:15px 0;
}

.category-icon {
min-height: 37px;
width: 100%;
}

.category-icon img {
margin: 0 auto;
}

.category-title {
color:#505050;
}
.category-quantity {
color: #b5b5b5;
}

.category-title {
display:block;
font-size: 16px;
}

.category-item:hover .category-quantity,
.category-item:hover .category-title {
color :#00a651;
}

.ad-section {
margin: 40px 0;
}

.ad-meta {
background-color: #f6f6f6;
border-top: 1px solid #eeeeee;
min-height: 35px;
position: absolute;
bottom: 0;
right:-1px;
width:100%;
padding-left:25px;
display:table;
font-size:14px;
}

.ad-meta .meta-content {
display:table-cell;
vertical-align:middle;
}

.ad-meta .meta-content .dated {
margin-right:20px;
}

.ad-meta .meta-content .dated,
.ad-meta .meta-content .visitors {
font-weight:500;
color:#9fa4a4;
}

.ad-meta .meta-content span,
.ad-meta .meta-content a {
font-weight:400;
color: #9fa4a4;
}

.ad-meta .meta-content a:hover {
color: #00a651;
}

.ad-meta .user-option a{
font-size: 18px;
color: #9fa4a4;
display:inline-block;
width: 40px;
height: 35px;
text-align: center;
line-height: 35px;
}

.featured .ad-meta .user-option a {
width:30px;
}

.ad-meta .user-option a:hover {
background-color:#fff;
color: #00a651;
}

.ad-meta .user-option a.edit-item:hover {
color:#0072bc;
}

.ad-meta .user-option a.delete-item {
color:#ed1c24;
}

.ad-meta .user-option a.delete-item:hover {
color:#c3171d;
}

.ad-meta a i {
text-align: right
}

a.verified {
position: absolute;
top: 0;
right: 0;
}

a.verified i {
height: 20px;
width: 20px;
background-color: #00a651;
color: #fff;
line-height: 25px;
text-align: center;
}

.ad-section img {
display: inline;
}

.item-image {
position:relative;
}

.item-image img {
width:100%;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}

.job-ad-item:hover .item-image img {
-moz-transform: scale(1.05) rotate(2deg);
-webkit-transform: scale(1.05) rotate(2deg);
-o-transform: scale(1.05) rotate(2deg);
-ms-transform: scale(1.05) rotate(2deg);
transform: scale(1.05) rotate(2deg);
}

.item-image-box, .item-info {
padding: 0;
margin: 0;
}

.item-image-box {
overflow:hidden;
}

.latest-jobs-ads {
margin-bottom: 15px;
background-color: #fff;
padding: 15px 30px;
}

.job-ad-item .ad-info span+a {
color: #9fa4a4;
font-size: 14px;
line-height: 16px;
}

.job-ad-item .ad-info span {
color: #a0a0a0;
font-size: 14px;
line-height: 17px;
}

.tab-manu {
overflow:hidden;
border-bottom: 1px solid #f2f2f2
}

.tab-manu h4 {
float:left;
margin-bottom: 14px;
}

.tab-manu .nav-tabs {
float:right;
border: none;
border: 1px solid transparent;
}

.tab-manu .nav-tabs li a {
padding:12px 15px;
border-bottom:0;
text-transform:capitalize;
color:#9c9c9c;
margin-left: 2px;
}

.tab-manu .nav-tabs li a:hover,
.tab-manu .nav-tabs li a:focus,
.tab-manu .nav-tabs li.active a {
border:1px solid #f2f2f2;
background-color: #fcfcfc;
border-bottom: #f2f2f2;
border-radius: 0;
color: #00a651;
}

.my-ads .ad-meta .pending {
color:#f7941d;
}

那么,我必须编辑什么才能达到我的目标?

最佳答案

这就是您要达到的目标吗? https://codepen.io/panchroma/pen/JaMrad

我添加了一条规则来隐藏关键字文本输入字段,另一条规则将工作地点和工作类别字段的大小调整为可用空间的一半:

input.form-control {
display: none !important;
}

.banner-form-full.banner-form .form-control,
.banner-form-full.banner-form .category-dropdown {
width: calc(50% - 40px) !important;
/* make width 50% of available width less the 20px left and right padding */
}

===

这是另一个版本: https://codepen.io/panchroma/pen/BOJJXL

HTML

<form action="#">          
<div class="input job-category"><input type="text" name="job-category" placeholder="Job Category" ></div>

<div class="input job-location"><input type="text" name="job-category" placeholder="Job Location" ></div>

<button type="submit" class="btn btn-primary" value="Search">Search</button>
</form>

CSS

form{
display:grid;
grid-template-columns:1fr 1fr 100px;
grid-template-rows: 40px;
}

.input{
padding:0 !important;
}

input{
width:100%;
height:40px;
margin:0 !important;
}
.job-category{
border-right:1px solid grey;
}

.banner-form button.btn.btn-primary{
height:40px !important;
right:0 !important;
}

@media (max-width: 600px) {
form{
grid-template-columns:1fr;
grid-template-rows: 40px 40px 40px;
}

.job-category{
border-right:none;
border-bottom:1px solid grey;
}
}

希望这对您有所帮助!

关于html - CSS - 使用 2 个宽度相同的文本框编辑响应式表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52245793/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com