out

Youth violence, resilience, and rehabilitation [electronic resource] / Joan Serra Hoffman

Hoffman, Joan Serra, 1960-




out

Youthscapes [electronic resource] : the popular, the national, the global / edited by Sunaina Maira and Elisabeth Soep




out

YouTube and video marketing [electronic resource] : an hour a day / Greg Jarboe

Jarboe, Greg, 1949-




out

Zamumo's gifts [electronic resource] : Indian-European exchange in the colonial Southeast / Joseph M. Hall, Jr

Hall, Joseph M




out

Zapata lives! [electronic resource] : histories and cultural politics in southern Mexico / Lynn Stephen

Stephen, Lynn




out

Zend Framework 2 cookbook [electronic resource] : a guide to all the ins and outs of Zend Framework 2 features / Josephus Callaars

Callaars, Josephus




out

Outcomes of Left Ventricular Assist Devices by Bridge to Transplant or Destination Therapy Intent

This prespecified secondary analysis of the MOMENTUM 3 randomized clinical trial aims to determine whether clinical outcomes of patients with 2 different left ventricular assist devices differed based on preoperative categories of bridge to transplant/bridge to candidacy vs destination therapy.




out

Identification of Cardiovascular Monosodium Urate Crystal Deposition in Gout Using Dual-Energy CT

To the Editor We read the recent article by Klauser et al with great interest. While the potential implications of the findings are exciting, we have several concerns. First, the authors do not explicitly state whether electrocardiogram gating was used in their study. This is an important detail because cardiac motion artifact is a source of artifactual coloration with dual-energy computed tomography (DECT), particularly with dual-source scanners given the approximately 80-millisecond temporal difference between the 2 radiography beams. Furthermore, beam hardening artifact from calcified atheromas and partial volume effect, known sources of artifacts in the 2-material decomposition algorithm of DECT, may largely explain the findings. While patients with gout had higher prevalence of coronary calcification (55 of 59 patients [93%]) and cardiovascular monosodium urate (MSU) deposition (51 of 59 patients [86%]) than controls, the authors do not report whether the 4 patients with gout without coronary calcifications exhibited MSU deposition nor the number of controls or cadaveric hearts with coronary calcification. The images from the article show areas of green pixelization occurring adjacent to calcified plaques on grayscale computed tomography images (eg, Figure 2A and D, left anterior descending artery [yellow arrowhead]), which would favor this artifact hypothesis without additional data.




out

Identification of Cardiovascular Monosodium Urate Crystal Deposition in Gout Using Dual-Energy CT—Reply

In Reply We appreciate the valuable comments of Becce et al on our article. We applied prospective electrocardiography gating using a thin-slice cardiac protocol to ensure highest spatial resolution with minimal motion artifact. A noncontrast electrocardiography-gated computed tomography (CT) examination with standardized scan parameters was performed using a 128-slice dual-source CT (SOMATOM Definition Flash; Siemens) with a detector collimation of 2 × 64 × 0.6 mm, rotation time of 0.28 seconds, and prospective electrocardiography triggering for heart rates less than 65 beats per minute (diastolic padding, 70% of RR interval) and more than 65 beats per minute (systolic padding, 40% of RR interval). Axial images were reconstructed with 0.75-mm slice width, increment of 0.5, and a medium-smooth convolution kernel (B26f). When motion artifact was present, it was distinguished by visual analysis of an experienced observer and colorized pixels related to motion were excluded.




out

Inpatient PCI Volume and Transcatheter Aortic Valve Replacement or Mitral Valve Repair Outcomes

This cross-sectional study investigates whether hospital inpatient percutaneous coronary intervention volume is associated with rates of 30-day risk-adjusted mortality and hospital readmission after transcatheter aortic valve replacement and transcatheter mitral valve repair.




out

Association of Outcomes With the Severity of Regurgitant Volume Relative to End-Diastolic Volume

This Special Communication analyzes the conclusions drawn from effective regurgitant orifice area analysis and end-diastolic volume analysis from 2 randomized clinical trials to assess disparities in the different clinical outcomes.




out

As P Chidambaram and Yashwant Sinha duke it out, at least it's on issues that matter

As polls come closer arrows are flying thicker, faster, sharper. Some are of time-honoured design, others quite modern. Included in the first category is flaming a party leader as communal or dissing her for being in the Italians’ pocket.




out

Routledge handbook of national and regional ocean policies / edited by Biliana Cicin-Sain, David L. VanderZwaag, and Miriam C. Balgos




out

Conservation education and outreach techniques / Susan K. Jacobson, Mallory D. McDuff, and Martha C. Monroe

Jacobson, Susan Kay, author




out

Stressors in the marine environment : physiological and ecological responses; societal implications / edited by Martin Solan (University of Southampton, UK), Nia M. Whiteley (Bangor University, UK)




out

Population biology of the sand dollar, Peronella lesueuri, in Cockburn Sound, southwest Australia / Sharon Yeo Sue-Yee

Yeo, Sue-Yee Sharon, author




out

Introduction to physical oceanography / John A. Knauss (late of University of Rhode Island), Newell Garfield (Southwest Fisheries Science Center)

Knauss, John A., author




out

Marine plankton : a practical guide to ecology, methodology and taxonomy / edited by Claudia Castellani (Sir Alister Hardy Foundation for Ocean Science, Plymouth, UK) and Martin Edwards (Sir Alister Hardy Foundation for Ocean Science, Plymouth, UK and Uni




out

Water issues in Southeast Asia : present trends and future directions / edited by Lee Poh Onn




out

Estuarine and coastal hydrography and sediment transport / edited by R.J. Uncles (Plymouth Marine Laboratory), S.B. Mitchell (University of Portsmouth)




out

National park science : a century of research in South Africa / Jane Carruthers (University of South Africa, Pretoria, South Africa)

Carruthers, Jane, author




out

The rise of marine mammals : 50 million years of evolution / Annalisa Berta ; graphics editor, James L. Sumich ; illustrations by Carl Buell, Robert Boessenecker, William Stout, and Ray Troll

Berta, Annalisa, author




out

Hydrology and best practices for managing water resources in arid and semi-arid lands / Christopher Misati Ondiekiand, Kenyatta Universiity, Johnson U. Kitheka, South Eastern Kenya University, Kenya




out

Wild sea : a history of the Southern Ocean / Joy McCann

McCann, Joy, 1954- author




out

Practical evaluation for conservation education and outreach : assessing impacts & enhancing effectiveness / Katherine Clavijo and Kathayoon A. Khalil ; foreword by Judy Diamond

Clavijo, Katherine, author




out

Topomeric aza/thia cryptands: synthesis and theoretical aspects of in/out isomerism using n-alkyl bridging

Org. Chem. Front., 2020, 7,1164-1176
DOI: 10.1039/D0QO00123F, Research Article
Ian S. Taschner, Tia L. Walker, Sharath Chandra M., Briana R. Schrage, Christopher J. Ziegler, Xinfeng Gao, Steven E. Wheeler
A series of heterobicyclic aza/thia-lactams and cryptands incorporating changes in n-alkyl bridging length have been synthesized, characterized, chelated to heavy metals and computationally assessed.
The content of this RSS Feed (c) The Royal Society of Chemistry




out

Nanotechnology research directions for societal needs in 2020 : retrospective and outlook / Mihail C. Roco, Chad A. Mirkin, Mark C. Hersam

Roco, M.C. (Mihail C.)




out

[ASAP] Rapid Route-Finding for Bifurcating Organic Reactions

Journal of the American Chemical Society
DOI: 10.1021/jacs.9b13449




out

T'gana: No mask? Be ready to shell out Rs 1k fine

The Telangana government on Friday began imposing a fine of Rs 1,000 on people roaming in public places without wearing a mask as the state battles to contain new Covid-19 cases.




out

T'gana: Dole slips out of tribal families’ fingers

The Aadhaar-based biometric system to authenticate the Aadhaar number at banks is proving to be an obstacle for the tribal families of Lingala and Amrabad mandals in Nagarkurnool district, as their fingerprints have faded due to years of toiling in the fields.




out

Cisco Announces Exam Updates to CCNP Routing and Switching Certification

New Cisco Press Materials Forthcoming, Plus Special 40% Offer




out

Biomass Burning in Sub-Saharan Africa: Chemical Issues and Action Outreach / Liliana Mammino, editor

Online Resource




out

Ultraviolet light in food technology: principles and applications / Tatiana Koutchma

Online Resource




out

Bonhoeffer as youth worker : a theological vision for discipleship and life together / Andrew Root

Root, Andrew, 1974-




out

49.25% efficient cyan emissive sulfur dots via a microwave-assisted route

RSC Adv., 2020, 10,17266-17269
DOI: 10.1039/D0RA02778B, Paper
Open Access
Zhe Hu, Hanqing Dai, Xian Wei, Danlu Su, Chang Wei, Yuanyuan Chen, Fengxian Xie, Wanlu Zhang, Ruiqian Guo, Songnan Qu
The cyan emissive sulfur dots with a record high PL QY of 49.25% were successfully synthesized via a microwave-assisted route.
The content of this RSS Feed (c) The Royal Society of Chemistry




out

CSS drop-shadows without images

Drop-shadows are easy enough to create using pseudo-elements. It’s a nice and robust way to progressively enhance a design. This post is a summary of the technique and some of the possible appearances.

Demo: CSS drop-shadows without images

Known support: Firefox 3.5+, Chrome 5+, Safari 5+, Opera 10.6+, IE 9+

I’ll be looking mainly at a few details involved in making this effect more robust. Divya Manian covered the basic principle in her article Drop Shadows with CSS3 and Matt Hamm recently shared his Pure CSS3 box-shadow page curl effect.

After a bit of back-and-forth on Twitter with Simurai, and proposing a couple of additions to Divya’s and Matt’s demos using jsbin, I felt like documenting and explaining the parts that make up this technique.

The basic technique

There is no need for extra markup, the effect can be applied to a single element. A couple of pseudo-elements are generated from an element and then pushed behind it.

.drop-shadow {
  position: relative;
  width: 90%;
}

.drop-shadow:before,
.drop-shadow:after {
  content: "";
  position: absolute;
  z-index: -1;
}

The pseudo-elements need to be positioned and given explicit or implicit dimensions.

.drop-shadow:before,
.drop-shadow:after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 15px;
  left: 10px;
  width: 50%;
  height: 20%;
}

The next step is to add a CSS3 box-shadow and apply CSS3 transforms. Different types of drop-shadow can be produced by varying these values and the types of transforms applied.

.drop-shadow:before,
.drop-shadow:after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 15px;
  left: 10px;
  width: 50%;
  height: 20%;
  box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
  transform: rotate(-3deg);
}

One of the pseudo-elements then needs to be positioned on the other side of the element and rotated in the opposite direction. This is easily done by overriding only the properties that need to differ.

.drop-shadow:after{
  right: 10px;
  left: auto;
  transform: rotate(3deg);
 }

The final core code is as shown below. There is just one more addition – max-width – to prevent the drop-shadow from extending too far below very wide elements.

.drop-shadow {
  position: relative;
  width: 90%;
}

.drop-shadow:before,
.drop-shadow:after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 15px;
  left: 10px;
  width: 50%;
  height: 20%;
  max-width: 300px;
  box-shadow :0 15px 10px rgba(0, 0, 0, 0.7);
  transform: rotate(-3deg);
}

.drop-shadow:after{
  right: 10px;
  left: auto;
  transform: rotate(3deg);
}

