简体   繁体   English

间距/ CSS问题? -Michael Hartl撰写的Ruby on Rails教程

[英]Spacing/CSS Issue? - The Ruby on Rails Tutorial by Michael Hartl

My issue with this tutorial is that my sign up form seems to be displayed in one single line. 我在本教程中遇到的问题是我的注册表单似乎显示在一行中。 (Look at the form lines and also the debug box at the bottom). (查看表格行以及底部的调试框)。 The font style is different in comparison to my site. 与我的网站相比,字体样式有所不同。 (The bolded text on the original compared to mine.) (与我的相比,原件上的粗体字。)

Any help is appreciated. 任何帮助表示赞赏。 Thank you! 谢谢!

This is what its suppose to look like: 这是它的样子: 应该是什么 But I have this: 但是我有这个: 在此处输入图片说明

Here is my CSS code: 这是我的CSS代码:

@import "bootstrap-sprockets";
@import "bootstrap";

/* mixins, variables, etc. */

  $gray-medium-light: #eaeaea;

  @mixin box_sizing {
    -moz-box-sizing:    border-box;
    -webkit-box-sizing: border-box;
    box-sizing:         border-box;
  }

/* universal */

html {
  overflow-y: scroll;
}

body {
  padding-top: 60px;
}

section {
  overflow: auto;
}

textarea {
  resize: vertical;
}

.center {
  text-align: center;
  h1 {
    margin-bottom: 10px;
  }
}

/* typography */

h1, h2, h3, h4, h5, h6 {
  line-height: 1;
}

h1 {
  font-size: 3em;
  letter-spacing: -2px;
  margin-bottom: 30px;
  text-align: center;
}

h2 {
  font-size: 1.2em;
  letter-spacing: -1px;
  margin-bottom: 30px;
  text-align: center;
  font-weight: normal;
  color: $gray-light;
}

p {
  font-size: 1.1em;
  line-height: 1.7em;
}


/* header */

#logo {
  float: left;
  margin-right: 10px;
  font-size: 1.7em;
  color: white;
  text-transform: uppercase;
  letter-spacing: -1px;
  padding-top: 9px;
  font-weight: bold;
  &:hover {
    color: white;
    text-decoration: none;
  }
}

/* footer */

footer {
  margin-top: 45px;
  padding-top: 5px;
  border-top: 1px solid $gray-medium-light;
  color: $gray-light;
  a {
    color: $gray;
    &:hover {
      color: $gray-darker;
    }
  }
  small {
    float: left;
  }
  ul {
    float: right;
    list-style: none;
    li {
      float: left;
      margin-left: 15px;
    }
  }

  /* miscellaneous */

  .debug_dump {
    clear: both;
    float: left;
    width: 100%;
    margin-top: 45px;
    @include box_sizing;
  }

  /* sidebar */

aside {
  section.user_info {
    margin-top: 20px;
  }
  section {
    padding: 10px 0;
    margin-top: 20px;
    &:first-child {
      border: 0;
      padding-top: 0;
    }
    span {
      display: block;
      margin-bottom: 3px;
      line-height: 1;
    }
    h1 {
      font-size: 1.4em;
      text-align: left;
      letter-spacing: -1px;
      margin-bottom: 3px;
      margin-top: 0px;
    }
  }
}

.gravatar {
  float: left;
  margin-right: 10px;
}

.gravatar_edit {
  margin-top: 15px;
}

/* forms */

input, textarea, select, .uneditable-input {
  border: 1px solid #bbb;
  width: 100%;
  margin-bottom: 15px;
  @include box_sizing;
}

input {
  height: auto !important;
}

/*END*/

}

View code for signup: 查看注册代码:

<% provide(:title, 'Sign up') %>
<h1>Sign up</h1>

<div class="row">
  <div class="col-md-6 col-md-offset-3">
    <%= form_for(@user) do |f| %>
      <%= f.label :name %>
      <%= f.text_field :name %>

      <%= f.label :email %>
      <%= f.email_field :email %>

      <%= f.label :password %>
      <%= f.password_field :password %>

      <%= f.label :password_confirmation, "Confirmation" %>
      <%= f.password_field :password_confirmation %>

      <%= f.submit "Create my account", class: "btn btn-primary" %>
    <% end %>
  </div>
</div>

If you need to see more files here they are here at Github: https://github.com/jackytai/sample_app_rails/tree/sign-up 如果您需要在此处查看更多文件,请访问Github: https//github.com/jackytai/sample_app_rails/tree/sign-up

Source: https://www.railstutorial.org/book/sign_up#cha-sign_up 资料来源: https : //www.railstutorial.org/book/sign_up#cha-sign_up

My Footer CSS was not closed properly. 我的页脚CSS没有正确关闭。

Thanks everyone 感谢大家

Source: CSS railstutorial 资料来源: CSS railstutorial

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM