Snippets.page

Code snippets, tips, how-tos

Tag: css

  • Overflow both sides in CSS

    Normally, when content or an image overflows outside a div, the overflowing content is shown on the right outside the “box”. If you want to position the content to the center, so that overflow is on both sides, you can use this class. This is useful to position an image such that the centre of […]

    Read more

  • Make an inner div full width in CSS

    Make an inner div expand to the full-width of the page. When a div is inside another div, adding width: 100% will only stretch it to the width of its container. To make the stretch to the full width of the page (or viewport), use this:

    Read more

  • Align second line of bullet points in CSS

    HTML aligns the lines after the first line flush with the bullet point (the dot) instead of the text. You can fix this with the class below. text-indent property applies only to the first line of a text-block. So we first “pull” the first-line back along with the dot. Then we push the entire text-block […]

    Read more

  • Highlight the current post’s tags in WordPress

    List all tags in a bulleted list and highlight only the current post’s tags. Highlight the current post’s tags using CSS The idea is to show all the tags used on the site and then add a CSS class to the tags that are used in the current post. This class can then be styled […]

    Read more