No Firefox 3.0 problems this time

Some pseudo-element hacks require a work-around to avoid looking broken in Firefox 3.0 because that browser does not support the positioning of pseudo-elements. This usually involves implicitly setting their dimensions using offsets.

However, as Divya Manian pointed out to me, in this case we’re only using box-shadow – which Firefox 3.0 doesn’t support – and Firefox 3.0 will ignore the position:absolute declaration for the pseudo-elements. This leaves them with the default display:inline style. As a result, there is no problem explicitly setting the pseudo-element width and height because it won’t be applied to the pseudo-elements in Firefox 3.0.

Further enhancements

From this base there are plenty of ways to tweak the effect by applying skew to the pseudo-elements and modifying the styles of the element itself. A great example of this was shared by Simurai. By adding a border-radius to the element you can give the appearance of page curl.

.drop-shadow {
  border-radius: 0 0 120px 120px / 0 0 6px 6px;
}

I’ve put together a little demo page with a few of drop-shadow effects, including those that build on the work of Divya Manian and Matt Hamm.

If you’ve got your own improvements, please send them to me on Twitter.




out

Quick tip: git-checkout specific files from another branch

The git-checkout command can be used to update specific files or directories in your working tree with those from another branch, without merging in the whole branch. This can be useful when working with several feature branches or using GitHub Pages to generate a static project site.

The git-checkout manual page describes how the git checkout command is not just useful for switching between branches.

When <paths> or --patch are given, git checkout does not switch branches. It updates the named paths in the working tree from the index file or from a named <tree-ish> (most often a commit)…The <tree-ish> argument can be used to specify a specific tree-ish (i.e. commit, tag or tree) to update the index for the given paths before updating the working tree.

In git, a tree-ish is a way of referring to a particular commit or tree. This can be a partial sha or the branch, remote, and tag name pointers.

The syntax for using git checkout to update the working tree with files from a tree-ish is as follows:

git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>…

Therefore, to update the working tree with files or directories from another branch, you can use the branch name pointer in the git checkout command.

git checkout <branch_name> -- <paths>

As an example, this is how you could update your gh-pages branch on GitHub (used to generate a static site for your project) to include the latest changes made to a file that is on the master branch.

# On branch master
git checkout gh-pages
git checkout master -- myplugin.js
git commit -m "Update myplugin.js from master"

The need to update my gh-pages branch with specific files from my master branch was how I first found out about the other uses of the checkout command. It’s worth having a read of the rest of the git-checkout manual page and experimenting with the options.




out

About normalize.css

Normalize.css is a small CSS file that provides better cross-browser consistency in the default styling of HTML elements. It’s a modern, HTML5-ready, alternative to the traditional CSS reset.

Normalize.css is currently used in some form by Twitter Bootstrap, HTML5 Boilerplate, GOV.UK, Rdio, CSS Tricks, and many other frameworks, toolkits, and sites.

Overview

Normalize.css is an alternative to CSS resets. The project is the product of 100’s of hours of extensive research by @necolas and @jon_neal on the differences between default browser styles.

The aims of normalize.css are as follows:

  • Preserve useful browser defaults rather than erasing them.
  • Normalize styles for a wide range of HTML elements.
  • Correct bugs and common browser inconsistencies.
  • Improve usability with subtle improvements.
  • Explain the code using comments and detailed documentation.

It supports a wide range of browsers (including mobile browsers) and includes CSS that normalizes HTML5 elements, typography, lists, embedded content, forms, and tables.

Despite the project being based on the principle of normalization, it uses pragmatic defaults where they are preferable.

Normalize vs Reset

It’s worth understanding in greater detail how normalize.css differs from traditional CSS resets.

Normalize.css preserves useful defaults

Resets impose a homogenous visual style by flattening the default styles for almost all elements. In contrast, normalize.css retains many useful default browser styles. This means that you don’t have to redeclare styles for all the common typographic elements.

When an element has different default styles in different browsers, normalize.css aims to make those styles consistent and in line with modern standards when possible.

Normalize.css corrects common bugs

It fixes common desktop and mobile browser bugs that are out of scope for resets. This includes display settings for HTML5 elements, correcting font-size for preformatted text, SVG overflow in IE9, and many form-related bugs across browsers and operating systems.

For example, this is how normalize.css makes the new HTML5 search input type cross-browser consistent and stylable:

/**
 * 1. Addresses appearance set to searchfield in S5, Chrome
 * 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof)
 */

input[type="search"] {
  -webkit-appearance: textfield; /* 1 */
  -moz-box-sizing: content-box;
  -webkit-box-sizing: content-box; /* 2 */
  box-sizing: content-box;
}

/**
 * Removes inner padding and search cancel button in S5, Chrome on OS X
 */

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

Resets often fail to bring browsers to a level starting point with regards to how an element is rendered. This is particularly true of forms – an area where normalize.css can provide some significant assistance.

Normalize.css doesn’t clutter your debugging tools

A common irritation when using resets is the large inheritance chain that is displayed in browser CSS debugging tools.

A common sight in browser debugging tools when using a CSS reset

This is not such an issue with normalize.css because of the targeted styles and the conservative use of multiple selectors in rulesets.

Normalize.css is modular

The project is broken down into relatively independent sections, making it easy for you to see exactly which elements need specific styles. Furthermore, it gives you the potential to remove sections (e.g., the form normalizations) if you know they will never be needed by your website.

Normalize.css has extensive documentation

The normalize.css code is based on detailed cross-browser research and methodical testing. The file is heavily documented inline and further expanded upon in the GitHub Wiki. This means that you can find out what each line of code is doing, why it was included, what the differences are between browsers, and more easily run your own tests.

The project aims to help educate people on how browsers render elements by default, and make it easier for them to be involved in submitting improvements.

How to use normalize.css

First, install or download normalize.css from GitHub. There are then 2 main ways to make use of it.

Approach 1: use normalize.css as a starting point for your own project’s base CSS, customising the values to match the design’s requirements.

Approach 2: include normalize.css untouched and build upon it, overriding the defaults later in your CSS if necessary.

Closing comments

Normalize.css is significantly different in scope and execution to CSS resets. It’s worth trying it out to see if it fits with your development approach and preferences.

The project is developed in the open on GitHub. Anyone can report issues and submit patches. The full history of the project is available for anyone to see, and the context and reasoning for all changes can be found in the commit messages and the issue threads.

Detailed information on default UA styles: WHATWG suggestions for rendering HTML documents, Internet Explorer User Agent Style Sheets,and CSS2.1 User Agent Style Sheet Defaults.

Translations




out

About HTML semantics and front-end architecture

A collection of thoughts, experiences, ideas that I like, and ideas that I have been experimenting with over the last year. It covers HTML semantics, components and approaches to front-end architecture, class naming patterns, and HTTP compression.

About semantics

Semantics is the study of the relationships between signs and symbols and what they represent. In linguistics, this is primarily the study of the meaning of signs (such as words, phrases, or sounds) in language. In the context of front-end web development, semantics are largely concerned with the agreed meaning of HTML elements, attributes, and attribute values (including extensions like Microdata). These agreed semantics, which are usually formalised in specifications, can be used to help programmes (and subsequently humans) better understand aspects of the information on a website. However, even after formalisation, the semantics of elements, attributes, and attribute values are subject to adaptation and co-option by developers. This can lead to subsequent modifications of the formally agreed semantics (and is an HTML design principle).

Distinguishing between different types of HTML semantics

The principle of writing “semantic HTML” is one of the foundations of modern, professional front-end development. Most semantics are related to aspects of the nature of the existing or expected content (e.g. h1 element, lang attribute, email value of the type attribute, Microdata).

However, not all semantics need to be content-derived. Class names cannot be “unsemantic”. Whatever names are being used: they have meaning, they have purpose. Class name semantics can be different to those of HTML elements. We can leverage the agreed “global” semantics of HTML elements, certain HTML attributes, Microdata, etc., without confusing their purpose with those of the “local” website/application-specific semantics that are usually contained in the values of attributes like the class attribute.

Despite the HTML5 specification section on classes repeating the assumed “best practice” that…

…authors are encouraged to use [class attribute] values that describe the nature of the content, rather than values that describe the desired presentation of the content.

…there is no inherent reason to do this. In fact, it’s often a hindrance when working on large websites or applications.

  • Content-layer semantics are already served by HTML elements and other attributes.
  • Class names impart little or no useful semantic information to machines or human visitors unless it is part of a small set of agreed upon (and machine readable) names – Microformats.
  • The primary purpose of a class name is to be a hook for CSS and JavaScript. If you don’t need to add presentation and behaviour to your web documents, then you probably don’t need classes in your HTML.
  • Class names should communicate useful information to developers. It’s helpful to understand what a specific class name is going to do when you read a DOM snippet, especially in multi-developer teams where front-enders won’t be the only people working with HTML components.

Take this very simple example:

<div class="news">
    <h2>News</h2>
    [news content]
</div>

The class name news doesn’t tell you anything that is not already obvious from the content. It gives you no information about the architectural structure of the component, and it cannot be used with content that isn’t “news”. Tying your class name semantics tightly to the nature of the content has already reduced the ability of your architecture to scale or be easily put to use by other developers.

Content-independent class names

An alternative is to derive class name semantics from repeating structural and functional patterns in a design. The most reusable components are those with class names that are independent of the content.

We shouldn’t be afraid of making the connections between layers clear and explicit rather than having class names rigidly reflect specific content. Doing this doesn’t make classes “unsemantic”, it just means that their semantics are not derived from the content. We shouldn’t be afraid to include additional HTML elements if they help create more robust, flexible, and reusable components. Doing so does not make the HTML “unsemantic”, it just means that you use elements beyond the bare minimum needed to markup the content.

Front-end architecture

The aim of a component/template/object-oriented architecture is to be able to develop a limited number of reusable components that can contain a range of different content types. The important thing for class name semantics in non-trivial applications is that they be driven by pragmatism and best serve their primary purpose – providing meaningful, flexible, and reusable presentational/behavioural hooks for developers to use.

Reusable and combinable components

Scalable HTML/CSS must, by and large, rely on classes within the HTML to allow for the creation of reusable components. A flexible and reusable component is one which neither relies on existing within a certain part of the DOM tree, nor requires the use of specific element types. It should be able to adapt to different containers and be easily themed. If necessary, extra HTML elements (beyond those needed just to markup the content) and can be used to make the component more robust. A good example is what Nicole Sullivan calls the media object.

Components that can be easily combined benefit from the avoidance of type selectors in favour of classes. The following example prevents the easy combination of the btn component with the uilist component. The problems are that the specificity of .btn is less than that of .uilist a (which will override any shared properties), and the uilist component requires anchors as child nodes.

.btn { /* styles */ }
.uilist { /* styles */ }
.uilist a { /* styles */ }
<nav class="uilist">
    <a href="#">Home</a>
    <a href="#">About</a>
    <a class="btn" href="#">Login</a>
</nav>

An approach that improves the ease with which you can combine other components with uilist is to use classes to style the child DOM elements. Although this helps to reduce the specificity of the rule, the main benefit is that it gives you the option to apply the structural styles to any type of child node.

.btn { /* styles */ }
.uilist { /* styles */ }
.uilist-item { /* styles */ }
<nav class="uilist">
    <a class="uilist-item" href="#">Home</a>
    <a class="uilist-item" href="#">About</a>
    <span class="uilist-item">
        <a class="btn" href="#">Login</a>
    </span>
