Ruby On Rails - Something wrong with styles - css

I'm following Ruby On Rails Tutorial by Michael Hartl and I think there is something wrong with my styles.
First, I get this instead of this
As you see, there is smth wrong with title style and debug box style
Then, in signup page I get this instead of this
My style file (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;
}
}
Any ideas where the error could be?

I don't know about Michael's book, but as your screenshot, you might be omitted 'css reset'
edit: I find out sample app's github from that book, you can compare style file directly.

Finally I've found the error. I forgot } after footer so everything after footer was under its tag. Thanks #Leqna for answer

Related

How to increase padding around images in Jekyll

I have a Jekyll blog with GitHub pages and have an issue where images embedded in blog posts don't have any padding, meaning the text is too close to the image:
I'd like to specify the padding in the style.scss file so it's applied to all images in blog posts in the future. Where should I add a padding argument? Thank you!
---
---
//
// IMPORTS
//
#import "reset";
#import "variables";
// Syntax highlighting #import is at the bottom of this file
/**************/
/* BASE RULES */
/**************/
html {
font-size: 100%;
}
body {
background: $white;
font: 16px/1.4 $helvetica;
color: $darkGray;
}
.container {
margin: 0 auto;
max-width: 740px;
padding: 0 10px;
width: 100%;
}
h1, h2, h3, h4, h5, h6 {
font-family: $helveticaNeue;
color: $darkerGray;
font-weight: bold;
line-height: 1.7;
margin: 1em 0 15px;
padding: 0;
#include mobile {
line-height: 1.4;
}
}
h1 {
font-size: 30px;
a {
color: inherit;
}
}
h2 {
font-size: 24px;
}
h3 {
font-size: 20px;
}
h4 {
font-size: 18px;
color: $gray;
}
p {
margin: 15px 0;
text-align: justify;
}
a {
color: $blue;
text-decoration: none;
cursor: pointer;
&:hover, &:active {
color: $blue;
}
}
ul, ol {
margin: 15px 0;
padding-left: 30px;
}
ul {
list-style-type: disc;
}
ol {
list-style-type: decimal;
}
ol ul, ul ol, ul ul, ol ol {
margin: 0;
}
ul ul, ol ul {
list-style-type: circle;
}
em, i {
font-style: italic;
}
strong, b {
font-weight: bold;
}
img {
max-width: 100%;
}
// Fixes images in popup boxes from Google Translate
.gmnoprint img {
max-width: none;
}
.date {
font-style: italic;
color: $gray;
}
// Specify the color of the selection
::-moz-selection {
color: $black;
background: $lightGray;
}
::selection {
color: $black;
background: $lightGray;
}
// Nicolas Gallagher's micro clearfix hack
// http://nicolasgallagher.com/micro-clearfix-hack/
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
/*********************/
/* LAYOUT / SECTIONS */
/*********************/
//
// .masthead
//
.wrapper-masthead {
margin-bottom: 50px;
}
.masthead {
padding: 20px 0;
border-bottom: 1px solid $lightGray;
#include mobile {
text-align: center;
}
}
.site-avatar {
float: left;
width: 70px;
height: 70px;
margin-right: 15px;
#include mobile {
float: none;
display: block;
margin: 0 auto;
}
img {
border-radius: 5px;
}
}
.site-info {
float: left;
#include mobile {
float: none;
display: block;
margin: 0 auto;
}
}
.site-name {
margin: 0;
color: $darkGray;
cursor: pointer;
font-family: $helveticaNeue;
font-weight: 300;
font-size: 28px;
letter-spacing: 1px;
}
.site-description {
margin: -5px 0 0 0;
color: $gray;
font-size: 16px;
#include mobile {
margin: 3px 0;
}
}
nav {
float: right;
margin-top: 23px; // #TODO: Vertically middle align
font-family: $helveticaNeue;
font-size: 18px;
#include mobile {
float: none;
margin-top: 9px;
display: block;
font-size: 16px;
}
a {
margin-left: 20px;
color: $darkGray;
text-align: right;
font-weight: 300;
letter-spacing: 1px;
#include mobile {
margin: 0 10px;
color: $blue;
}
}
}
//
// .main
//
.posts > .post {
padding-bottom: 2em;
border-bottom: 1px solid $lightGray;
}
.posts > .post:last-child {
padding-bottom: 1em;
border-bottom: none;
}
.post {
blockquote {
margin: 1.8em .8em;
border-left: 2px solid $gray;
padding: 0.1em 1em;
color: $gray;
font-size: 22px;
font-style: italic;
}
.comments {
margin-top: 10px;
}
.read-more {
text-transform: uppercase;
font-size: 15px;
}
}
.wrapper-footer {
margin-top: 50px;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
background-color: $lightGray;
}
footer {
padding: 20px 0;
text-align: center;
}
// Settled on moving the import of syntax highlighting to the bottom of the CSS
// ... Otherwise it really bloats up the top of the CSS file and makes it difficult to find the start
#import "highlights";
#import "svg-icons";
I would modify your img tag in your style.scss...
change this...
img {
max-width: 100%;
}
to this...
img {
max-width: 100%;
padding: 5px;
}
if the image has it's own DIV use this...
.imageDiv img {
padding: 5px;
}

