- Mar 2021
-
css-tricks.com css-tricks.com
-
You can’t use @supports for selectors, only property/values (e.g. @supports (display: flex))
first sighting CSS: @supports
-
You can do and impressive amount of form validation with just HTML attributes. You can make the user experience pretty clean and clear with CSS selectors.
-
-
girliemac.com girliemac.com
-
the client form validation is the one I like a lot, because, for example, by adding required attribute to an input, I don’t need to write any additional JavaScript to warn a user, when the user submits a form without filling out the required fields
-
There are numerous user interface state pseudo-classes. You’ve probably already known :hover, :active etc. According to this W3C Candidate Doc, there are additional pseudo-classes defined, such as :valid, invalid, in-range, out-of-range, required, optional, read-only and read-write.
-
-
stackoverflow.com stackoverflow.com
-
label:after { content: attr(data-invalid); ... }
-
-
webdevtrick.com webdevtrick.com
-
:placeholder-shown
-
- Feb 2021
-
css-tricks.com css-tricks.com
-
The transform property allows you to visually manipulate an element by skewing, rotating, translating, or scaling: .element { width: 20px; height: 20px; transform: scale(20); } Even with a declared height and width, this element will now be scaled to twenty times its original size:
For css codes, we can use transform: scale(20).
Tags
Annotators
URL
-
-
-
100vw is 100% of the viewport width not accounting for scrollbars (unless the root element has anything other than overflow: auto set, but auto is the default value). Thus, when the page content overflows the viewport vertically, the browser renders the vertical scroll bar, which reduces the visible viewport area by a few pixels. But the 100vw value doesn't update to account for this, so the selected div retains the same width as before the vertical scrollbar appeared. This results in the horizontal scroll bar rendering.
-
-
www.sitepoint.com www.sitepoint.com
-
Now, however, you set width:100vw and that is going to be (in this case) 100% wide (viewport wide) + the vertical scrollbar width. That’s too wide. That induces the HORIZONTAL scrollbar.
-
-
stackoverflow.com stackoverflow.com
-
You use grid-area, so the place for the side nav is allocated at start. If you hide (or even delete) the side nav, that won't change anything about this. You have to do a little trick: Set the width for the first column to 0 and change the grid-gap because otherwise you will have a (not needed) gap at the left.
-
-
-
www.smashingmagazine.com www.smashingmagazine.com
-
-
Adding backgrounds and borders does feel like a missing feature of the CSS Grid specification and one which the Working Group have discussed along with many members of the community (the discussion thread is on GitHub).
-
With Grid and generated content, we can add a line either side of our heading without adding any additional markup. The line will grow and shrink according to available space
-
The key phrase here is “children of a grid container.” The specification defines the creation of a grid on the parent element, which child items can be positioned into. It doesn’t define any styling of that grid, not even going as far as to implement something like the column-rule property we have in Multi-column Layout. We style the child items, and not the grid itself, which leaves us needing to have an element of some sort to apply that style to.
-
-
stackoverflow.com stackoverflow.com
-
Ensure that there can only be four items per row: grid-template-columns: repeat(auto-fill, minmax(20%, 1fr)); grid-gap: 10px; With 20% minimum width per item, and a grid gap (of any length), there can never be more than four items per row.
-
-
css-tricks.com css-tricks.com
-
Because of the way the CSS “or” operator works, I wouldn’t be able to mix the retina conditions with other expressions since a (b or c) would be compiled into (a or b) c and not a b or a c.
-
-
developer.mozilla.org developer.mozilla.org
-
auto (i.e. minmax(auto, max-content))
-
Note: auto track sizes (and only auto track sizes) can be stretched by the align-content and justify-content properties.
-
Is a keyword that is identical to maximal content if it's a maximum. As a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track.
-
-
css-tricks.com css-tricks.com
-
If no end line value is declared, the item will span 1 track by default.
-
Notice that you’re not naming lines with this syntax, just areas.
-
The syntax itself provides a visualization of the structure of the grid.
What is this an example of? self-referencing? self-presentation? duality?
-
justify-content Sometimes the total size of your grid might be less than the size of its grid container. This could happen if all of your grid items are sized with non-flexible units like px. In this case you can set the alignment of the grid within the grid container.
-
-
github.com github.com
-
-
this issue is rather about styling the the cells and areas
-
This idea is not new, there are reference books which teach the use of grid layout, I haven't seen a single book that doesn't show a grid overlay as part of the process.
-
the author should be able to style area boxes
-
#grid::grid-area(1 / 2 / 3 / 4) { background-color: red;
-
-
alistapart.com alistapart.com
-
When you generate before- and after-content pseudo-elements, Grid treats them as actual elements and makes them grid items.
-
Since CSS doesn’t (yet) offer a way to style grid cells, areas, or tracks directly, we have to stretch elements over the parts we want to style independently from the elements that contain content.
-
div:nth-of-type(3n+1) { grid-column: 1; } div:nth-of-type(3n+2) { grid-column: 2; } div:nth-of-type(3n+3) { grid-column: 3; } div:nth-of-type(-n+3) { grid-row: 1; }
-
-
The 1 / -1 means “go from the first grid line to the last grid line of the explicit grid”, regardless of how many grid lines there might be. It’s a handy pattern to use in any situation where you have a grid item meant to stretch from edge to edge of a grid.
-
They likely won’t have any content, making them a sort of structural filler to spackle over the gaps in Grid’s capabilities.
-
Just like in flexbox, this will move the displayed grid items out of source order, placing them after the grid items that don’t have explicit order values.
-
#ttt > * { border: 1px solid black; border-width: 0 1px 1px 0; display: flex; /* flex styling to center content in divs */ align-items: center; justify-content: center; } #ttt > *:nth-of-type(3n) { border-right-width: 0; } #ttt > *:nth-of-type(n+7) { border-bottom-width: 0; }
-
-
codepen.io codepen.io
-
jakearchibald.com jakearchibald.com
-
This nav bar by Chris Coyier is a great example of something that makes more sense as a flexbox than grid.
-
Flexbox and grid play well together, and are a huge step forward from the float & table hacks they replace.
-
Flexbox's strength is in its content-driven model. It doesn't need to know the content up-front. You can distribute items based on their content, allow boxes to wrap which is really handy for responsive design, you can even control the distribution of negative space separately to positive space.
-
Flexbox: content dictates layout
-
Grid: container dictates layout
-
-
css-tricks.com css-tricks.com
-
Flexbox is for one dimensional layout (row or column). CSS grid is for two dimensional layout.
-
Your grid areas can only be rectangles (like the left), not arbitrary polygons (like the right).
-
-
developer.mozilla.org developer.mozilla.org
-
.box1 { grid-column-start: 1; grid-column-end: 4; grid-row-start: 1; grid-row-end: 3; } .box2 { grid-column-start: 1; grid-row-start: 2; grid-row-end: 4; }
-
-
stackoverflow.com stackoverflow.com
-
the difference is exactly like block and inline-block ... if you use inline-grid with sibling elements they will be placed in the same line unlike grid ... so here you change to grid also since each element is inside a grid area alone
-
-
www.youtube.com www.youtube.com
-
Sass
Define variables, such as colors (e.g. $primary: #337ab7) in Sass (styles.scss) then compile to css for web.
R library "bootstraplib" built on foundation of "sass".
Use "run_with_themer()" to get a live preview GUI for customizing bootstrap theme.
Also, use "shinyOptions(plot.autocolors=TRUE)" at top of app to get plot outputs that respect Dark Mode.
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
- Jan 2021
-
developers.google.com developers.google.com
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
-
Use inline styles for everything.
-
-
css-tricks.com css-tricks.com
-
-
Bordering an element with a single repeating image is something that seems like it should be easy with a property called border-image, but the process for actually doing that is somewhat counter-intuitive. Let’s say, for example, that you want to border an element with a repeating heart icon. You can’t do that with a image of a single heart. Instead, you have to make an image of a “frame” of hearts arranged as you’d like them to appear in the border, then slice that image. <img sizes="(min-width: 735px) 864px, 96vw" src='https://i2.wp.com/css-tricks.com/wp-content/uploads/2013/01/enlarged-border-image-slice.png' alt='' data-recalc-dims="1" />Eight hearts in a “frame” image, enlarged to show detail. The red lines indicate slices. If you think that sounds preposterous, you’re in good company. There was a lengthy discussion of the subject on Eric Myer’s blog a few years ago where many frontend development greats weighed in.
-
-
www.emailonacid.com www.emailonacid.com
-
developer.mozilla.org developer.mozilla.org
-
The background-origin CSS property sets the background's origin: from the border start, inside the border, or inside the padding.
-
-
developer.mozilla.org developer.mozilla.org
-
codepen.io codepen.io
Tags
Annotators
URL
-
-
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
border-image-slice
-
-
developer.mozilla.org developer.mozilla.org
-
stackoverflow.com stackoverflow.com
-
stackoverflow.com stackoverflow.com
-
You could use an asymmetrical border to make curves with CSS. border-radius: 50%/100px 100px 0 0;
-
-
css-tricks.com css-tricks.com
-
Situation: you have a single line of text in a flex child element. You don’t want that text to wrap, you want it truncated with ellipsis (or fall back to just hiding the overflow). But the worst happens. The unthinkable! The layout breaks and forces the entire flex parent element too wide. Flexbox is supposed to be helping make layout easier!
-
-
-
css-tricks.com css-tricks.com
-
I used it to create a full-bleed utility class: .full-bleed { width: 100vw; margin-left: calc(50% - 50vw); }
-
Use-case party I asked some CSS developers when they last used calc() so we could have a nice taste here for for how others use it in their day-to-day work.
-
-
stackoverflow.com stackoverflow.com
-
Great, I can use vw to scale text so it doesn't look puny on a desktop! Perfect... Oh. Huh, now the text is too small to read when viewed on a phone. Okay, well I can just use "max(x,y)" to make sure it doesn't get shrunk beyond a minimum size. Perfect... Oh. Hmm. Looks like "max" isn't supported properly by Chrome. Okay, well guess I'll just use "px" again.
-
-
-
developer.mozilla.org developer.mozilla.org
-
auto As a maximum, identical to max-content. As a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track.
And I'm guessing that when you use auto as a value (not inside of a minmax), that it is equivalent to
minmax(min-content, max-content)
? Wish I could see that confirmed somewhere... -
-
-
developer.mozilla.org developer.mozilla.org
-
CSS Grid Layout excels at dividing a page into major regions or defining the relationship in terms of size, position, and layer, between parts of a control built from HTML primitives.
-
-
www.hongkiat.com www.hongkiat.com
-
www.paulryancodes.com www.paulryancodes.com
-
This is really cool! Having the content decide on the space it needs is so powerful!
-
-
css-tricks.com css-tricks.com
-
css-workshop.com css-workshop.com
-
How to wrap long word (text without spaces) in html table’s cell? This is very, very easy! We must add only a CSS proprty to table cell “td” tag – “word-break: break-all;” then all column’s widths become as intended.
-
-
css-tricks.com css-tricks.com
-
fixed: With this value, the table’s layout ignores the content and instead uses the table’s width, any specified width of columns, and border and cell spacing values. The column values used are based on widths defined on columns or cells for the first row of the table
-
-
-
www.geeksforgeeks.org www.geeksforgeeks.org
-
It is also very likely that the contents of the table might change the structure or dimensions of the table. For example, long words residing in the table cells can cause the cell width to increases. If you fix that problem, it might happen that the long words cross the cell boundaries.
-
-
www.impressivewebs.com www.impressivewebs.com
-
The only difference is that in this case “auto” will not work, but instead “height: 100%” is required.
-
Blocks Don’t Need 100% Width When we understand the difference between block-level elements and inline elements, we’ll know that a block element (such as a <div>, <p>, or <ul>, to name a few) will, by default expand to fit the width of its containing, or parent, element (minus any margins it has or padding its parent has).
-
But in most cases, I strongly recommend you use padding inside a box, rather than margins, to ensure you don’t have this problem.
-
It seems like this should be one of the easiest things to understand in CSS. If you want a block-level element to fill any remaining space inside of its parent, then it’s simple — just add width: 100% in your CSS declaration for that element, and your problem is solved. Not so fast. It’s not quite that easy. I’m sure CSS developers of all skill levels have attempted something similar to what I’ve just described, with bizarre results ultimately leading to head scratching and shruggingly resorting to experimenting with absolute widths until we find just the right fit. This is just one of those things in CSS that seems easy to understand (and really, it should be), but it’s sometimes not — because of the way that percentages work in CSS.
-
-
css-tricks.com css-tricks.com
-
min-width: 0;
Wouldn't expect the solution to "width grows too wide" to be to assign a (seemingly meaningless, since how could it be less than 0) a minimum width of 0.
I would have expected to solve this by applying a max-width to the problem element or one of its ancestors.
-
The explanation here is that the minimum size of an fr unit is auto. Grid then looks at the min-content size of the item. If the item has a size (you’ve given it a width) or has something in it with a size such as an image, the min-content size might be much bigger than the share of available space you think 1fr will give you. It’s easy to think of 1fr as being “one part of the space in the grid container” when it is really one part of the space left over. If there is space to grow then the tracks grow from that min-content size assigning space. Using minmax, as you have pointed out, is the best thing to do if you want to forcibly have equal width tracks, as that says “I want this track to have a min-content size of 0”, you could potentially in that situation end up with overflows as you lose the squishiness.
-
It’s easy to think of 1fr as being “one part of the space in the grid container” when it is really one part of the space left over.
-
And since auto is entirely based on content, we can say it is “indefinitely” sized, its dimensions flex. If we were to put an explicit width on the column, like 50% or 400px, then we would say it is “definitely” sized.
-
-
It’s true that the auto value would do the same, but auto isn’t quite as robust since it’s size is based on the content inside.
-
-
css-tricks.com css-tricks.com
-
Making literal grids. Like X columns with Y gap between them homegrown framework stuff. grid-gap is wonderful, as gutters are the main pain point of grid systems.
-
-
css-tricks.com css-tricks.com
-
I think you’re missing the spirit behind the classic “centering is hard” complaint in a couple of places, which, at least for me, always comes back to not knowing the height of the elements.
-
-
-
I figured I could try making my own with modern technologies.
-
The CSS Zen Garden era was hugely inspirational to many.
-
But Svelte doesn't work like that - all css is statically compiled, and changing myCSS doesn't update the head component.
-
-
www.csszengarden.com www.csszengarden.com
-
-
github.com github.com
-
// super-simple CSS Object to string serializer const css = obj => Object.entries(obj || {}) .map(x => x.join(":")) .join(";");
Tags
Annotators
URL
-
-
developer.mozilla.org developer.mozilla.orgz-index1
-
www.sitepoint.com www.sitepoint.com
-
You can read more about properly sizing the text using a combination of units along with the the calc() function in this excellent article about viewport unit-based typography.
-
-
stackoverflow.com stackoverflow.com
-
While there are always going to be cases where one is more appropriate than the other, border-bottom offers much more precise control over text-decoration and is therefore probably the preferred method. Here's a quick (likely not exhaustive) list of properties that border-bottom can control/enable that text-decoration cannot:
-
-
freefrontend.com freefrontend.com
Tags
Annotators
URL
-
-
developer.mozilla.org developer.mozilla.org
-
<q>Dies ist ein deutsches Zitat</q>
-
-
css-tricks.com css-tricks.com
-
@Alex Yes, you can. In the same manner that you do so with non-flex grids, apply a negative margin-left to the grid wrapper, and apply that same value as padding left to all grid columns. .grid { margin-left: -20px;} .grid__col { padding-left: 20px;}
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
css-tricks.com css-tricks.com
-
-
If there’s a lot more to aligning icons to text than you expected, then you are not alone.
-
-
css-tricks.com css-tricks.com
-
visually-hidden is a class used to visually hide the label text with CSS:
-
- Dec 2020
-
sveltematerialui.com sveltematerialui.com
Tags
Annotators
URL
-
-
-
- Nov 2020
-
www.reddit.com www.reddit.com
-
I'm thinking of creating something similar to a utility-first CSS framework like Tailwind, here's how it could look like:StyledText( style: [selfAlignRight, padding(8), fontSize(20), fontBold], text: 'hello' )
-
-
developer.mozilla.org developer.mozilla.org
-
CSS Object Model (CSSOM)
-
-
css-tricks.com css-tricks.com
-
-
let root = document.documentElement; root.addEventListener("mousemove", e => { root.style.setProperty('--mouse-x', e.clientX + "px"); root.style.setProperty('--mouse-y', e.clientY + "px"); });
-
Here’s a CSS variable (formally called a “CSS custom property“)
-
-
developer.mozilla.org developer.mozilla.org
-
An additional benefit is semantic identifiers. For example, --main-text-color is easier to understand than #00ff00, especially if this same color is also used in other contexts.
-
-
-
codeburst.io codeburst.io
-
A great thing about CSS variables is their reactive nature. As soon as we update them, whatever property has the value of the CSS variable gets updated as well.
-
The standard cascade rules also apply to the CSS Variables.So, if a custom property is declared multiple times, the lowermost definition in the css file overwrites the ones above it.
-
-
-
github.com github.com
-
@import url() is a runtime CSS statement, not a Sass @import module.
-
-
davidwalsh.name davidwalsh.name
-
text-overflow: ellipsis (married with fixed width and overflow: hidden
-
-
material.io material.io
-
If the label text is too long for a single line, it will wrap the text by default. You can force the text to stay on a single line and ellipse the overflow text by adding the mdc-form-field--nowrap class:
-
-
developer.mozilla.org developer.mozilla.org
-
github.com github.com
-
iron-list must either be explicitly sized, or delegate scrolling to an explicitly sized parent. By "explicitly sized", we mean it either has an explicit CSS height property set via a class or inline style, or else is sized by other layout means (e.g. the flex or fit classes).
Tags
Annotators
URL
-
- Oct 2020
-
react-spectrum.adobe.com react-spectrum.adobe.com
-
In addition, this example shows usage of the isPressed value returned by useButton to properly style the button's active state. You could use the CSS :active pseudo class for this, but isPressed properly handles when the user drags their pointer off of the button, along with keyboard support and better touch screen support.
-
-
-
Using The clamp() CSS function we can create a responsive website with only one property
clamp()
Example:
h1 { font-size: clamp(16px, 5vw, 34px); }
- (minimum value, flexible value and maximum value)
-
-
formvalidation.io formvalidation.io
-
Below is basic working examples of FormValidation using with popular CSS frameworks and a native form.
-
-
github.com github.com
-
This library takes inspiration from Tailwind and utilizes Otion to provide means of efficiently generating atomic styles from shorthand syntax and appending them to the DOM at runtime.
-
-
readwriterespond.com readwriterespond.com
-
I think it is one of those topics with a lot of conjecture John. Apologies if there are too many links.
Don't apologize for links. It's the web and links are important. In fact I might think that you could have a few additional links here! I would have seen it anyway, but I was a tad sad not to have seen a link to that massive pullquote/photo you made at the top of the post which would have sent me a webmention to boot. (Of course WordPress doesn't make it easy on this front either, so your best bet would have been an invisible <link> hidden in the text maybe?)
I've been in the habit of person-tagging people in posts to actively send them webmentions, but I also have worried about the extra "visual clutter" and cognitive load of the traditional presentation of links as mentioned by John. As a result, I'm now considering adding some CSS to my site so that these webmention links simply look like regular text. This way the notifications will be triggered, but without adding the seeming "cruft" visually or cognitively. Win-win? Thanks for the inspiration!
In your case here, you've kindly added enough context about what to expect about the included links that the reader can decide for themselves while still making your point. You should sleep easily on this point and continue linking to your heart's content.
-
- Sep 2020
-
github.com github.com
-
You can style a component by overriding the available CSS variables.
Tags
Annotators
URL
-
-
github.com github.com
-
I worry about that being a bit of a Pandora's box — it throws encapsulation completely out the window. The nature of CSS custom properties is that they're inert unless the child chooses to do something with them, which wouldn't be the case for other things.
-
The problem with working around the current limitations of Svelte style (:global, svelte:head, external styles or various wild card selectors) is that the API is uglier, bigger, harder to explain AND it loses one of the best features of Svelte IMO - contextual style encapsulation. I can understand that CSS classes are a bit uncontrollable, but this type of blocking will just push developers to work around it and create worse solutions.
Tags
- inert
- trying to prevent one bad thing leading to people doing/choosing an even worse option
- +0.9
- key point
- important point
- arbitrary limitations leading to less-than-ideal workarounds
- Svelte: CSS encapsulation
- Svelte: how to affect child component styles
- missing out on the benefits of something
Annotators
URL
-
-
github.com github.com
-
For my point of view, and I've been annoyingly consistent in this for as long as people have been asking for this feature or something like it, style encapsulation is one of the core principles of Svelte's component model and this feature fundamentally breaks that. It would be too easy for people to use this feature and it would definitely get abused removing the style safety that Svelte previously provided.
-
-
react-spectrum.adobe.com react-spectrum.adobe.com
-
This is similar to the :focus-visible pseudo class in CSS.
-
-
caniuse.com caniuse.com
Tags
Annotators
URL
-
-
hiddedevries.nl hiddedevries.nl
-
-
This property makes the element so that it no longer seems to exist.
-
-
-
Yes, we use CSS. I thought a Svelte mantra was to use the existing language(s). This is fundamental CSS
-
-
github.com github.com
-
I'm personally surprised about that, given the degree to which web component advocates prioritise encapsulation — it seems like a footgun, honestly
-
In particular, this takes a different approach from CSS Shadow Parts, which allows a component consumer to target selected elements, but to then apply arbitrary styles to those elements.
-
display: contents essentially removes the wrapper element from the DOM, but allows it to set inheritable styles including custom properties.
-
-
www.w3.org www.w3.org
-
This specification defines the ::part() pseudo-element on shadow hosts, allowing shadow hosts to selectively expose chosen elements from their shadow tree to the outside page for styling purposes.
-
-
github.com github.com
-
A component should be in complete control of itself. Not only should a component's styles not leak out but other component's style should never leak in. Consider this 'Encapsulation part 2' if you will. When writing a component, you have certain guarantees that not only will the styles you write be contained within the component, but nothing from the outside should affect you either. You have a certain confidence that if it works in isolation, then it will continue to work when embedded within a complex application.
-
CSS encapsulation is a critical feature of single file components in Svelte; it allows you to think only about the styles that live together in a given component. Managing CSS has long been one of the more challenging aspects of building for the web; we have no desire to bring those problems back via official APIs that encourage the de-scoping of CSS. We do not wish to revisit the age of namespaced CSS selectors and required preprocessors.
-
-
svelte.dev svelte.dev
-
svelte.dev svelte.dev
-
If your reaction to the video was 'fine, but if we use TypeScript and write plugins for each editor then we can get all the autocomplete and syntax highlighting stuff' — in other words, if you believe that in order to achieve parity with CSS it makes sense to build, document, promote and maintain a fleet of ancillary projects — then, well, you and I may never see eye to eye!
-
-
css-tricks.com css-tricks.com
-
But because that final CSS file is probably minified (all whitespace removed), DevTools is likely to tell us that we’ll find the declaration we’re looking for on line 1! Unfortunate, and not helpful for development.
-
-
tailwindcss.com tailwindcss.com
-
Inline styles can't target states like hover or focus, but Tailwind's pseudo-class variants make it easy to style those states with utility classes.
-
You aren't wasting energy inventing class names. No more adding silly class names like sidebar-inner-wrapper just to be able to style something, and no more agonizing over the perfect abstract name for something that's really just a flex container.
-
-
-
code.tutsplus.com code.tutsplus.com
-
-
This sibling combinator is similar to X + Y, however, it's less strict. While an adjacent selector (ul + p) will only select the first element that is immediately preceded by the former selector, this one is more generalized. It will select, referring to our example above, any p elements, as long as they follow a ul.
-
-
-
style.css now uses native CSS variables
-
- Aug 2020
-
only-to-top.ru only-to-top.ru
-
⚠️ Данный способ работает, если iframe находится на вашем домене.
-
-
wattenberger.com wattenberger.com
-
heightparent’s heightwidthparent’s widthtopparent’s heightleftparent’s widthmargin-topparent’s widthmargin-leftparent’s widthpadding-topparent’s widthpadding-leftparent’s widthtranslate-topself’s heighttranslate-leftself’s width
What % means in different CSS elements
-
- Jul 2020
-
support.iubenda.com support.iubenda.com
-
-
If all your styles are !important, then none of your styles are important.
-
-
css-tricks.com css-tricks.com
-
Using !important in your CSS usually means you’re narcissistic & selfish or lazy. Respect the devs to come…
-
-
web.dev web.dev
-
First specify grid as the display method, and then write place-items: center on the same element. place-items is a shorthand to set both align-items and justify-items at once. By setting it to center, both align-items and justify-items are set to center.
-
-
www.html5rocks.com www.html5rocks.com
-
elements whose display value was assigned to "none" will not appear in the tree (whereas elements with "hidden" visibility will appear in the tree).
display:none vs visibility:hidden
Tags
Annotators
URL
-
- Jun 2020
-
www.educative.io www.educative.io
-
You can style the input with the type attribute differenly, like so:
可以通过这种方式选定特定类型 iniput 元素而不用加类名
-
Content added using pseudo-elements is only visually displayed. It is not inserted into the DOM. Don’t rely on :before and :after to insert content that is relevant to the meaning and completeness of the content on the page.
伪类插入的元素仅仅应用于显示,并不插入 dom
-
On the contrary the same could have been achieved by using the :first-letter pseudo-element selector.
:first-letter 是个伪类
-
-
-
Note that when you use &::before with content, you need to add quotes to the value of content, otherwise the text does not get applied correctly.
&:hover{ background-color: ${props => lighten(0.7,themesMap.get(props.theme)!.secondaryColor)}; } &:before{ content: 'before'; }
-
-
www.educative.io www.educative.io
-
The CSS above will ONLY select the h1 and h2 within the div. The other h1 and h2 within the p tag will be left unstyled.
父级选择器用空格
-
If you remember, flex: 1 0 0 says, “grow the container to fit the entire available space, keep the initial width at zero, and don’t shrink the item too”
让中间部分撑满,自然让顶部和底部 fixed
-
Remember, the default value for flex-direction is row.
默认 flex-direction 是 row
-
Technically, line 2 says, “make sure the minimum height (min-height) of the body element is 100% of the viewport height (vh)”
让 body 最小高度是100vh
-
descendant selector - which is based on parent and child relationship.
父子选择器,用空格
-
/* ... */
css注释:color: red; /Should this be Red or Green? - another comment!/
-
-
www.educative.io www.educative.io
-
Here is what you should have:
list-style: none; 放在 ul 里面,改变 li 的样式
-
-
-
if the first child in an element has a margin-top,that can merge with the parent's margin-top.所以解决方法就是给 parent 加 padding,只要不 touch 第一个 子元素就不会有这个问题
-
-
-
盒模型的默认 margin-top 和 margin-bottom 等于其font-size
-
- Apr 2020
-
-
Open Command tool and search for coverage
Checking CSS coverage inside Chrome Dev Tools:
- [F12] (open up dev tools)
- Click the 3 dots next to "x"
- "More tools" > "Coverage"
-
-
lesscss.org lesscss.org
-
-
www.w3schools.com www.w3schools.com
Tags
Annotators
URL
-
- Mar 2020
-
www.youtube.com www.youtube.com
-
There's a really cool layout rendering video at 17:00.
-
-
-
paramaggarwal.substack.com paramaggarwal.substack.com
-
We were not satisfied with the basic capabilities like bold and italics so we built CSS. Now, we wanted to modify some parts of the HTML/CSS in response to things like clicking things, so we implemented a scripting language to quickly specify such relations and have then run within the browser itself instead of a round trip to the server.
Birth of CSS - advanced styling
(history of websites)
-
-
stackoverflow.com stackoverflow.com
-
ol { counter-reset:item; } li { display:block; } li:before { content:counter(item) '. '; counter-increment:item; }
-
- Jan 2020
-
developer.mozilla.org developer.mozilla.org
Tags
Annotators
URL
-
-
developer.mozilla.org developer.mozilla.org
-
developer.mozilla.org developer.mozilla.org
-
var stylesheet = document.styleSheets[0]; stylesheet.cssRules[0].style.backgroundColor="blue";
-
-
Tags
Annotators
URL
-
-
css-tricks.com css-tricks.com
-
.text:after { /* This value is the OPPOSITE color of our background */ color: rgb(0, 255, 255); mix-blend-mode: difference; }
Tags
Annotators
URL
-
-
man.hubwiz.com man.hubwiz.com
-