</nav>

JavaScript-specific classes

Using some form of JavaScript-specific classes can help to reduce the risk that thematic or structural changes to components will break any JavaScript that is also applied. An approach that I’ve found helpful is to use certain classes only for JavaScript hooks – js-* – and not to hang any presentation off them.

<a href="/login" class="btn btn-primary js-login"></a>

This way, you can reduce the chance that changing the structure or theme of components will inadvertently affect any required JavaScript behaviour and complex functionality.

Component modifiers

Components often have variants with slightly different presentations from the base component, e.g., a different coloured background or border. There are two mains patterns used to create these component variants. I’m going to call them the “single-class” and “multi-class” patterns.

The “single-class” pattern

.btn, .btn-primary { /* button template styles */ }
.btn-primary { /* styles specific to save button */ }

<button class="btn">Default</button>
<button class="btn-primary">Login</button>

The “multi-class” pattern

.btn { /* button template styles */ }
.btn-primary { /* styles specific to primary button */ }

<button class="btn">Default</button>
<button class="btn btn-primary">Login</button>

If you use a pre-processor, you might use Sass’s @extend functionality to reduce some of the maintenance work involved in using the “single-class” pattern. However, even with the help of a pre-processor, my preference is to use the “multi-class” pattern and add modifier classes in the HTML.

I’ve found it to be a more scalable pattern. For example, take the base btn component and add a further 5 types of button and 3 additional sizes. Using a “multi-class” pattern you end up with 9 classes that can be mixed-and-matched. Using a “single-class” pattern you end up with 24 classes.

It is also easier to make contextual tweaks to a component, if absolutely necessary. You might want to make small adjustments to any btn that appears within another component.

/* "multi-class" adjustment */
.thing .btn { /* adjustments */ }

/* "single-class" adjustment */
.thing .btn,
.thing .btn-primary,
.thing .btn-danger,
.thing .btn-etc { /* adjustments */ }

A “multi-class” pattern means you only need a single intra-component selector to target any type of btn-styled element within the component. A “single-class” pattern would mean that you may have to account for any possible button type, and adjust the selector whenever a new button variant is created.

Structured class names

When creating components – and “themes” that build upon them – some classes are used as component boundaries, some are used as component modifiers, and others are used to associate a collection of DOM nodes into a larger abstract presentational component.

It’s hard to deduce the relationship between btn (component), btn-primary (modifier), btn-group (component), and btn-group-item (component sub-object) because the names don’t clearly surface the purpose of the class. There is no consistent pattern.

In early 2011, I started experimenting with naming patterns that help me to more quickly understand the presentational relationship between nodes in a DOM snippet, rather than trying to piece together the site’s architecture by switching back-and-forth between HTML, CSS, and JS files. The notation in the gist is primarily influenced by the BEM system‘s approach to naming, but adapted into a form that I found easier to scan.

Since I first wrote this post, several other teams and frameworks have adopted this approach. MontageJS modified the notation into a different style, which I prefer and currently use in the SUIT framework:

/* Utility */
.u-utilityName {}

/* Component */
.ComponentName {}

/* Component modifier */
.ComponentName--modifierName {}

/* Component descendant */
.ComponentName-descendant {}

/* Component descendant modifier */
.ComponentName-descendant--modifierName {}

/* Component state (scoped to component) */
.ComponentName.is-stateOfComponent {}

This is merely a naming pattern that I’m finding helpful at the moment. It could take any form. But the benefit lies in removing the ambiguity of class names that rely only on (single) hyphens, or underscores, or camel case.

A note on raw file size and HTTP compression

Related to any discussion about modular/scalable CSS is a concern about file size and “bloat”. Nicole Sullivan’s talks often mention the file size savings (as well as maintenance improvements) that companies like Facebook experienced when adopting this kind of approach. Further to that, I thought I’d share my anecdotes about the effects of HTTP compression on pre-processor output and the extensive use of HTML classes.