Ruby on Rails Tutorial - Ch 7 CSS issues

Im working my way through Michael Hartls Ruby on Rails tutorial and have run into a snag in while trying to get my style to match that of the tutorial. For whatever reason the changes that should be applied to the text in h1 under sidebar aren't going through and I cant find where the error in my code is.
This is his styling:
And this is mine:
This is the code in question.
#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 */
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;
}

Unfamiliar with Sass, I think there is a small syntax issue in my main.scss keeping me from compiling

I'm setting up a Jekyll page and the current theme I'm using uses Sass, but GitHub pages (where I'm hosting it) does not support Sass. So I'm trying to convert my .scss files to .css but I'm getting the an error on this file:
---
---
#import 'syntax';
$site-background-color: #f5f5f5;
$contrast-color: #333;
$azul-accent-color: #0070bb;
$ruby-accent-color: #e0115f;
$amber-accent-color: #ff7e00;
$avocado-accent-color: #568203;
/*============================================================================*/
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: $site-background-color;
border-top: 5px solid $contrast-color;
font-family: 'Source Sans Pro', sans-serif;
color: $contrast-color;
font-weight: 400;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, p, ul, ol, dl,
blockquote,
table,
img,
hr,
.fluid-width-video-wrapper,
.highlight {
margin-bottom: 20px;
}
blockquote {
padding: 0 30px;
border-left: 2px solid darken($site-background-color, 15%);
}
ul, ol {
margin-left: 40px;
}
img {
max-width: 100%;
height: auto;
border: none;
outline: none;
}
a {
text-decoration: none;
}
hr {
border : 0;
height: 25px;
background : url(/public/images/eagle.png) center center no-repeat;
}
code {
font-family: Consolas, "Liberation Mono", Courier, monospace;
font-size: .8rem;
}
p code {
padding: 0px 5px;
border: 1px solid #ddd;
background-color: #f8f8f8;
border-radius: 3px;
white-space: nowrap;
}
table {
border-collapse: collapse;
border: 1px solid $contrast-color;
td, th {
border: 1px solid $contrast-color;
padding: 5px 10px;
}
thead {
background-color: darken($site-background-color, 10%);
}
}
// TODO: make dt smaller
dt {
float: left;
width: 30%;
font-weight: bold;
}
dd {
float: right;
width: 70%;
}
footer {
font-size: .8rem;
text-align: center;
}
/*============================================================================*/
.azul { a { color: $azul-accent-color;
&:hover { color: darken($azul-accent-color, 20%);
}}}
.ruby { a { color: $ruby-accent-color;
&:hover { color: darken($ruby-accent-color, 20%);
}}}
.amber { a { color: $amber-accent-color;
&:hover { color: darken($amber-accent-color, 20%);
}}}
.avocado { a { color: $avocado-accent-color;
&:hover { color: darken($avocado-accent-color, 20%);
}}}
/*----------------------------------------------------------------------------*/
.highlight {
padding: 30px;
border-radius: 6px;
background-color: #272822;
color: #f8f8f2;
line-height: 1;
code {
font-size: .7rem;
}
}
.container {
max-width: 750px;
padding: 0 20px;
}
.center {
text-align: center;
}
.right {
float: right;
margin: 0 0 20px 20px;
}
.left {
float: left;
margin: 0 20px 20px 0;
}
.top-navbar {
margin-bottom: 40px;
height: 110px;
a {
display: inline-block;
color: $contrast-color;
padding: 66px 20px 25px;
margin-right: 10px;
margin-top: -5px;
text-transform: uppercase;
border-radius: 0 0 5px 5px;
border-bottom: 1px solid lighten($contrast-color, 10%);
transition: all ease-in-out .3s;
&:hover,
&.current-page {
color: $site-background-color;
border-bottom: none;
}
&:hover {
background-color: $contrast-color;
transform: translateY(5px);
}
&.current-page {
background-color: $contrast-color;
}
}
}
.archive,
.single {
margin-bottom: 100px;
}
.single {
font-size: 1.125rem;
line-height: 28px;
}
.single time {
color: #999;
font-size: .9rem;
}
.bundle {
border-top: 1px solid lighten($contrast-color, 50%);
padding-top: 10px;
margin-bottom: 10px;
}
.post-date {
text-align: right;
}
.not-found {
margin-top: 150px;
text-align: center;
font-size: 2rem;
}
.not-found h1 {
font-size: 8rem;
}
dl,
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
dl,
.clearfix:after {
clear: both;
}
/*============================================================================*/
#logo {
display: inline-block;
height: 110px;
width: 110px;
background-size: 90px 90px;
background-position: left center;
background-repeat: no-repeat;
}
/*============================================================================*/
#media screen and (max-width: 767px) {
.top-navbar {
height: 35px;
text-align: center;
margin-top: 40px;
a {
padding: 5px 10px;
margin: 5px;
border-radius: 0;
border: 1px solid $contrast-color;
transition: none;
&:hover {
transform: none;
}
}
}
.bundle,
.post-date {
text-align: center;
}
.bundle article {
margin-bottom: 30px;
}
#logo {
background-position: center center;
}
}
The error is:
Line 1: Invalid CSS after "-": expected number or function, was "--"
I imagine there is a quick fix for this that I am missing since I am not familiar with Sass at all. Am I right? Anyone know how I can fix this?
Also, I'm using the following command to convert from scss to css sass --watch main.scss:main.css if anyone knows of a better way please let me know!
Thanks for any help!
You have two lines of --- at the beginning of your file; what is it you think they're doing? Remove them, they're syntactically invalid and they're causing your errors.
Jekyll 2 brings native Sass compilation and the two lines of triple dashes are in fact required in order for Jekyll to compile the Sass file:
http://jekyllrb.com/docs/assets/
If you are not yet using Jekyll 2, then this will not work of course. If you are using Jekyll 2 then you can do this and no longer require a sass --watch command, Jekyll will do that automagically.
you probably had the same problem as me that the _config.yml is not at your root directory. If you don't want to change your file structure, you can set a new repo and add the jekyll files in a new gh-pages branch. I wrote a blog about it: http://shinshinwu.github.io/myblog/jekyll/update/2014/12/21/welcome-to-jekyll.html

ruby on rails: any change to custom.css.scss make the app crash

I'm learning rails. I have this problem and I hope you can help me.
HTTP answer code is 500 ... I am learning from a rails tutorial...
Site crashes after adding the style - /* sidebar */
This is my custome.css.scss:
#import "bootstrap";
/* mixins, variables, etc. */
$grayMediumLight: #eaeaea;
/* 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.7em;
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;
}
}
}
/* sidebar */
aside {
section {
padding: 10px 0;
border-top: 1px solid $grayLighter;
&: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;
}
and why the site falls due to renaming the comments? it the syntax language "SASS"?
other files https://gist.github.com/phantomass/7356307
The issue here may be the way you are using SASS comments and are having an issue with the compiled code.
I am not sure of your rails setup but I would take a look at the Rails asset preprocessing section
If you provide more information on your rails app I will try my best to resolve the issue.

Internet Explorer, when highlighting text it changes font and/or size

When highlighting text with IE 8 on a webpage that I'm currently developing the font changes and/or sometimes the size. The same thing happens sometimes when I hover over the menu.
This is how my css looks like and I don't know why the error occurs? One more thing that is very strange is that I have installed Windows 7 with paralells on my osx and the error does not occur there but only on PC computers. I have tried changing fonts but with no help...
This is my css:
body {
font-family: verdana, sans-serif;
font-size: 14px;
}
#wrapper, .wrapper {
width: 900px;
padding: 0 30px;
margin-left: auto;
margin-right: auto;
}
#header {
background: url('http://localhost:8888/wp-content/uploads/2012/09/120920_scam_banner.jpg') no-repeat;
height: 150px;
margin: 20px 0;
}
#header div {
width: 900px;
height: 150px;
margin-left: auto;
margin-right: auto;
position: relative;
background: none;
}
#header div a {
text-indent: -9999px;
position: absolute;
width: 900px;
height: 150px;
}
#header div a:hover {
background: none;
}
#section {
}
#menu {
float: left;
width: 175px;
padding: 20px 25px 0 0;
border-right: 2px solid #000;
text-align: right;
}
#menu a, a {
color: #000;
text-decoration: none;
}
.mp-formdiv {
float: right;
}
img {
border: 1px solid #000;
}
#menu a:hover, a:hover {
color: #fff;
background: #000;
}
.menu li {
margin: 3px 0;
text-align: right;
}
#menu h3 {
line-height: 52px;
}
#menu .artists {
padding-left: 10px;
}
#menu-artists li {
}
#content {
float: right;
width: 670px;
padding: 20px 0 50px 20px;
}
#footer {
overflow:hidden;
clear: both;
}
#white_footer {
float: left;
width: 300px;
background: #fff;
height: 20px;
}
#footer_content {
height: 20px;
}
.store {
overflow-y: scroll;
}
#the_store {
margin-top: 10px;
}
/* FONTS */
h1 {
font-size: 3em;
margin-bottom: 40px;
white-space: nowrap;
line-height: 0%;
}
h1.storefront {
font-size: 2em;
}
h2 {
font-size: 2em;
}
h3 {
font-size: 1.5em;
}
#content p strong {
font-weight: bold;
}
#content p img {
float: left;
margin: 5px 20px 20px 0;
}
#content p img:after {
margin-top: 20px;
}
#subscribe_mail input[type=text]{
width: 85px;
height: 12px;
font-size: 0.60em;
margin-bottom: 5px;
float: left;
margin-right: 4px;
}
#subscribe_mail input[type=text]:focus {
font-size: 0.75em;
}
#subscribe_mail input[type=submit] {
border: 1px solid #999;
font-size: 0.75em;
float: left;
}
.mp-message, .mp-loading {
font-size: 0.75em;
}
.MailPressFormName {
display: none;
}
#artist_info {
display: none;
margin-top: 40px;
overflow: hidden;
clear: both;
}
.more-less {
background: #000;
float: left;
color: #fff;
padding: 0 2px;
margin-top: 10px;
}
#artist_less {
display: none;
}
.gallery-icon a:hover {
background: none;
}
.gallery dl {
margin-top: 0 !important;
margin-bottom: 15px;
}
.gallery dl dd {
font-size: 0.75em;
}
.newsletterH {
margin-bottom: 5px;
}
I would use Firefox's Firebug plugin to see where the styles are coming from. IE provides a less friendly developer tool window that does something similar (I only use this if the style issue is only occurring in IE). I'd check your :hover and :focus rules first since those would cause things to happen on hover or select.

Resources