a { /* Affects all the links */
color: red;
}
ul li a { /* Affects all the links in lists */
color: green;
}
<div id="test">
<span>Text</span>
</div>
div#test span { color: green }
span { color: red }
div span { color: blue }
<div class="sidebar">Left floated sidebar</div>
.sidebar { /* Does it redefine `div.sidebar`?! */
float: right;
}
body .sidebar { /* Overwrites 'div.sidebar {}' */
float: left;
}
.navbar-inverse .navbar-nav>li>a { color: #999; }
#home-menu-container #home-menu li a { color: red; }
body #home-menu ul li a { color: blue !important; }
#content div div {
float: left;
}
100 pages in projects
.person div a {
color: pink;
}
Is it safe to remove this code?
Block__Element_Modifier
Block__Element_Mod_ModValue
#menu {
list-style: none;
}
#content div div {
color: red;
}
<ul class="menu">
<li class="item">Tab 1</li>
<li class="item">Tab 2</li>
</ul>
.menu .item {
/* styles for element */
}
<div class="panels">
<div class="item">
<ul class="menu">
<li class="item">Tab 1</li>
<li class="item">Tab 2</li>
</ul>
</div>
</div>
<div class="panels">
<div class="panels__item">
<ul class="menu">
<li class="menu__item">Tab 1</li>
<li class="menu__item">Tab 2</li>
</ul>
</div>
</div>
<ul class="menu">
<li class="menu__item current">Tab 2</li>
<ul>
.menu__item.current { /* combined selector */
background-color: red;
}
.menu__item.current {
background: white;
}
.menu_dark .menu__item {
background: black; /* Still white, baby */
}
library/
block1.css
project/
blocks/
block1.css
project.css
@import(../library/block1.css);
@import(blocks/block1.css);
prj/
blocks/
header/
header.css
header.js
header.tmpl
header.svg
header.md
project/
blocks/
header/
_theme/
header_theme_simple.css
header_theme_full.css
__logo/
header__logo.css
<ul class="menu">
<li class="menu__item">item</li>
<li class="menu__item menu__item_state_current">item2</li>
</ul>
{
block: 'menu',
content: [
{
elem: 'item',
content: 'item1'
},
{
elem: 'item',
elemMods: { state: 'current' },
content: 'item2'
}
]
}
<div width=120 height=200></div>
<div width=120 height=200></div>
<div width=120 height=200></div>
<div width=120 height=200></div>
<div width=120 height=200>
<div width=40 height=40>
<div width=34 height=34></div>
</div>
</div>
<div width=120 height=200></div>
.block
{
width: 120px;
height: 200px;
}
.block
{
width: 120px;
height: 200px;
}
.block
{
height: 220px;
background: red;
}
<div class="block" onclick="doSomething()"></div>
$('.block').doSomething();
<div class="block"></div>
<div class="another-block"></div>
$('.block').doSomething();
$('.another-block').switchClass('another-block', 'block');
BEM.decl('block', {
onSetMod: {
modifier1: {
value1: function() {
this.onM1V1();
},
'': function() {
this.onRemoveM1();
}
}
}
});
BEM.decl('block', {
onSetMod: {
modifier1: {
value1: function() {
this.onM1V1();
},
'': function() {
this.onRemoveM1();
}
}
}
});
BEM.decl('block', {
onSetMod: {
modifier1: {
value1: function() {
this.onM1V1();
...
});
BEM.decl('block', {
onSetMod: {
modifier1: {
value1: function() {
this.doSomethingElse();
...
});
var ctx = { temperature: 42 };
<div class="weather">
<div class="weather__inner">
{{temperature}}
</div>
</div>
<div class="weather">
<div class="weather__inner">
42
</div>
</div>
var ctx = { temperature: 42 };
var view = { block: 'weather' };
block('weather')(
tag()('ul'),
content()({
elem: 'inner',
content: ctx.temperature
}),
elem('inner')(
tag()('li')
)
);
<ul class="weather">
<li class="weather__inner">
42
</li>
</ul>
<audio controls src="campjs.mp3"></audio>
{ block: 'audio', hasControls: true, src: 'campjs.mp3' }