html - Nested Sass accessing -
html - Nested Sass accessing -
i'm new css , sass. i'm not sure how alter appearance of page. i've been reading sass documentation , thought i'd play around little twitter bootstrap seek , practice.
sample code:
<div class="user_nav"> <div class="navbar-wrapper"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">jobpost</a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav">
if alter css of class navbar-header, scss code?
.user_nav { .navbar-wrapper { .container { .navbar-header { alter here } } } }
what need know sass these kind of frameworks best not override new css override sass parameters defining colors/typography etc. of framework.
for illustration bootstrap can _variables.scss on can change. illustration lookup navbar , find:
$navbar-height: 50px !default;
now if want override this, can long redefine sass parameter after you've imported _variables.scss file. if @ bootstrap.scss you'll find frameworks effort @ splitting of in components. ie next first lines bootstrap.scss:
// core variables , mixins @import "bootstrap/variables"; @import "bootstrap/mixins"; // reset , dependencies ...
then farther downwards you'll see components listed, can leave out components don't utilize avoid bloating css files. instead of using bootstrap.scss, can create own re-create of file, , remove components dont need - aswell redefine parameters set in variables if needed. ie: (mybootstrap.scss):
// core variables , mixins @import "bootstrap/variables"; @import "bootstrap/mixins"; //override navbar height $navbar-height: 150px; //you want omit !default assigns variable if doesn't have value already. // reset , dependencies ...
in cases can't around without adding additional css override styles of framework. want lookup whatever want override in sass files. forexample if in bootstraps _navbar.scss component file sick find that:
.navbar-header { @include clearfix(); @media (min-width: $grid-float-breakpoint) { float: left; } }
meaning add together next in _customoverrides.scss file import @ end of mybootstrap.scss - in order override illustration navbar-header breakpoint grid-float.
.navbar-header { @media (min-width: 500px) { float: left; } }
hope tips help - , i'm sure 1 time used sass workflow you'll never go back! :)
html css sass
Comments
Post a Comment