What does the “~” (tilde/squiggle/twiddle) CSS selector mean?

The ~ selector is in fact the General sibling combinator (renamed to Subsequent-sibling combinator in selectors Level 4): The general sibling combinator is made of the “tilde” (U+007E, ~) character that separates two sequences of simple selectors. The elements represented by the two sequences share the same parent in the document tree and the element represented by the first sequence … Read more

How to make a div 100% height of the browser window

There are a couple of CSS 3 measurement units called: Viewport-Percentage (or Viewport-Relative) Lengths What are Viewport-Percentage Lengths? From the linked W3 Candidate Recommendation above: The viewport-percentage lengths are relative to the size of the initial containing block. When the height or width of the initial containing block is changed, they are scaled accordingly. These units are vh (viewport … Read more

Table fixed header and scrollable body

Fixed table head – CSS-only Simply position: sticky; top: 0; your th elements. (Chrome, FF, Edge) For both sticky vertical TH and horizontal TH columns (inside TBODY): TH borders problem fix Since border cannot be painted properly on a translated TH element, to recreate and render “borders” use the box-shadow property: Fixed table head – using JS. (IE) You can use a bit of JS and translateY the th elements jQuery example Or plain … Read more

Set cellpadding and cellspacing in CSS?

Basics For controlling “cellpadding” in CSS, you can simply use padding on table cells. E.g. for 10px of “cellpadding”: For “cellspacing”, you can apply the border-spacing CSS property to your table. E.g. for 10px of “cellspacing”: This property will even allow separate horizontal and vertical spacing, something you couldn’t do with old-school “cellspacing”. Issues in … Read more

How to use PHP inside css file

If you’re able to rename your CSS file “layout.php”, there’s no need for all of these workarounds: Your layout.php file would look like: Your HTML files would look like: This question is very similar: Include: css with php file extension?