【发布时间】:2017-05-28 05:45:01
【问题描述】:
我正在尝试修改搜索框以使其居中并在浏览器窗口中拉伸直到最大宽度。 我不擅长编码,但我试图修改ccs。现在它在容器中居中,但没有拉伸到最大宽度(比如 400px 左右) containervis 的实际 css:
.jr-form-adv-search-module {
margin: auto;
margin-top:10px;
width:50% ;
}
搜索模块有一个搜索框和一个按钮。
.jrKeywords .jrButton
我希望按钮保持不变,但搜索框(文本输入部分)在我调整窗口大小时拉伸直到达到 400 像素。现在只有容器“.jr-form-adv-search-module”跟随窗口,而 .jrKeywords 保持较小。我尝试了很多组合,但无法拉伸。
这是搜索栏。要恢复,我希望白色文本输入拉伸到 400 像素,同时搜索按钮和他保持居中。目前只有灰色容器跟随窗口。
这是搜索框代码
<div class="jr-page jrPage jrAdvSearchModule jrRoundedPanel jrForm">
<form class="jr-form-adv-search-module" action="/wp-admin/admin-ajax.php?action=jreviews_ajax" method="post" data-live-search="1" data-live-search-hide="1" data-module-id="jreviewsadvsearchwidget-2">
<div class="jrFieldDiv jrLeft" style="">
<input type="text" class="jrKeywords" name="data[keywords]" value="" style="height:37px;">
</div>
<div class="jrFieldDiv jrLeft">
<button class="jr-search jrButton" style="margin:0; font-size:120%; background: #289dcc;color:#ffffff; border-color:#289dcc;">
<span class="jrIconSearch"></span><span>Search</span>
</button>
</div>
<div class="jrClear"></div>
<input name="data[contentoptions][]" type="hidden" value="title">
<input name="data[contentoptions][]" type="hidden" value="introtext">
<input name="data[contentoptions][]" type="hidden" value="fulltext">
<input name="data[search_query_type]" type="hidden" value="all">
<input type="hidden" name="data[controller]" value="search">
<input type="hidden" name="data[action]" value="_process">
<input type="hidden" name="data[menu_id]" value="">
<input type="hidden" name="data[dir]" value="">
<input type="hidden" name="data[Search][criteria_id]" value="1">
<input type="hidden" name="data[form_id]" value="JreviewsAdvSearch_jreviewsadvsearchwidget-2">
<input type="hidden" name="data[module_id]" value="jreviewsadvsearchwidget-2">
</form>
<div class="jrClear"></div>
<input name="data[contentoptions][]" type="hidden" value="title">
<input name="data[contentoptions][]" type="hidden" value="introtext">
<input name="data[contentoptions][]" type="hidden" value="fulltext">
<input name="data[search_query_type]" type="hidden" value="all">
<input type="hidden" name="data[controller]" value="search">
<input type="hidden" name="data[action]" value="_process">
<input type="hidden" name="data[menu_id]" value="">
<input type="hidden" name="data[dir]" value="">
<input type="hidden" name="data[Search][criteria_id]" value="1">
<input type="hidden" name="data[form_id]" value="JreviewsAdvSearch_jreviewsadvsearchwidget-2">
<input type="hidden" name="data[module_id]" value="jreviewsadvsearchwidget-2">
我正在使用我的 wordpress 主题添加自定义 CSS 来修改搜索框行为。这是我到目前为止添加的内容:
.jr-form-adv-search-module {
margin: auto;
margin-top:10px;
width:50% ;
}
【问题讨论】:
-
您好 Stefano,请包含复制布局所需的所有代码。元素的宽度将取决于它的父元素,您没有包含这些元素。了解如何创建minimal reproducible example
-
完成。希望没事。谢谢