【问题标题】:Ruby On Rails - Something wrong with stylesRuby On Rails - 样式有问题
【发布时间】:2015-10-06 08:56:49
【问题描述】:

我正在关注Ruby On Rails Tutorial by Michael Hartl,我认为我的风格有问题。

首先,我得到的是 而不是

如你所见,标题样式和调试框样式有问题

然后,在注册页面我得到这个 而不是这个

我的样式文件(custom.css.scss):

@import "bootstrap";

/* variables */
$paddingTopBody: 60px;
$marginBottomH1: 10px;
$grayMediumLight: #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: $paddingTopBody;
}

section {
  overflow: auto;
}

textarea {
  resize: vertical;
}

.center {
  text-align: center;
  h1 {
    margin-bottom: $marginBottomH1;
  }
}

/* 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: $grayLight;
}

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;
  line-height: 1;

  &:hover {
    color: white;
    text-decoration: none;
  }
}

/* footer */

footer {
  margin-top: 45px;
  padding-top: 5px;
  border-top: 1px solid $grayMediumLight;
  color: $grayLight;

  a {
    color: $gray;
    &:hover {
      color: $grayDarker;
    }
  }

  small {
    float: left;
  }

  ul {
    float: right;
    list-style: none;
    li {
      float: left;
      margin-left: 10px;
    }
  }

  /* 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;
  }

  #error_explanation {
    color: #f00;
    ul {
      list-style: none;
      margin: 0 0 18px 0;
    }
  }

  .field_with_errors {
    @extend .control-group;
    @extend .error;
  }
}

有什么想法可能是错误吗?

【问题讨论】:

    标签: css ruby-on-rails ruby twitter-bootstrap


    【解决方案1】:

    我不知道迈克尔的书,但作为你的截图,你可能会被省略'css reset'

    编辑:我从那本书中找到了示例应用程序的 github,you can compare style file directly

    【讨论】:

    • 感谢您的回答。我已经比较了它们,发现没有区别
    【解决方案2】:

    我终于找到了错误。我在页脚之后忘记了},所以页脚之后的所有内容都在其标签下。感谢@Leqna 的回答

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-17
      • 2016-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多