Skip to content

Add CSS #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 46 commits into
base: solution
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
2023e84
adds graphic
drakeltheryuujin Aug 9, 2019
1d3a0a7
Bump nokogiri from 1.10.3 to 1.10.4
dependabot[bot] Nov 1, 2019
05f0e72
Update README.md
timothylevi Sep 11, 2020
4ccfa39
Bump json from 2.2.0 to 2.5.1
dependabot[bot] Jan 12, 2021
655f393
update for phase 0
maxwellbenton Jan 12, 2021
39dfe79
add git push messaging
maxwellbenton Jan 13, 2021
6f05cbe
Typo fix
lizbur10 Jan 20, 2021
001a45c
Merge pull request #2 from learn-co-curriculum/dependabot/bundler/jso…
lizbur10 Mar 1, 2021
3a45e9b
AUTO: Fix typo
maxwellbenton Apr 1, 2021
4921a48
Bump nokogiri from 1.10.4 to 1.11.4
dependabot[bot] May 20, 2021
cdc56ac
Merge pull request #3 from learn-co-curriculum/dependabot/bundler/nok…
lizbur10 Jun 30, 2021
cfb6c33
Check for rel attribute in stylesheet link
kevinebaugh Jul 1, 2021
876ba05
Merge pull request #4 from kevinebaugh/rpec-update-check-for-rel-attr…
lizbur10 Jul 1, 2021
6226564
AUTO: Added .canvas file and github workflow
lizbur10 Jul 7, 2021
3fe7227
AUTO: switched to prework workflow
lizbur10 Jul 7, 2021
31d6df8
AUTO: removed incorrect workflow
lizbur10 Jul 7, 2021
0a8e86e
Bump addressable from 2.6.0 to 2.8.0
dependabot[bot] Jul 13, 2021
f3a6143
Merge pull request #5 from learn-co-curriculum/dependabot/bundler/add…
graciemcguire Jul 14, 2021
611d1e6
AUTO: updated workflow to html version
lizbur10 Jul 30, 2021
7ed75fd
Fixed formatting
ihollander Aug 4, 2021
8e29c52
bash -> console
ihollander Aug 23, 2021
f1104ba
Updated tests for mocha (#8)
ihollander Nov 22, 2021
c24f7d7
Shape up prework (#10)
lizbur10 Dec 17, 2021
64e3e49
Use csstree-validator to validate CSS (#12)
ihollander Dec 28, 2021
f3b4928
Bump minimist from 1.2.5 to 1.2.6
dependabot[bot] Mar 31, 2022
8dce16d
- change test to permit background-color property
thompsonplyler Apr 20, 2022
9956227
Merge pull request #15 from learn-co-curriculum/background-color-test…
lizbur10 Apr 25, 2022
6583a99
Switch from image to table
lizbur10 Sep 20, 2022
f484b4a
Merge pull request #20 from learn-co-curriculum/issue-fix
lizbur10 Sep 20, 2022
801a262
Merge pull request #14 from learn-co-curriculum/dependabot/npm_and_ya…
lizbur10 Sep 20, 2022
32a6188
Bump nanoid and mocha
dependabot[bot] Sep 20, 2022
7b5344c
Merge pull request #21 from learn-co-curriculum/dependabot/npm_and_ya…
lizbur10 Sep 20, 2022
739f8d2
Update .canvas file
lizbur10 Nov 23, 2022
09b6ec4
add require to test file
jlboba Dec 7, 2022
f7c4beb
remove old prep from .canvas file
lizbur10 Dec 10, 2022
d0493ce
fix test error
jlboba Dec 12, 2022
8c07a47
Merge pull request #24 from learn-co-curriculum/update-canvas-file
lizbur10 Dec 14, 2022
f2b21bc
update workflow
jlboba Dec 16, 2022
ccf9cd6
update for codegrade
lizbur10 Dec 22, 2022
8b4fccc
Add reminder
lizbur10 Dec 27, 2022
4b0ccd8
Bump tough-cookie from 4.0.0 to 4.1.3
dependabot[bot] Jul 9, 2023
c573dde
Merge pull request #26 from learn-co-curriculum/dependabot/npm_and_ya…
lizbur10 Jul 10, 2023
53178f1
Bump word-wrap from 1.2.3 to 1.2.4
dependabot[bot] Jul 19, 2023
23d5e0d
Merge pull request #27 from learn-co-curriculum/dependabot/npm_and_ya…
lizbur10 Jul 19, 2023
e211f49
AUTO: replace github workflow
lizbur10 Nov 17, 2023
7bcc182
add css styling
Lsimmons98 May 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .canvas
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
:lessons:
- :id: 218933
:course_id: 6602
:canvas_url: https://learning.flatironschool.com/courses/6602/assignments/218933
:type: assignment
31 changes: 31 additions & 0 deletions .github/workflows/canvas-sync-ruby-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Sync with Canvas Ruby v2.7

on:
push:
branches: [master, main]
paths:
- 'README.md'

jobs:
sync:
name: Sync with Canvas

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7

- name: Install github-to-canvas
run: gem install github-to-canvas

# Secret stored in learn-co-curriculum Settings/Secrets
- name: Sync from .canvas file
run: github-to-canvas -a -lr
env:
CANVAS_API_KEY: ${{ secrets.CANVAS_API_KEY }}
CANVAS_API_PATH: ${{ secrets.CANVAS_API_PATH }}
3 changes: 0 additions & 3 deletions .rspec

This file was deleted.

7 changes: 0 additions & 7 deletions Gemfile

This file was deleted.

47 changes: 0 additions & 47 deletions Gemfile.lock

This file was deleted.

113 changes: 66 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,30 @@

## Introduction

HTML's role in our websites is to provide structure, content, and link
resources (e.g. CSS files). Its role in describing the style ("presentation")
of content is minimal. HTML's ability to style is pretty much limited to
"pretty good" defaults.
HTML's role in our websites is to provide structure, content, and link resources
(e.g. CSS files). Its role in describing the style ("presentation") of content
is minimal. HTML's ability to style is pretty much limited to "pretty good"
defaults.

In order to further customize the style, appearance, and interactive behavior
of our websites, we turn to Cascading Style Sheets, or CSS. In this lab, we
will work on implementing CSS declarations in our HTML.
In order to further customize the style, appearance, and interactive behavior of
our websites, we turn to Cascading Style Sheets, or CSS. In this lab, we will
work on implementing CSS declarations in our HTML.

## Writing HTML vs. Writing CSS

| | HTML | CSS |
| ----------- | ---- | --- |
| Deals with: | Content layer | Presentation layer |
| Concerns: | Structure, hierarchy & meaning | Aesthetic & display |
| Questions: | - Should the order of items within a list matter? | - Should the layout of the text be in a single or double column? |
| | - Should we wrap a list of links inside a navigation tag? | - Should we use a different font color for the header? |
| | - Is this the most important header in the HTML document? | - How should the content appear on a desktop vs. a mobile device? |

## Getting Started

**Fork and clone** this lesson into your local environment. Navigate into its
directory in the terminal, then run `code .` to open the files in Visual Studio
Code.

## Import a CSS File in Our HTML

Expand All @@ -23,72 +39,74 @@ First things first: we need to make sure our HTML is loading our style sheet.
We have two options:

1. Write CSS rules inside of a `<style>` tag ("internal CSS"), which tells HTML
"Hey, I want to define some CSS styling here
"Hey, I want to define some CSS styling here."
2. Write CSS rules in an external file that is specified with the `<link>` tag
("external CSS").

In our case, we want to provide a link to our style sheet, instead of writing
all of our CSS code directly in the `<style>` tag. This allows us to only have
all of our CSS code directly in the `<style>` tag. This allows us to only have
to write styles for the entire site once, instead of repeating every `<style>`
element on every page. A common workflow is to see developers work on CSS
inside of the `<style>` tag until their styling is done. At that point they
move it to their external file and remove the `<style>` element from the HTML
page. Feel free to try it out!
element on every page. A common workflow is to see developers work on CSS inside
of the `<style>` tag until their styling is done. At that point they move it to
their external file and remove the `<style>` element from the HTML page. Feel
free to try it out!

In `index.html`, provide a `<link>` tag which correctly sources the CSS file
located in this directory. The `<link>` tag will link to our file with an
`href` attribute, like so:
located in this directory. The `<link>` tag will link to our file with an `href`
attribute, like so:

```HTML
<link rel="stylesheet" href="relative path to CSS file">
```html
<link rel="stylesheet" href="relative path to CSS file" />
```

The `href` attribute should point to the file `style.css` which is located in
this directory using a _relative path_. The `rel` attribute is used to note
that the file which is being linked has a **rel**ation of being a "stylesheet."

Now, what is a relative path? You could write `href="style.css"` and the
content of `style.css` would change your `index.html` file. But we want to
teach you to require external resources (like CSS or JavaScript) by using
_relative paths_. Relative paths make it _crystal clear_ which file is being
used. Relative paths start with `./` which means "from the directory I am
currently in." So, when we use `link` to associate with a style sheet and we
write `href="./style.css"` we're saying: "From the directory in which I, the
`index.html` file live, look for a file called `style.css` and use it. This
pattern will help you and other developers remove any possible confusion.

```HTML
<link rel="stylesheet" href="relative path to CSS file">
this directory using a _relative path_. The `rel` attribute is used to note that
the file which is being linked has a **rel**ation of being a "stylesheet."

Now, what is a relative path? You could write `href="style.css"` and the content
of `style.css` would change your `index.html` file. But we want to teach you to
require external resources (like CSS or JavaScript) by using _relative paths_.
Relative paths make it _crystal clear_ which file is being used. Relative paths
start with `./` which means "from the directory I am currently in." So, when we
use `link` to associate with a style sheet and we write `href="./style.css"`
we're saying: "From the directory in which I, the `index.html` file live, look
for a file called `style.css` and use it. This pattern will help you and other
developers remove any possible confusion.

```html
<link rel="stylesheet" href="relative path to CSS file" />
```

Links to style sheets should go at the end of the `<head>` section! Make sure you
provide a _relative_ path to the style sheet.
Hint: Open `index.html` in the browser. You can test whether your link is working or not by the color of your headline. If it's red, it's working! If it's black, keep going - you'll get it.
Links to style sheets should go at the end of the `<head>` section! Make sure
you provide a _relative_ path to the style sheet. Hint: Open `index.html` in the
browser. You can test whether your link is working or not by the color of your
headline. If it's red, it's working! If it's black, keep going - you'll get it.

## Implement CSS Declarations

Now, we are going to create some CSS declarations and add styling to our
document! First, open `index.html` in the browser to get a good idea of what
[our un-styled page][unstyled] page looks like.
[our un-styled page][un-styled] page looks like.

What we would really like is [something a little more jazzed up][styled]! Let's
work towards that. Set the following _properties_ to specific _values_. Make
sure to, after each update, look at `index.html` in the browser to see how it has
changed:
sure to, after each update, look at `index.html` in the browser to see how it
has changed:

- Set the `background` of the `<body>` element (whole document) to `#00b3e6` (light blue)
- Set the `background` of the `<body>` element (whole document) to `#00b3e6`
(light blue)
- Set the `<div>` elements:
- `width` to `700px`
- `margin` to `auto` (centers our element)
- `font-family` to `"Helvetica Neue"`
- `background` to `white`
- `padding` to `30px` (creates an invisible space around the element)
- Set the element with the id of `#main-header` to a `font-size` of `22px`
- Set the elements with the class of `.perspective-questions` to a `font-style` of `italic`

Run `learn` to test your work and `learn submit` once you've passed all the
tests.
- Set the elements with the class of `.perspective-questions` to a `font-style`
of `italic`

Run `npm test` to test your work. Remember to push and submit your work using
CodeGrade when you're done.

## Conclusion

Expand All @@ -97,10 +115,11 @@ follow the 'cascading' rule set. This enables us to keep our HTML clean and
simple to read, without sacrificing the customization that we have come to
expect on websites.


## Resources
- [W3 Introduction to CSS](https://www.w3schools.com/Css/css_intro.asp)

[unstyled]: https://curriculum-content.s3.amazonaws.com/web-development/unstyled-codepen.jpeg
[styled]: https://curriculum-content.s3.amazonaws.com/web-development/styled-intro-to-css.png
- [W3 Introduction to CSS](https://www.w3schools.com/Css/css_intro.asp)

[un-styled]:
https://curriculum-content.s3.amazonaws.com/web-development/unstyled-codepen.jpeg
[styled]:
https://curriculum-content.s3.amazonaws.com/web-development/styled-intro-to-css.png
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Introduction to CSS Lab</title>
<!-- Your code here! -->
<link rel="stylesheet" href="./style.css" />
</head>

<body>
Expand Down
Loading