My Framework

Introduction

This is a framework built by me to easily be able to recreate styles and functions when building websites, and also to improve my skills. The framework is built with SASS and Angular 1, and made to be as flexible as possible for use in future projects. You can find the GitHub-repository for the project here.

Because of Angular this framework only works in Internet Explorer 9 or later browsers. All animations are made with CSS3 and might not work correctly in older browsers.

I have made two example pages with the framework for now. They are both one-page websites with similar structure but different themes.

Icons

The icon library is under construction. Currently these icons are at your disposal. The icons are displayed with a font made with Icomoon and are completely original. Since they are a font, they can be styled as text with color, shadows and font-size. To include an icon, add an empty i-element with the class-name displayed under the icon you want to use.

icon-asterisk

icon-check

icon-chevron_down_light

icon-chevron_left_light

icon-chevron_right_light

icon-chevron_up_light

icon-close

icon-globe

icon-heart

icon-help

icon-profile1

icon-profile2

icon-search

icon-star

icon-warning_circle

icon-warning_triangle

Basic Styles

Headings

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Links

Link

Buttons

Lists

Unordered lists

  • First item
  • Second item
  • Third item
  • First item
  • Second item
  • Third item

Add the class underline to your list for a different style.

Ordered lists

  1. First item
  2. Second item
  3. Third item
  1. First item
  2. Second item
  3. Third item

Add the class round to your list to show the numbers in circles.

Tables

Example Table
Table HeaderAnother HeaderA Third One
Footer content
DataMore DataEven more
DataMore DataEven more
DataMore DataEven more

Forms

Inputs & Textareas

Inputs and Textareas are created with the <form-section>-element. You need to define whether it's an input or textarea you want with the field-attribute. You can use most of the attributes you normally would on an their respective tags, such as type, disabled or placeholder. You can also use most of the Angular-specific attributes for inputs, for example ng-model or validation. Note that validation will only work if your input is inside of a form-element with a name-attribute on it, or an element with the ng-form-attribute. Other attributes you can use are:

  • field: Important for the directive to work. 'Input' or 'Textarea' for different elements.
  • label: What you want the label to say.
  • desc: If you want additional text under the label, for example detailing how the user should answer.
  • grid: True or false. Display the inputs and their labels next to instead of on top of each other.
  • id: Needed for label functionality.
  • icon: Which icon to add to the right side of the input.
Standard
Grid

Radio Buttons and Checkboxes

To make styling of these elements possible in the first place some CSS "hacks" are required. It is therefore recommended to start with these predefined directives and style them on your own from there if required. Instead of creating input-elements with different types you can now use the <radio-button> and <checkbox> elements. You can use the checked and disabled-attributes on these elements as you normally would, and they also work with ng-model.

  • id: Needs to be provided in order for the buttons to work. Important to use a unique ID for the element.
  • label: What you want the label to say.
Radio Buttons
Checkboxes

Select

You can use either regular select-elements (to the right) or the custom ones built for this Framework. Instead of select, you use the <dropdown>-element. The dropdown-element simulates a menu through lists, which allows for extensive styling and looks the same across different browsers, but it also contains a hidden regular select with all the values you might need for a form. You can use multiple or disabled as on a regular select-element.

  • options: Must be provided to render anything. Should be an array of objects. The name-property is what will be displayed to the user.
Custom
Regular

Grid

Set width

This is a flexible grid system built upon Flexbox. This means it is only fully functional in browsers later than Internet Explorer 9. A Fallback solution is planned but not implemented. Simply create a row-element, and then populate it with column-elements. If you need it to take up a certain amount of width, add any number between one and twelve as an attribute. Twelve fills the entire row. If the total number of columns is higher than twelve, the columns will automatically be contained to that row rather than keep their intended width.

OneTwoThreeSixFiveSevenTwelve

Dynamic Columns

If, however, you don't provide the columns with a number, they will adjust according to their content.

DynamicDynamicDynamicDynamicDynamicDynamicDynamicDynamic

Helper Classes

Responsive Embeds

For easy ability to make a video embed responsive, surround your embed with a div of the class video-wrapper. The video will never take up more than the width of it's container.

Text
Alignment

Use these classes for easy alignment of text.

text-left

text-center

text-right

Color

You can use the mute-class for a more discrete color.

Size

Use the big-class for a bigger font.

Use the normal-class for the original fontsize.

Use the small-class for a smaller font.

Other
Container

Add this class to a wrapping element to set a maximum width for your content. The width is determined in theme.scss.

Display

Add the inline, inline-block or block class to an element to easily display it as such.

Card

Each section on this row uses the card-class. This class adds a thin border around your content to separate it from the rest of the page.

Thumbnails
Thumbnail Image

Add the thumbnail-class to an image for a discrete frame.

Quick Backgrounds

Use primary-bg, secondary-bg, contrast-bg or invert-bg to add a background with the theme colors to your element.

primary-bg

secondary-bg

contrast-bg

invert-bg

Special Styles

Colored Words

This class adds a span element around every word within it. Be sure to use it only when the element contains nothing but text. Each span gets the class color-span, found in _helpers.scss and can be styled through that.

Use colored-words to get this effect

Image Orientation

If you add the attribute get-orientation on an image it will automatically get assigned a class depending on its orientation. If the width and height are equal, the image will get the class square. If the width is greater than the height, the image will get the class landscape. And finally, if the height is greater than the width, the image will be assigned the class portrait.

Mixins

Basic

color-bg

Adds a background color to your element and calculates a readable text color for it. Supply the $color.

circle

