【问题标题】:searchbox and submit button are appearing without borders搜索框和提交按钮出现无边框
【发布时间】:2015-06-03 01:14:15
【问题描述】:

非常愚蠢的问题,但无法解决......

在我的 php 项目中,搜索框和提交按钮看起来很奇怪,就像下面 .jpg 图片上的那些,为什么会这样以及如何解决这个问题? (搜索 = otsi:)。

在一个简单的 html 表单上,通常会出现相同的代码行,就像上面的搜索框(带边框 / otsi: )

检查了我的 CSS,它似乎不会影响边框或框。 .php 子页面上的代码很简单:

<header id="header">
<div id="logo"><img src="images/logobmw.png"></div>


<div id="searchbox">

<form action="search.php" method="get" enctype="multipart/form-data">

<input type="search" name="value" size="25" >

<input type="submit" name="search" value="  otsi  " >

</form>
</div>
</header>

(搜索字段的灰色背景是我在 css 中设置的,它实际上是白色的,因此不可见,因为标题的背景颜色也是白色的。

CSS *、body、wrapper 和 header 也很简单:

 * {        
   margin: 0;
   border: 0;
   padding: 0;
  }

body {
  font-family: Calibri, Georgia, Verdana, arial;
  background-color: #F8F8F8 ;
  font-size: 105%;
  color: #303030;
  line-height: 1.4;
  margin: 0;
}

#wrp {
   width: 80%;
   margin-left: auto;
   margin-right: auto;
}

#header {
  width: auto;
  height: 100px;
  background-color: #fff;
}

【问题讨论】:

    标签: html css


    【解决方案1】:

    选择器“*”适用于所有元素(包括 INPUT)。这将删除您的 INPUT 的边框。

    大多数重置样式表不会使用“*”,而是针对单个元素,例如。如果您用下面的内容替换该选择器,这应该可以解决您的问题:

    html, body, div, span, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    abbr, address, cite, code,
    del, dfn, em, img, ins, kbd, q, samp,
    small, strong, sub, sup, var,
    b, i, dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td,
    article, aside, canvas, details, figcaption, figure,
    footer, header, hgroup, menu, nav, section, summary,
    time, mark, audio, video {
        margin:0;
        border:0;
        padding:0;
    }
    

    【讨论】:

    • 谢谢!如果我想更改搜索字段和提交按钮的边框样式 - 我应该如何在 css 中定位它们?我照说的做了,但它们是 3D 风格的
    • 有了当前的 HTML,你可以这样做: INPUT[type="search"] { /*styles here*/ } INPUT[type="submit"] { /*styles here*/ }
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-24
    • 1970-01-01
    • 1970-01-01
    • 2016-08-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多