I know its been a long time coming, but better late than never. In your control panel, you can now choose to hide your location from others in your member profile.
What’s the Difference Between Width/Height in CSS and Width/Height HTML attributes?
Some HTML elements accept width
and height
as attributes. Some do not. For example:
<!-- valid, works, is a good idea -->
<img width="500" height="400" src="..." alt="...">
<iframe width="600" height="400" src="..."></iframe>
<svg width="20" height="20"></svg>
<!-- not valid, doesn't work, not a good idea -->
<div width="40" height="40"></div>
<span width="100" height="10"></span>
Those attributes are sometimes referred to as presentational attributes. The thing to know about them is that they are overridden by any other styling information whatsoever. That makes them ideal as a fallback.
So, if CSS loads and has a declaration like:
img {
width: 400px;
}
...that is going to override the width="500"
on the <img>
tag above. Presentational attributes are the weakest kind of styling, so they are overridden by any CSS, even selectors with very low specificity.
What might be a smidge confusing is that presentational attributes seem like they would have high specificity. These inline styles, for instance, are very strong:
<img style="width: 500px; height: 400px;" src="..." alt="...">
Using an inline style (which works on any element, not a select few), we've moved from the weakest way to apply width and height to one of the strongest. Regular CSS will not override this, with a selector of any specificity strength. If we need to override them from CSS, we'll need !important
rules.
img {
width: 400px !important;
}
To reiterate, presentational attributes on elements that accept them (e.g. <img>
, <iframe>
, <canvas>
, <svg>
, <video>
) are a good idea. They are fallback sizing and sizing information as the page is loading. They are particularly useful on <svg>
, which may size themselves enormously in an awkward way if they have a viewBox
and lack width and height attributes. Browsers even do special magic with images, where the width and height are used to reserve the correct aspect-ratio derived space in a situation with fluid images, which is great for a smooth page loading experience.
But presentational attributes are also weak and are usually overridden in the CSS.
The post What’s the Difference Between Width/Height in CSS and Width/Height HTML attributes? appeared first on CSS-Tricks.
Min and Max Width/Height in CSS
Here's a nice deep dive into min-width
/ min-height
/ max-width
/ max-height
from Ahmad Shadeed. I like how Ahmad applies the properties to real-world design situations in addition to explaining how it works. In the very first demo, for example, he shows a button where min-width
is used as a method for (trying to) make sure a button has space on its sides. It works if the text is short enough, and fails when the text is longer. That's the kind of "CSS thinking" that is fundamental to this trade.
Direct Link to Article — Permalink
The post Min and Max Width/Height in CSS appeared first on CSS-Tricks.
Anyone use Reddit?
Does anyone here use reddit, and if so, what do you like the most about it?