首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我的联系人表格上有跨浏览器前端显示问题。

我的联系人表格上有跨浏览器前端显示问题。
EN

Stack Overflow用户
提问于 2014-12-28 13:23:55
回答 1查看 139关注 0票数 0

我试图建立自己的投资组合,作为课程的一部分,我准备了一份联系表格的前端。

我把Google放在心上,使用1024x768px的屏幕分辨率作为基础,因此它在我的1920x1080px屏幕上看起来也不错。

在IE和Firefox的最新版本中,我遇到了跨浏览器兼容性问题。该网站在谷歌Chrome上的外观和行为都很好。

在IE中:

  • “注释”框显示的范围比窗体元素的其余部分更宽。
  • “传奇”标题的字体颜色是黑色而不是白色

在FireFox中:

  • 评论框和“你是怎么找到这个网站的?”在宽度大小方面,textbox与上述表单元素的其余部分不对齐。

对于如何使它们在所有三种浏览器上看起来大致相等,我不是很确定。据我所知,我使用的CSS应该是跨浏览器支持的。

这是我的密码:

代码语言:javascript
复制
        body {
          font-family: "Ludica Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
          background-color: #E0E1E3;
          margin: 0 auto;
          padding: 0;
        }
        h1 {
          color: #f5f5f5;
          font-size: 4em;
          padding: 0;
          margin: 0 auto;
        }
        .break {
          clear: both;
        }
        #header {
          margin: 0 auto;
          width: 100%;
          background-color: #FF4C65;
          text-align: center;
        }
        #wrapper {
          margin: 0 auto;
          padding: 0;
        }
        #loginContainer {
          position: relative;
          top: 100px;
          background-color: #21282E;
          color: #f5f5f5;
          margin: 0 auto;
          padding: 0;
          width: 400px;
          height: 390px;
        }
        fieldset {
          border: none;
          width: 90%;
          margin: 0 auto;
          padding: 0;
          text-align: center;
          height: 385px;
          color: #FF422C;
        }
        .spacer {
          display: inline-block;
          box-sizing: border-box;
          padding-left: 5px;
          height: 40px;
          line-height: normal;
          margin: 5px 7px 2px 7px;
          font-size: 0.81em;
        }
        textarea {
          margin-top: 5px;
          min-width: 325px;
          min-height: 150px;
          padding-left: 5px;
        }
        #survey {
          padding-top: 0;
          margin: 0;
          width: 325px;
          height: 40px;
          line-height: normal;
          padding-left: 5px;
        }
        #submitButton {
          margin-top: 10px;
          text-align: center;
          border: 0;
          width: 130px;
          height: 30px;
          background-color: #FF422C;
          cursor: pointer;
          color: white;
          transition: all 0.5s ease;
        }
        #submitButton:hover {
          background-color: grey;
        }
代码语言:javascript
复制
<div id="wrapper">
  <div id="header">
    <h1>GET IN TOUCH</h1>
  </div>

  <!-- Clear the floats -->
  <div class="break"></div>

  <div id="loginContainer">
    <fieldset>
      <legend>Fill in your details here</legend>
      <form action="getintouch.php" type="get" id="getintouch">
        <input type="text" name="name" placeholder="Full Name" class="spacer" required/>
        <input type="email" name="email" class="spacer" placeholder="Email" required/>
        <input type="tel" name="telephone" class="spacer" placeholder="Phone" required/>
        <input type="text" name="titleAndCompany" class="spacer" placeholder="Title and company" />
        <textarea name="comments" placeholder="What can I help you with?" required></textarea>
        <input type="text" name="survey" id="survey" placeholder="How did you find this site?" required/>
        <button type="submit" id="submitButton">Submit</button>
      </form>
    </fieldset>
  </div>

</div>

这里有一个指向jsfiddle的链接:http://jsfiddle.net/knadoor/bm2LbbL4/

谢谢你的意见:)

PS:对于这里有经验的程序员,我想了解你对我的代码布局的看法(我的背景不是网页开发)。

谢谢

编辑:这里有一个指向我的完整代码片段的链接(我正在使用http://pastebin.com/gBJR1Nd3

第一张图片是谷歌Chrome,第二张是Firefox,第三张是IE。

EN

回答 1

Stack Overflow用户

发布于 2014-12-28 13:28:41

这是很好的正常化,甚至重新设置你的css代码,当你照顾你的网站交叉浏览器。

您可以在这里了解更多关于规范化的知识:http://necolas.github.io/normalize.css/,它基本上覆盖了CSS的defualt浏览器设置,这样您就可以对事情的外观有更多的控制。

此外,我可以看到您使用box-sizing -确保您的目标是支持此功能的浏览器(添加-webkit-moz-o前缀不会伤害)。确保您的页面具有正确的doctype。

除此之外,您的代码看起来很好,不应该遇到任何麻烦。很高兴看到有人使用适当的display属性。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27676803

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档