输入元素和CSS无法正常工作

用户名

我一直在与输入元素和CSS作斗争。我的设计不是很好。我正在尝试这样创建:

在此处输入图片说明

我的输入是在

  • <li>
    <FORM class="searchform" NAME="Search" ACTION="./index.cfm?P=128" METHOD=POST >
        <INPUT type="text" name=search value="" STYLE="color: #676767; background-color: #282828; line-height: 18px" size="10" maxlength="40"  Placeholder="search">
        <INPUT class="search_button" TYPE=SUBMIT NAME="SubmitButton1" VALUE="Search" ID="SubmitButton1">
    </FORM></li>
    

    这是我的CSS:

        @import url(http://fonts.googleapis.com/css?family=Montserrat);
    body, html {height: 100%; margin: 0; font-size:16px;}
    body {font-family: Arial;}
    header {width: 100%; background-image: url('img/top-bg.png'); background-repeat: repeat-x; background-color: #dfebf2; position: fixed; height: 70px; z-index:2;}
    aside {width: 270px; min-height: 100%; position: fixed; background-color: #dfebf2; left: 0; max-height: 100%; overflow-y: auto; /* border-right: 1px solid #bdcada; */}
    section {top: 70px; left: 270px; position: absolute;}
    h3 {font-family: 'Montserrat', Arial; text-transform: uppercase;font-size:15px;}
    select {width: 230px; height: 34px; border: 1px solid #bdcada; font-size: 14px; font-weight: bold; margin: 10px 0 0 0; padding-left: 8px; border-radius: 3px;}
    table, th, td {border: 1px solid #bdcada;}
    
    input.search_button {
        color: black;
        line-height: 23px;
        font-weight: bold;
        font-size: 10px;
        font-family: 'Montserrat', Arial;
        -webkit-border-radius: 5px; 
        -moz-border-radius: 5px; 
        border-radius: 5px;
        width: 20em;
        height: 2em; 
    }
    
    .height-112px {height: 112px;}
    #logo-box {float: left; margin-left: 20px; margin-top:10px; width: 250px;}
    #mobile-menu-icon, #mobile-profile-icon {display:none;}
    #top-nav {position: absolute; width: 100%; background-color: #282828; min-height: 42px; top: 70px; color: #fff;}
    .top-nav-links {list-style-type: none; padding: 0px; margin: 0px; padding-left: 20px; padding-right:20px; line-height: 42px;}
    .top-nav-links li {font-weight: bold; display: inline; margin-right: 15px; font-size: 10px; text-transform: uppercase; font-family: 'Montserrat', Arial;}
    .top-nav-links a {color: #676767; text-decoration: none;}
    .top-nav-links a:hover {color: #fff;}
    .active-top a {color: #fff;}
    #details-box {padding: 30px 20px 30px 20px; border-bottom: 1px solid #bdcada;}
    #height-5px {height: 5px;}
    .details-1 {font-weight: bold; font-size: 14px; color: #1072ad;}
    .details-2 {font-style: italic; font-size: 12px; color: #9ca6b6; margin-left: 10px;}
    .details-3 {font-weight: bold; font-size: 12px; color: #000; margin-left: 10px;}
    #details-box a {text-decoration: none;}
    .logout {font-size: 11px; color: red;}
    #property-box {padding: 25px 20px 30px 20px;}
    .blue-nav-title {font-family: 'Montserrat', Arial; font-weight: bold; font-size: 12px; color: #1072ad; text-transform: uppercase;}
    .list-title {height: 42px; background-image: url('img/top-bg.png'); padding: 0 20px 0 20px; border-bottom: 1px solid #0b5987; line-height: 42px; font-family: 'Montserrat', Arial; font-size: 12px; color: #fff; text-transform: uppercase;}
    .nav-links {list-style-type: none; padding: 0px; margin: 0px;}
    .nav-links li {font-size: 12px; color: #6e7888; padding-left: 20px; line-height: 50px; border-bottom: 1px solid #bdcada;}
    .nav-links a {text-decoration: none; color: #6e7888;}
    .nav-links li:before {content: "â–º "; font-size: 7px; color: #157cb8; vertical-align: top; margin-right: 8px;}
    .nav-links a:hover {text-decoration: none; color: #000;}
    .active {background: #fff;}
    #content {margin-left: 50px; margin-top: 92px;}
    
    
    
    table {font-size: 12px; border-collapse: collapse; width: 100%; overflow-y:scroll; height:300px; display:block;}
    table td, th {padding: 10px;}
    table tr:hover {background: #f0f6f9;}
    
    .table-b {font-size: 12px; border-collapse: collapse; width: AUTO; HEIGHT: AUTO; display:block;}
    .table-b td, th {padding: 10px;}
    .table-b tr:hover {background: #f0f6f9;}
    
    .table-a {font-size: 12px; border-collapse: collapse; width: 100%; }
    .table-a td, th {padding: 10px;}
    .table-a tr:hover {background: #f0f6f9;}
    
    
    form.searchform {display: inline-block;}
    #login {width: 240px; border: 1px solid #bdcada; border-radius: 3px; padding: 30px; font-size: 12px;}
    .input {width: 230px; height: 30px; border: 1px solid #bdcada; font-size: 14px; font-weight: bold; margin-top: 5px; margin-bottom: 10px; padding-left: 8px; border-radius: 3px;}
    
    .divTable{
      display:table;         
      width:auto;         
      background-color:#eee;         
      border:1px solid  #666666;         
      border-spacing:5px;
    }
    .divRow{
      display:table-row;
      width:auto;
      clear:both;
      background-color:#ccc;  
    }
    .divCell{
      float:left;
      display:table-column;         
      width:100px;         
    border-left: 2px solid #fff;
    }
    
    
    /* columns float left while they fit – some spacing in there too between columns*/
    #column {width:48%;float:left;padding-right:20px;}
    
    /*the table will always fill up the space of the column – column starts at 50% of the screen width so two can fit */
    table {width:100%;margin-bottom:20px}
    
    /* responsive breakpoint – at 1000px screen, the tables no longer fit side by side, so they auto-fit top-to-bottom, so make them each full width */
    @media screen and (max-width: 1000px) {
                    #column {width:100%;}
    
    
    @media only screen
    and (max-device-width : 768px) {
        body, html {width:100%; margin: 0; font-size:14px;}
        header {position:initial; height:auto;}
        aside {width:100%; position:initial; min-height:initial;}
        section {position:initial;}
        select {width: 100%; height:auto; padding:8px; font-size: inherit;}
    
        .height-112px {height: auto;}
        #logo-box {float: none; margin:0px; width: 100%}
        #logo-img {margin: 10px 10px 5px 10px;}
        #mobile-menu-icon, #mobile-profile-icon {display:block; float:right; height:45px; width:45px; margin: 12px 12px 5px 0px;}
        #top-nav {position: initial; display:none; clear:both; border-bottom: 1px solid #bdcada; background-color: inherit; width: 100%; min-height: inherit;}
        .top-nav-links li {display:block; width:100%; font-size: 16px; line-height:36px;}
        .top-nav-links li:first-child {padding-top:10px;}
        .top-nav-links li:last-child {padding-bottom:10px;}
        .top-nav-links a {color: #000;}
        .active-top a {color: #1067a6;}
        #details-box {display:none; padding: 20px;}
        .details-1, .details-2, .details-3, .logout {font-size: inherit;}
        #property-box {padding: 20px;}
        .blue-nav-title {font-family: 'Montserrat', Arial; font-weight: bold; font-size:inherit; color: #1072ad; text-transform: uppercase;}
        .list-title {font-size:inherit;}
        .list-title:after {content: "+"; font-weight: bold; font-size: 18px; float:right;}
        .opened:after {content: "-"; font-weight: bold; font-size: 18px; float:right;}
        .nav-links {display: none;}
        .nav-links li {font-size: inherit;}
        .nav-links li:before {content: "â–º "; font-size: 11px;}
        #content {margin:0; padding:15px;}
        table {font-size:inherit;}
        table tr.odd {background: #eeeeee;}
        table th {font-weight:normal; text-align:left;}
        #login {width: 100%; padding:20px; max-width:400px; margin:0 auto; box-sizing: border-box;-moz-box-sizing: border-box;-webkit-box-sizing: border-box; font-size: inherit;}
        .input {width: 100%; box-sizing: border-box;-moz-box-sizing: border-box;-webkit-box-sizing: border-box; font-size: inherit;}
    }
    
    @media only screen
    and (min-device-width : 200px)
    and (max-device-width : 319px) {
        #mobile-menu-icon, #mobile-profile-icon {display:block; float:right; height:40px; width:40px; margin: 13px 10px 5px 0px;}
    }
    
    @media only screen
    and (min-device-width : 425px)
    and (max-device-width : 600px) {
        body, html {width:100%; margin: 0; font-size:15px;}
    }
    
    @media only screen
    and (min-device-width : 600px)
    and (max-device-width : 768px) {
        body, html {width:100%; margin: 0; font-size:16px;}
    
    }
    

    我的搜索按钮与我的li对齐。我的结果是这样的:

    在此处输入图片说明

    有人知道我在做什么错吗?

    谢谢

  • 零零

    像这样设置搜索按钮的样式

    input.search_button {
      color: black;
    
      font-weight: bold;
      font-size: 10px;
      font-family: 'Montserrat', Arial;
      -webkit-border-radius: 5px;
      -moz-border-radius: 5px;
      border-radius: 2px;
    
    }
    

    如果要设置一个输入的id样式,请添加一个and,为该id设置样式,如前所述

    片段

    @import url(http://fonts.googleapis.com/css?family=Montserrat);
     body,
    html {
      height: 100%;
      margin: 0;
      font-size: 16px;
    }
    body {
      font-family: Arial;
    }
    header {
      width: 100%;
      background-image: url('img/top-bg.png');
      background-repeat: repeat-x;
      background-color: #dfebf2;
      position: fixed;
      height: 70px;
      z-index: 2;
    }
    aside {
      width: 270px;
      min-height: 100%;
      position: fixed;
      background-color: #dfebf2;
      left: 0;
      max-height: 100%;
      overflow-y: auto;
      /* border-right: 1px solid #bdcada; */
    }
    section {
      top: 70px;
      left: 270px;
      position: absolute;
    }
    h3 {
      font-family: 'Montserrat', Arial;
      text-transform: uppercase;
      font-size: 15px;
    }
    select {
      width: 230px;
      height: 34px;
      border: 1px solid #bdcada;
      font-size: 14px;
      font-weight: bold;
      margin: 10px 0 0 0;
      padding-left: 8px;
      border-radius: 3px;
    }
    table,
    th,
    td {
      border: 1px solid #bdcada;
    }
    input.search_button {
      color: black;
    
      font-weight: bold;
      font-size: 10px;
      font-family: 'Montserrat', Arial;
      -webkit-border-radius: 5px;
      -moz-border-radius: 5px;
      border-radius: 2px;
     
    }
    .height-112px {
      height: 112px;
    }
    #logo-box {
      float: left;
      margin-left: 20px;
      margin-top: 10px;
      width: 250px;
    }
    
    #mobile-menu-icon,
    #mobile-profile-icon {
      display: none;
    }
    #top-nav {
      position: absolute;
      width: 100%;
      background-color: #282828;
      min-height: 42px;
      top: 70px;
      color: #fff;
    }
    .top-nav-links {
      list-style-type: none;
      padding: 0px;
      margin: 0px;
      padding-left: 20px;
      padding-right: 20px;
      line-height: 42px;
    }
    .top-nav-links li {
      font-weight: bold;
      display: inline;
      margin-right: 15px;
      font-size: 10px;
      text-transform: uppercase;
      font-family: 'Montserrat', Arial;
    }
    .top-nav-links a {
      color: #676767;
      text-decoration: none;
    }
    .top-nav-links a:hover {
      color: #fff;
    }
    .active-top a {
      color: #fff;
    }
    #details-box {
      padding: 30px 20px 30px 20px;
      border-bottom: 1px solid #bdcada;
    }
    #height-5px {
      height: 5px;
    }
    .details-1 {
      font-weight: bold;
      font-size: 14px;
      color: #1072ad;
    }
    .details-2 {
      font-style: italic;
      font-size: 12px;
      color: #9ca6b6;
      margin-left: 10px;
    }
    .details-3 {
      font-weight: bold;
      font-size: 12px;
      color: #000;
      margin-left: 10px;
    }
    #details-box a {
      text-decoration: none;
    }
    .logout {
      font-size: 11px;
      color: red;
    }
    #property-box {
      padding: 25px 20px 30px 20px;
    }
    .blue-nav-title {
      font-family: 'Montserrat', Arial;
      font-weight: bold;
      font-size: 12px;
      color: #1072ad;
      text-transform: uppercase;
    }
    .list-title {
      height: 42px;
      background-image: url('img/top-bg.png');
      padding: 0 20px 0 20px;
      border-bottom: 1px solid #0b5987;
      line-height: 42px;
      font-family: 'Montserrat', Arial;
      font-size: 12px;
      color: #fff;
      text-transform: uppercase;
    }
    .nav-links {
      list-style-type: none;
      padding: 0px;
      margin: 0px;
    }
    .nav-links li {
      font-size: 12px;
      color: #6e7888;
      padding-left: 20px;
      line-height: 50px;
      border-bottom: 1px solid #bdcada;
    }
    .nav-links a {
      text-decoration: none;
      color: #6e7888;
    }
    .nav-links li:before {
      content: "â–º ";
      font-size: 7px;
      color: #157cb8;
      vertical-align: top;
      margin-right: 8px;
    }
    .nav-links a:hover {
      text-decoration: none;
      color: #000;
    }
    .active {
      background: #fff;
    }
    #content {
      margin-left: 50px;
      margin-top: 92px;
    }
    table {
      font-size: 12px;
      border-collapse: collapse;
      width: 100%;
      overflow-y: scroll;
      height: 300px;
      display: block;
    }
    table td,
    th {
      padding: 10px;
    }
    table tr:hover {
      background: #f0f6f9;
    }
    .table-b {
      font-size: 12px;
      border-collapse: collapse;
      width: AUTO;
      HEIGHT: AUTO;
      display: block;
    }
    .table-b td,
    th {
      padding: 10px;
    }
    .table-b tr:hover {
      background: #f0f6f9;
    }
    .table-a {
      font-size: 12px;
      border-collapse: collapse;
      width: 100%;
    }
    .table-a td,
    th {
      padding: 10px;
    }
    .table-a tr:hover {
      background: #f0f6f9;
    }
    form.searchform {
      display: inline-block;
    }
    #login {
      width: 240px;
      border: 1px solid #bdcada;
      border-radius: 3px;
      padding: 30px;
      font-size: 12px;
    }
    .input {
      width: 230px;
      height: 30px;
      border: 1px solid #bdcada;
      font-size: 14px;
      font-weight: bold;
      margin-top: 5px;
      margin-bottom: 10px;
      padding-left: 8px;
      border-radius: 3px;
    }
    .divTable {
      display: table;
      width: auto;
      background-color: #eee;
      border: 1px solid #666666;
      border-spacing: 5px;
    }
    .divRow {
      display: table-row;
      width: auto;
      clear: both;
      background-color: #ccc;
    }
    .divCell {
      float: left;
      display: table-column;
      width: 100px;
      border-left: 2px solid #fff;
    }
    /* columns float left while they fit – some spacing in there too between columns*/
    
    #column {
      width: 48%;
      float: left;
      padding-right: 20px;
    }
    /*the table will always fill up the space of the column – column starts at 50% of the screen width so two can fit */
    
    table {
      width: 100%;
      margin-bottom: 20px
    }
    /* responsive breakpoint – at 1000px screen, the tables no longer fit side by side, so they auto-fit top-to-bottom, so make them each full width */
    
    @media screen and (max-width: 1000px) {
      #column {
        width: 100%;
      }
      @media only screen and (max-device-width: 768px) {
        body, html {
          width: 100%;
          margin: 0;
          font-size: 14px;
        }
        header {
          position: initial;
          height: auto;
        }
        aside {
          width: 100%;
          position: initial;
          min-height: initial;
        }
        section {
          position: initial;
        }
        select {
          width: 100%;
          height: auto;
          padding: 8px;
          font-size: inherit;
        }
        .height-112px {
          height: auto;
        }
        #logo-box {
          float: none;
          margin: 0px;
          width: 100%
        }
        #logo-img {
          margin: 10px 10px 5px 10px;
        }
        #mobile-menu-icon,
        #mobile-profile-icon {
          display: block;
          float: right;
          height: 45px;
          width: 45px;
          margin: 12px 12px 5px 0px;
        }
        #top-nav {
          position: initial;
          display: none;
          clear: both;
          border-bottom: 1px solid #bdcada;
          background-color: inherit;
          width: 100%;
          min-height: inherit;
        }
        .top-nav-links li {
          display: block;
          width: 100%;
          font-size: 16px;
          line-height: 36px;
        }
        .top-nav-links li:first-child {
          padding-top: 10px;
        }
        .top-nav-links li:last-child {
          padding-bottom: 10px;
        }
        .top-nav-links a {
          color: #000;
        }
        .active-top a {
          color: #1067a6;
        }
        #details-box {
          display: none;
          padding: 20px;
        }
        .details-1,
        .details-2,
        .details-3,
        .logout {
          font-size: inherit;
        }
        #property-box {
          padding: 20px;
        }
        .blue-nav-title {
          font-family: 'Montserrat', Arial;
          font-weight: bold;
          font-size: inherit;
          color: #1072ad;
          text-transform: uppercase;
        }
        .list-title {
          font-size: inherit;
        }
        .list-title:after {
          content: "+";
          font-weight: bold;
          font-size: 18px;
          float: right;
        }
        .opened:after {
          content: "-";
          font-weight: bold;
          font-size: 18px;
          float: right;
        }
        .nav-links {
          display: none;
        }
        .nav-links li {
          font-size: inherit;
        }
        .nav-links li:before {
          content: "â–º ";
          font-size: 11px;
        }
        #content {
          margin: 0;
          padding: 15px;
        }
        table {
          font-size: inherit;
        }
        table tr.odd {
          background: #eeeeee;
        }
        table th {
          font-weight: normal;
          text-align: left;
        }
        #login {
          width: 100%;
          padding: 20px;
          max-width: 400px;
          margin: 0 auto;
          box-sizing: border-box;
          -moz-box-sizing: border-box;
          -webkit-box-sizing: border-box;
          font-size: inherit;
        }
        .input {
          width: 100%;
          box-sizing: border-box;
          -moz-box-sizing: border-box;
          -webkit-box-sizing: border-box;
          font-size: inherit;
        }
      }
      @media only screen and (min-device-width: 200px) and (max-device-width: 319px) {
        #mobile-menu-icon, #mobile-profile-icon {
          display: block;
          float: right;
          height: 40px;
          width: 40px;
          margin: 13px 10px 5px 0px;
        }
      }
      @media only screen and (min-device-width: 425px) and (max-device-width: 600px) {
        body, html {
          width: 100%;
          margin: 0;
          font-size: 15px;
        }
      }
      @media only screen and (min-device-width: 600px) and (max-device-width: 768px) {
        body, html {
          width: 100%;
          margin: 0;
          font-size: 16px;
        }
      }
      body{
      background:black}
    
      
    <li>
      <FORM class="searchform" NAME="Search" ACTION="./index.cfm?P=128" METHOD=POST>
        <INPUT type="text" name=search value="" STYLE="color: #676767; background-color: #282828; line-height: 18px" size="10" maxlength="40" Placeholder="search">
        <INPUT class="search_button" TYPE=SUBMIT NAME="SubmitButton1" VALUE="Search" ID="SubmitButton1">
      </FORM>
    </li>

    本文收集自互联网,转载请注明来源。

    如有侵权,请联系 [email protected] 删除。

    编辑于
    0

    我来说两句

    0 条评论
    登录 后参与评论

    相关文章