When Twitter Bootstrap first came out, I rewrote the compiled CSS to better reflect how I would author it by hand and to compare the file sizes. After minifying both files, the hand-crafted CSS was about 10% smaller than the pre-processor output. But when both files were also gzipped, the pre-processor output was about 5% smaller than the hand-crafted CSS.

This highlights how important it is to compare the size of files after HTTP compression, because minified file sizes do not tell the whole story. It suggests that experienced CSS developers using pre-processors don’t need to be overly concerned about a certain degree of repetition in the compiled CSS because it can lend itself well to smaller file sizes after HTTP compression. The benefits of more maintainable “CSS” code via pre-processors should trump concerns about the aesthetics or size of the raw and minified output CSS.

In another experiment, I removed every class attribute from a 60KB HTML file pulled from a live site (already made up of many reusable components). Doing this reduced the file size to 25KB. When the original and stripped files were gzipped, their sizes were 7.6KB and 6KB respectively – a difference of 1.6KB. The actual file size consequences of liberal class use are rarely going to be worth stressing over.

How I learned to stop worrying…

The experience of many skilled developers, over many years, has led to a shift in how large-scale website and applications are developed. Despite this, for individuals weaned on an ideology where “semantic HTML” means using content-derived class names (and even then, only as a last resort), it usually requires you to work on a large application before you can become acutely aware of the impractical nature of that approach. You have to be prepared to disgard old ideas, look at alternatives, and even revisit ways that you may have previously dismissed.

Once you start writing non-trivial websites and applications that you and others must not only maintain but actively iterate upon, you quickly realise that despite your best efforts, your code starts to get harder and harder to maintain. It’s well worth taking the time to explore the work of some people who have proposed their own approaches to tackling these problems: Nicole’s blog and Object Oriented CSS project, Jonathan Snook’s Scalable Modular Architecture CSS, and the Block Element Modifier method that Yandex have developed.

When you choose to author HTML and CSS in a way that seeks to reduce the amount of time you spend writing and editing CSS, it involves accepting that you must instead spend more time changing HTML classes on elements if you want to change their styles. This turns out to be fairly practical, both for front-end and back-end developers – anyone can rearrange pre-built “lego blocks”; it turns out that no one can perform CSS-alchemy.




out

Strategien zur Vermeidung von Burnout [electronic resource] : der mögliche Einfluss von Coping-Stilen / Markus H. Kipfer

Kipfer, Markus H, author




out

The talent assessment and development pocket tool kit [electronic resource] : how to get the most out of your best people / Brenda Hampel and Anne Bruce

Hampel, Brenda




out

The truth about getting the best from people [electronic resource] / Martha I. Finney

Finney, Martha I




out

The truth about leading teams [electronic resource] : the essential truths in 20 minutes / by Martha I. Finney

Finney, Martha I




out

The truth about making complex or critical decisions [electronic resource] : the essential truths in 20 minutes / Robert E. Gunther

Gunther, Robert E., 1960- author




out

The truth about managing effectively (collection) [electronic resource] / Cathy Fyock [and three others]

Fyock, Catherine D., author




out

The truth about managing people [electronic resource] : proven insights to get the best from your team / Stephen P. Robbins

Robbins, Stephen P., 1943- author




out

The truth about motivating your employees [electronic resource] : the essential truths in 20 minutes / Martha I. Finney

Finney, Martha I., author




out

Turning people into teams [electronic resource] : rituals and routines that redesign how we work / David Sherwin & Mary Sherwin

Sherwin, David, author




out

What every leader should know about expatriate effectiveness [electronic resource] / Meena S. Wilson, Maxine A. Dalton

Wilson, Meena S., author




out

Windows Server 2012 R2 inside out [electronic resource] : services, security, & infrastructure / William R. Stanek

Stanek, William R., author