Let’s use (X, X, X, X) for talking about specificity

Category Image 052

I was just chatting with Eric Meyer the other day and I remembered an Eric Meyer story from my formative years. I wrote a blog post about CSS specificity, and Eric took the time to point out the misleading nature of it (I remember scurrying to update it). What was so misleading? The way I was portraying specificity as a base-10 number system.

Say you select an element with ul.nav. I insinuated in the post that the specificity of that selector was 0011 (eleven, essentially), which is a number in a base-10 system. So I was saying tags = 0, classes = 10, IDs = 100, and a style attribute = 1000. If specificity was calculated in a base-10 number system like that, a selector like ul.nav.nav.nav.nav.nav.nav.nav.nav.nav.nav.nav (11 class names) would have a specificity of 0111, which would be the same as ul#nav.top. That’s not true. The reality is that it would be (0, 0, 11, 1) vs. (0, 1, 0, 1) with the latter easily winning.

That comma-separated syntax like I just used solves two problems:

  1. It doesn’t insinuate a base-10 number system (or any number system)
  2. It has a distinct and readable look

I like the (X, X, X, X) look. I could see limiting it to (X, X, X) since a style attribute isn’t exactly a selector and usually isn’t talked about in the same kind of conversations. The parens make it more clear to me, but I could also see a X-X-X (dash-separated) syntax that wouldn’t need them, or a (X / X / X) syntax that probably would benefit from the parens.

Selectors Level 3 uses dashes briefly. Level 2 used both dashes and commas in different places.

Anyway, apparently I get the bug to mention this every half-decade or so.


The post Let’s use (X, X, X, X) for talking about specificity appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Swipey Image Grids

Category Image 091

I hope people think of SVG as a vector format that is good for drawing things. There is plenty more to know, but here’s one more: SVG is good for composition. You draw things at very specific coordinates in SVG and, while they can scale, they tend to stay put. And while SVG is a vector format, you can place raster images onto it. That’s my favorite part of Cassie’s “Swipey image grids” post. The swipey part is cool, but the composition is even cooler.

<svg viewBox="0 0 100 100">
  <rect x="30" y="0" width="70" height="50" fill="blue"/>
  <rect x="60" y="60" width="40" height="40" fill="green"/>
  <rect x="0" y="30" width="50" height="70" fill="pink"/>

  <image x="30" y="0" width="70" height="50" href="https://place-puppy.com/300x300"/>
  <image x="60" y="60" width="40" height="40" href="https://place-puppy.com/700x300"/>
  <image x="0" y="30" width="50" height="70" href="https://place-puppy.com/800x500"/>
</svg>

You’ll need to check this out in Chrome, Edge or Firefox:

Don’t miss Cassie’s interactive examples explaining preserveAspectRatio. That’s a thing I normally think of on the <svg> itself, but is used to great effect on the <image> elements themselves here. It’s like a more powerful object-fit and object-position.

Direct Link to ArticlePermalink


The post Swipey Image Grids appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Is there any importance for URL AGE ?

Featured Imgs 11

One of my client he have a domain whcih is example.ae from the last 9 years. Now I have desinged the website for him and need to host the website. But his all social media urls are examplemobile. I have suggested to him we can better purchase the domain examplemobile.com which is availabe for purhcase.

If we boghuth this domain it will effect the SEO ranking.

I heared that old domain have more imporant than newly purhcased domain, Is it true ?

This domian .ae it will icluded in the domain age calculation of SEO Bots.

Query regarding vb.net

Category Image 101

Hey , I am a begginer in vb.net and I want to retrieve my data from access database as well as manipulate indivial record according to my choice..Can you help me with this
Thanks & Regards

Mobile owner Information

Category Image 101

I am starting an online business with an American lady. I don't know anything other than her phone number. So want to verify her records.

Book Information

558fe5180e0e8fc922d31c23ef84d240

#include<conio.h>
#include<iostream>
struct book

int bookid;
char title;
float price;
display(book);
book input();
;

int main()

book b1;
b1=input();
display(b1);

display(book b)

std::cout<<"\n"<<b.bookid<<" "<<b.title<<" "<<b.price;

book input(book b)

book b;
std::cout<<"Enter Bookid,Title,Price :";
std::cin>>b.bookid>>b.title>>b.price;
return(b);

error: 1st : error: 'input' was not declared in this scope
2nd : error: 'display' was not declared in this scope
3rd : error: declaration of 'book b' shadows a parameter

How to retrieve a device name from IP or MAC on LAN

558fe5180e0e8fc922d31c23ef84d240

In Visual Studio 2015, VB, in Windows 10, I have a small program where I use the arp -a command
to pick up the mac and I/P addresses of connected devices on my lan. From everything I've read (and tried), the answer
somehow comes back to DNS.getHostEntry which throws a No Such Host when fed a cell's I/P and
I understand that, a cell phone is not a host. Does anyone know of the appropriate DNS or other type
command that, fed an I/P or MAC will return the device's name?

Thank you.

inserting into mysql database through php

Category Image 101
<?php
$pdo = new PDO('mysql:host=localhost;port=3306;dbname=crud', 'root', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$title = $_POST=['title'];
$description = $_POST = ['description'];
$price = $_POST = ['price'];
$date = date('Y-m-d H:i:s');
$products = $statement = $pdo->prepare("INSERT  INTO products (title, image, description, price, Create_date)
VALUES (:title, :image, :description, :price, :date)");
$statement->bindValue(':title', $title);
$statement->bindValue(':image', '');
$statement->bindValue(':description', $description);
$statement->bindValue(':price', $price);
$statement->bindValue(':date', $date);
$statement->execute();

?>

Jenny B Kowalski’s A-Z (and a-z) as Variable Letterforms

Category Image 052

Jenny B Kowalski has been posting a-letter-a-day on Instagram exploring multi-axis variable/responsive letterforms. They are very clever in that one of the axes controls an uppercase-to-lowercase conversion, literally morphing the shape of the letters from an uppercase version to a lowercase version. The other axis is a stroke weight, which also dramatically changes the feel of the letters.

Here’s Q, one of my favorites:

She’s using p5.js, but I don’t see any reason these couldn’t be made into a variable font with custom axes.

OK here’s one more. I find the I/i very clever:


The post Jenny B Kowalski’s A-Z (and a-z) as Variable Letterforms appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.