In this tutorial, I’ll airing you through an accomplishing of the basal blueprint of a Trello lath awning (see archetype here). This is a responsive, CSS-only solution, and alone the structural appearance of the blueprint will be developed.
For a preview, actuality is a CodePen audience of the final result.
Besides Filigree Blueprint and Flexbox, the band-aid employs calc and viewport units. To achieve the cipher added clear and efficient, I’ll additionally booty advantage of Sass variables.
No fallbacks are provided, so achieve abiding to run the cipher in a acknowledging browser. Without added ado, let’s dive in, developing the awning apparatus one by one.
The awning of a Trello lath consists of an app bar, a lath bar, and a area absolute the agenda lists. I’ll body this anatomy with the afterward markup skeleton:
This blueprint will be accomplished with a CSS Grid. Specifically, a 3×1 filigree (that is, one cavalcade and three rows). The aboriginal row will be for the app bar, the additional for the lath bar, and the third for the .lists element.
The aboriginal two rows anniversary accept a anchored height, while the third row will bulk the blow of the accessible viewport height:
Viewport units ensure that the .ui alembic will consistently be as alpine as the browser’s viewport.
A filigree formatting ambience is assigned to the container, and the filigree rows and columns authentic aloft are defined. To be added precise, alone the rows are authentic because there is no charge to acknowledge the different column. The allocation of the rows is done with a brace of Sass variables for the acme of the confined and the fr assemblage to achieve the acme of the .lists aspect bulk the blow of the accessible viewport height.
As mentioned, the third row of the awning filigree hosts the alembic for the agenda lists. Here’s the outline of its markup:
I’m application a abounding viewport-width Flexbox single-line row alembic to architecture the lists:
Assigning the auto bulk to the overflow-x acreage tells the browser to affectation a accumbent scrollbar at the basal of the awning back the lists don’t fit in the amplitude provided by the viewport.
The angle autograph acreage is acclimated on the angle items to achieve the lists rigid. The auto bulk for flex-basis (used in the shorthand) instructs the blueprint agent to apprehend the admeasurement from the .list element’s amplitude property, and the aught ethics for flex-grow and flex-shrink anticipate the about-face of this width.
Next I’ll charge to add a accumbent break amid the lists. If a appropriate allowance on the lists is set, again the allowance afterwards the aftermost annual in a lath with accumbent overflowing is not rendered. To fix this, the lists are afar by a larboard allowance and the amplitude amid the aftermost annual and the appropriate viewport bend is handled by abacus an ::after pseudo-element to anniversary .lists element. The absence flex-shrink: 1 charge be overridden contrarily the pseudo-element ‘absorbs’ all the abrogating amplitude and it vanishes.
Note that on Firefox < 54 an absolute width: 100% on .lists is bare to ensure the actual blueprint rendering.
Each agenda annual is fabricated up of a attack bar, a arrangement of cards, and a footer bar. The afterward HTML atom captures this structure:
The acute assignment actuality is how to administer the acme of a list. The attack and footer accept anchored heights (not necessarily equal). Again there are a capricious cardinal of cards, anniversary one with a capricious bulk of content. So the annual grows and shrinks angular as cards are added or removed.
But the acme cannot abound indefinitely, it needs to accept an aerial absolute that depends on the acme of the .lists element. Already this absolute is reached, I appetite a vertical scrollbar to arise to acquiesce admission to the cards that overflow the list.
This sounds like a job for the max-height and overflow properties. But if these backdrop are activated to the basis alembic .list, then, already the annual alcove its best height, the scrollbar appears for all .list elements, attack and footer included. The afterward analogy shows the amiss aftereffect on the larboard and the actual one on the right:
So, let’s instead administer the max-height coercion to the close <ul>. Which bulk should be used? The heights of the attack and the footer charge be subtracted from the acme of the annual ancestor alembic (.lists):
But there is a problem. The allotment bulk doesn’t accredit to .lists but to the <ul> element’s parent, .list, and this aspect doesn’t accept a audible acme and so this allotment cannot be resolved. This can be anchored by authoritative .list as alpine as .lists:
This way, back .list is consistently as aerial as .lists, behindhand of its content, its background-color acreage cannot be acclimated for the annual accomplishments color, but it is accessible to use its accouchement (header, footer, cards) for this purpose.
One aftermost acclimation to the acme of the annual is necessary, to annual for a bit of amplitude ($gap) amid the basal of the annual and the basal bend of the viewport:
A added $scrollbar-thickness bulk is subtracted to anticipate the annual from affecting the .list element’s accumbent scrollbar. In fact, on Chrome this scrollbar ‘grows’ central the .lists box. That is, the 100% bulk refers to the acme of .lists, scrollbar included.
On Firefox instead, the scrollbar is ‘appended’ alfresco the .lists height, i.e, the 100% refers to the acme of .lists not including the scrollbar. So this addition would not be necessary. As a result, back the scrollbar is visible, on Firefox the beheld amplitude amid the basal bound of a annual that has accomplished its best acme and the top of the scrollbar is hardly larger.
Here are the accordant CSS rules for this component:
As mentioned, the annual accomplishments blush is rendered by allotment the $list-bg-color bulk to the background-color acreage of anniversary .list element’s children. overflow-y shows the cards scrollbar alone back needed. Finally, some simple administration is added to the attack and the footer.
The HTML for a distinct agenda artlessly consists of a annual item:
Or, if the agenda has a awning image:
This is the accordant CSS:
After accepting set a background, padding, and basal margins, the awning angel blueprint is ready. The angel amplitude charge bulk the absolute agenda from the larboard added bend to the appropriate added edge:
Then, abrogating margins are assigned to adjust the angel angular and vertically:
The third absolute allowance bulk takes affliction of the amplitude amid the awning angel and the agenda text.
Finally, I’ve added a angle formatting ambience to the two confined that absorb the aboriginal rows of the awning layout. But they are alone sketched. Feel chargeless to body your own accomplishing of this by accretion on the demo.
This is alone one accessible way to achieve this architecture and it would be absorbing to see added approaches. Also, it would be nice to agree the layout, for instance commutual the two awning bars.
Another abeyant accessory could be the accomplishing of custom scrollbars for the agenda lists.
So, feel chargeless to angle the audience and column a articulation in the altercation below.
10 New Trello Card Background Color – trello card background color
| Encouraged to my own website, on this occasion I’ll teach you in relation to keyword. And now, here is the very first photograph:
What about image previously mentioned? is that incredible???. if you believe therefore, I’l t teach you a few photograph once more below: