1.1.0 • Published 7 years ago

p-reset v1.1.0

Weekly downloads
10
License
ISC
Repository
github
Last release
7 years ago

(P)reset

A simple, lightweight LESS Framework.

npm version Bower version

(More info and better docs soon)

Vars

VarFunction
Fonts
@bodyfontFont used in general text.
@titlefontFont for titles (h1 / h3 / h5).
Shades
@white / @lightgray / @gray / @black
@backgroundBackground color.
@colorText color.
Colors
@accentThe main color. Used in buttons/inputs, .info/.message boxes and titles.
@complComplementary color.
@success / @error / @warnColors for .info/.message boxes and buttons/inputs.
Sizes
@basefontGeneral font size.
@baselineGeneral
@navheightHeight for the nav menu.
@pagePadding@baseline * 6;
@pagePadding--tablet@baseline;
@pagePadding--phone@baseline / 2;
Others
@laptop / @tablet / @phoneMedia Query Breakpoints.
@cubic-bezierMain easing function.
@bradMain border-radius. Used in buttons/inputs and .info/.message boxes.

Columns / Grid

So, columns.

All you need is an element with a .row-(n) class (in this case, the default is .row-12), and inside, the .col-(n) elements. In case you need gutters, wrap it all inside a .gutt.

Default Breakpoints

VarClassMedia Query
.col-(n)
@tablet.col-sm-(n)max-width: 900px
@phone.col-xs-(n)max-width: 600px

Examples

Without Gutters

<div class="row-12">
	<div class="col-sm-12 col-4">
		I'm full-width on tablets and phones, and 1/3 on bigger screens.
	</div>
	<div class="col-xs-12 col-sm-6 col-4">
		We're full-width on phones, 1/2 on tablets, and 1/3 on bigger screens.
	</div>
	<div class="col-xs-12 col-sm-6 col-4">
		We're full-width on phones, 1/2 on tablets, and 1/3 on bigger screens.
	</div>
</div>

With Gutters

<div class="gutt">
	<div class="row-12">
		<div class="col-sm-12 col-4">
			I'm full-width on tablets and phones, and 1/3 on bigger screens.
		</div>
		<div class="col-xs-12 col-sm-6 col-4">
			We're full-width on phones, 1/2 on tablets, and 1/3 on bigger screens.
		</div>
		<div class="col-xs-12 col-sm-6 col-4">
			We're full-width on phones, 1/2 on tablets, and 1/3 on bigger screens.
		</div>
	</div>
</div>

Note that the idea behind (P)reset is to tweak it to better serve your needs.

So if, for example:

  • 12 columns are not enough;
  • The gutters are not the size you wanted;
  • You could use one or two more breakpoints, or change when the current ones are triggered;
  • ... feel free to change it! (Cool, but ... How?)

Also, keep in mind that, unlike other frameworks (i.e. Bootstrap), this grid layout is not mobile-first. So only the col- size is required, instead of the mobile (col-xs-) size.

Classes

ClassFunction
.shadowAdds a box shadow to the element.
.inputStyles an element like an input.
.button / .btnStyles an element like a button.
.bigMake the button bigger.
.hoverStyle the button as it was hovered.
.no-shadowRemoves shadow from the button.
.activeStyle the button as it was active.
Colors
.border-(color)Change the border color of an element. (i.e. '.border-black')
.color-(color)Change the text color of an element. (i.e. '.color-white')
.bg-(color)Change the background color of an element. (i.e. '.color-acc')
Fonts
.font-titleChange the element's font to the @titlefont.
.font-bodyChange the element's font to the @bodyfont.
Text Aligns
.talignleftAlign the elements text to the left.
.taligncenterAlign the elements text to the center.
.talignrightAlign the elements text to the right.
Margins / Paddings
.page-padding
.page-margin
.no-paddingRemoves all padding from an element.
.no-marginRemoves all margins from an element.
.paddingAdds a padding of @baseline to the element.
.padding-halfAdds a padding of (@baseline / 2) to the element.
.padding-sidesAdds a padding of @baseline to the left and right sides of the element.
.padding-endsAdds a padding of @baseline to the top and bottom sides of the element.
Media Hides
.laptop-hideHide the element on laptops (and above).
.tablet-hideHide the element on tablets (and below).
.phone-hideHide the element on phones.
Width
.full-width / .width-100Set the element's width to 100%.
.half-width / .width-50Set the element's width to 50%.
Border Radius
.brad / .b-radSet the element's border-radius to the value defined in vars.less
Info / Message
.info / .message
.warn / .warning
.yes / .accept / .success / .succ
.no / .cancel / .error / .err

Useful Tweaks


TODO

  • Footer - Always on bootom fix
  • Add tooltips
  • Add saturation var to .shadow()
  • Test something like ~'(min-width: @tablet + 1)'
  • Change table styles
  • Change the god damn .info class to something else
  • Consider adding a, a:link, a:visited, a:focus, a:hover, a:active{ color: inherit; } :not(nav){ a, a:link, a:visited, a:focus, a:hover, a:active{ text-decoration: none; } }
  • Add WordPress Gallery Support