Makes the element a circle. You can specify $width and $height, but if you don't the circle will be responsive and take up the width of the parent.

Media Queries

See and adjust the different breakpoints in theme.scss. The breakpoints are called small, medium, desktop and large. Instead of writing a full media query each time you need one you can just include on followed by the breakpoint-name, so for example special styling for medium devices would go into onMedium(), followed by brackets and the content.

Containers

colorArrow

Include this mixin to create a solid colored arrow on your containing element. Include the mixin in a pseudo class in your container, either before or after. This allows you to use up to two different arrows per element. The container needs to have position:relative.

up

down

left

right

up inverse

down inverse

left inverse

right inverse

before:up after:down

before: left inverse

after: right inverse

before: left pos:15px

after: up pos:80%

before: left

after: left inverse

imageArrow

If you're looking to make an inverse arrow please use the colorArrow mixin. However, if you are looking to create an arrow from a container with a background image, this is the mixin you should use. It's not as flexible and should not be included in a pseudo-class, it should rather be included in the containing element itself. Currently the arrow can only appear in the middle.

  • $direction:Can be set to up, down, left or right. Defaults to down.
  • $bg: The background of the container to give a transparent effect. Defaults to the theme's background color.
  • $size: Size of the arrow. Defaults to 15px.

arrow-image up

arrow-image down

arrow-image left

arrow-image right

slant

To get a fully slanted container include the slant-mixin. Insert your content into a div with the class content inside of your container for the content not to skew. To automatically surround everything within the container with the content-class, add the class slanted to your container. You can include the mixin in a class called slanted to make it simple.

  • $direction: Can be set to x or y. Defaults to y.
  • $deg: How many degrees to slant the container. Provided in pure numbers, not degrees. Defaults to 2.

slant y 2

slant y -2

slant x 2

slant x -2

slantEdge

To add a skewed edge in a solid color, include slantEdge in a pseudo class of your container, either before or after. This allows you to combine up to two different edges per element. The container needs to have position:relative.

  • $edge: Can be set to top, bottom, left or right. Defaults to top.
  • $deg: How many degrees to slant the edge. Provided in pure numbers, not degrees. Defaults to 2 and must be bigger than 1.
  • $color: Which color the added slant should appear in. Defaults to the parent element's background color.
  • $reverse: Can be set to true or false. Determines which way to slant the edge. Defaults to false.

top

bottom

left

right

before: left reverse

after: bottom

before: top 5

after: top 5 reverse

slantImage

To add a skewed edge to a container with a background image, include slantImage directly in the container. Since some rules for the container are very important, the pseudo-class is instead determined by the parameters you enter.

  • $edge: Can be set to top, bottom, left or right. Defaults to top.
  • $deg: How many degrees to slant the edge. Provided in pure numbers, not degrees. Defaults to 5.
  • $bg: The color behind the container to simulate transparency. Defaults to the theme's background color.
  • $pseudo: Can be set to before or after. Determines which pseudo-element should contain the edge. Defaults to before.
  • $reverse: Can be set to true or false. Determines which way to slant the edge. Defaults to false.

top

bottom

right

left reverse

right 10 before

left 10 after

top 10 before

bottom 10 after

fade

To add a fade to an edge, include fade.

  • $edge: Can be set to top, bottom, left or right. Defaults to top.
  • $size: How big the fade should be. Defaults to 30px.
  • $blur: How blurred the fade should be. Defaults to 10px.
  • $color: Which color the edge should fade into. Defaults to the theme's background color.

all

top

bottom

left

right

Text

headings

Style several headings at once using the headings-mixin. Specify from and to which number the rules should apply as parameters. @include headings(1, 3){color:red;} for example would apply red to h1 through h3.

  • $from: From which heading the rules should apply. Defaults to 1.
  • $to: From which heading the rules should stop applying. Defaults to 6.

lineThrough

Include lineThrough to get the effect of a line running behind your text. This will only work for text on one line.

  • $left: How far the left side of the line should go. Defaults to 45%.
  • $right: How far the right side of the line should go. Defaults to 45%.
  • $color: Which color the line should have. Defaults to $blend-color-low.
  • $thickness: How thick the line should be. Provided in pure numbers, not sizes. Defaults to 1.
  • $style: Which border style the line should have. Solid, dashed, dotted, ridge, groove and double work. Defaults to solid.
Line
Line-left
Line-right

Other

cornerRibbon

Include this mixin on an element to make it appear as a ribbon in the corner of its parent. The parent should have position: relative and probably overflow: hidden.

top left

Example Text

top right

Example Text

bottom left

Example Text

bottom right

Example Text

Galleries

Structure

There are several types of ready-made image galleries available. The common thing for each of them is that they require and image-attribute, where you supply an array of image-objects. Each object should have the properties src (the image source) and alt (alternative text for the image). You can also supply desc as a property, for a description of the image to show up along with it.

Modal Gallery

This is a standard gallery created with the tag modal-gallery. It will show all the images supplied in cropped divs, and if you click on a picture it's displayed in a modal. Five pictures will be shown on each row in desktop, and two on mobile.

Slide Gallery

This gallery is created with the tag slide-gallery. You can provide a number to the attribute previews to determine how many preview images should be shown at the bottom. This gallery does not open a modal, instead it previews the picture selected above the previews. You can also browse the previews by using the arrow buttons next to them.

Masonry Gallery

This gallery is created with the tag masonry-gallery. Inspired by the popular masonry-layout, this gallery adds each image to a set width column and pile the images on top of each other despite orientation. You can add the attribute columns with a number, which will determine how many columns it will be split up into, default is three.