Ones from freeCodeCamp
- Class naming convention:
.some-class { fontWeight: 10em }
- BEM naming convention (stickMan example):
.stick-man__head {} .stick-man__arms {} .stick-man__feet {} .stick-man--blue {} .stick-man--red {} .stick-man__head--small {} .stick-man__head--big {}
- Use js- class names
<div class="site-navigation js-site-navigation"></div>
const nav = document.querySelector('.js-site-navigation')
- Don’t use data attributes
- Write More CSS Comments
- add spaces in html with angular
{{}}to prevent elements collapsing. e.g.<div>{{{client.id}}} </div>
- centering div inside col-xx-nn
div {
display: table;
margin: auto;
}<div class="dropdown-menu-scroll">
<div><div>
<!-- ... -->
</div>
.dropdown-menu-scroll {
overflow-y: scroll;
height: 1000%;
}Note: display:none has not opposites!
div {
position: absolute;
left: -999em;
}selecting an element by parent class and current class (NO WORRIES IF CLASSES IN MIDDLE)
.outer-class .current-class {
}both classes at the same time
.a.b {
}not having a class
:not(.clazzz) {
}<div class="mobileShow">TEXT OR IMAGE FOR MOBILE HERE</div><style type="text/css">
.mobileShow {display: none;}
/* Smartphone Portrait and Landscape */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px){
.mobileShow {display: inline;}
}
</style><div class="mobileHide"> TEXT OR IMAGE NOT FOR MOBILE HERE </div><style type="text/css">
.mobileHide { display: inline; }
/* Smartphone Portrait and Landscape */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px){
.mobileHide { display: none;}
}
</style>- install sass
- run
sass --watch assets/scss/app.scss:assets/css/app.css(example of path)
[scelia@job Project_folder]$ tree
.
├── assets
│ ├── css
│ │ ├── app.css
│ │ ├── app.css.map
│ │ └── modules
│ ├── fonts
│ ├── images
│ │ ├── phone.svg
│ │ ├── Wind-Turbine-front@2x.png
│ │ ├── Wind-Turbine-left@2x.png
│ │ └── Wind-Turbine-right@2x.png
│ ├── js
│ │ ├── app
│ │ │ └── app.js
│ │ └── lib
│ └── scss
│ ├── app.scss
│ └── modules
├── company-dashboard-2-1.html
├── css
│ ├── app.css
│ ├── app.css.map
│ └── index.css
└── oldo_main.html
11 directories, 15 files
[scelia@job Project_folder]$
example bootstrap-less
<div className="form-group col-md-6 " >
<div className="btn-container">
<button className="btn btn-primary" >
<p>Save</p>
</button>
</div>
</div>.btn-container {
position: absolute;
bottom: 0;
right: 0;
}