Today I Learned - Rocky Kev

Tagged “html”

  1. TIL how Error correction works in HTML

    You never get an 'Invalid Syntax' error on an HTML page. Browsers fix any invalid content and go on.

  2. TIL what DOCTYPE means

    tl;dr: DOCTYPE declaration in the first line of the HTML file, to instruct the browser to run the code in Standard mode.

  3. TIL Content sectioning

    Content sectioning or landmarks, like sidebar, content, footer. You know, like better names.

  4. TIL the Description List element

    Lists of name–value pairs (or, in some cases, name–value groups) are a common pattern across the web, in part due to their versatility. HTML lets us mark up these lists with a combination of three elements

  5. TIL accessing different data attributes

    You can access it in javascript using element.getAttribute('data-sandwich'). A better way is to go with the Element.dataset property.

  6. TIL prepend

    When you're creating new elements in Javascript, you want to attach the new element to something that exists in the DOM already. You do that with append, and prepend.

  7. TIL aria-expanded for showing when things are hidden/shown

    The aria-expanded attribute is set on an element to indicate if a control is expanded or collapsed, and whether or not its child elements are displayed or hidden.

  8. TIL ARIA role presentation

    Think of this as a reset. You use role=presentation to remove semantic meaning from an element.

  9. TIL Decorative Images

    make a blank alt='' for presentation images - aka image might already be given using adjacent text, or the image might be included to make the website more visually attractive.

  10. TIL that adding a psuedo-h7

    Natively, there are 6 heading levels. What if accessibility-wise, you wanted a new heading level?

  11. TIL how to use ':where()'

    You can probably also use a helper class like `no-bullets`. But this method does follow a default top-down approach pattern with CSS that i'm starting to also fall in love with.

  12. TIL different ways to inject content via Javascript

    There's lots of ways to do things in Javascript. It gets difficult to know which way is the 'preferred' way.

  13. TIL using html comments in javascript

    This is in the 'bad idea' area! But just a need little factoid!

  14. TIL Disable users from highlighting text

    You can use the 'user-select' property to prevent an element from being highlighted by the user.

  15. TIL the wbr element

    '<wbr>' is a HTML element that represents a word break opportunity—a position within text where the browser may optionally break a line, though its line-breaking rules would not otherwise create a break at that location.

  16. TIL how images get displayed to the browser

    Image data is usually encoded in order to reduce file size. You can change when to decode the image.

  17. TIL onError

    When a resource (such as an img or script) fails to load, an error event using interface Event is fired at the element that initiated the load, and the onerror() handler on the element is invoked.

  18. TIL the global attribute translate

    A good use-case is if your brand has words that can be translated.

  19. TIL default spellcheck in html

    The spellcheck is a global attribute that you can use to check spelling and grammar on HTML elements such as input fields and other editable elements.

  20. TIL the multiple value in html

    The multiple attribute allows the user to enter multiple values on an '<input>'. It is a boolean attribute valid for file or email input types and the '<select>' element.

  21. TIL a Accessible way to solve Read More

    Screenreaders help sight-impaired visitors have a better experience. The most annoying thing on a news website is to hear this: Read more — link, read more — link, read more — link. There's two ways to solve it.

  22. TIL how to create adaptive SVGs

    SVG markup is XML using an .svg file type extension which allows it to hold more dynamic types of code. SVG is able to scale up and down without quality loss, and can potentially be very small in size, they can also have embedded CSS, even embedded media queries.

  23. TIL the meta refresh redirect method

    A Meta refresh redirect is a client-side redirect. Unlike 301 and 302 redirects that happen on the web server, a meta refresh redirect instructs the web browser to go to a different web page after a specified time span

  24. TIL of the base element

    base element adds the domain link to all relative links.

  25. TIL you can make SMS links

    So you can make a 'mailto:' and a 'tel:' link. But did you know you can also do 'sms' messages too?

  26. TIL using datalist for a pure HTML input suggestion

    Web developers do not use the power of 'datalists' enough. It combines the power of a 'selector', with the ability to type out your choice using the keyboard.

  27. TIL of the selectopt group

    You can create some cool dividers for your field options using the 'optgroup' element.

  28. TIL you can wire different inputs to different forms

    You can add the form element inside a input, to point specifically to the form you want to target.

  29. TIL how my team used web components

    I'm sure this site is from like 2002 or something (I don't exactly know). This was a super quick task. And from the looks of it's age, we just wanted to get it done quickly.

  30. TIL I'm done with FontAwesome

    When I first discovered FontAwesome in 2013, I like everyone thought the same thing -- this is a MAJOR game changer. It is now 2022. As I look back, FontAwesome has become unsustainable.

  31. TIL CSS pseudo-element first-letter, to make a Drop Cap

    You can add a drop cap to a paragraph by using the ::first-letter pseudo-element.

  32. TIL Adding Tooltips without a library

    You can add tooltips without a library by adding a title attribute in any html element

  33. TIL the Download attribute in links

    href="link/to/your/file" download="filename.pdf" to make your links auto-download

  34. TIL how to turn anything into a editable text

    So you'd use a 'input' or 'textarea' field to create a space for the end user to add new content. Did you know you can also do with that almost any element?

  35. TIL the DOM and CSSOM

    DOM is the html. CSSOM is the design. Together, they become... WEBPAGE-PERSON.

  36. TIL Web Component two-up

    I think there's still a world where it can exist. We just have to find a right way to do it.

  37. TIL that there was a menu element in prior HTML versions

    There was a menu element that we replaced with ul and li elements

  38. TIL about Constraint Validation API (forms)

    Inputs are pretty powerful. Right out of the box, they can autocomplete, validate data, create minimum/maximum lengths, allow for patterns, and even provide state!

  39. TIL there's actually a official guide for how HTML is implemented

    Enjoy arguing about HTML standards and realize the MDN isn't cutting it? Well I have a solution.

  40. TIL iframe sandbox attribute

    The iframe HTML element represents a nested browsing context, embedding another HTML page into the current one. There's also a sandbox mode.

  41. TIL HTML's native hidden attribute

    To hide a DOM element: there's a native HTML attribute called `hidden`.

  42. TIL column-count

    Using the column-count property you can break an element's content into a specified number of columns.

  43. TIL How CSS get added into the DOM

    Render Tree is CSSOM + DOM Tree with all the correct stylings

  44. TIL HTML elements like Blockquote, datalist, details, meter, & progress

    HTML Elements I forget exist. Blockquote, datalist, details, meter, progress

  45. TIL Copy/Paste SVG Icons

    And by inlining the SVG, you make one less call, and it loads faster. heroicons.dev is awesome

  46. TIL Accessible CSS Accordions

    For years, I've been looking to find a CSS accordion that is also accessible.

  47. TIL the start attribute in lists

    The start attribute in lists

  48. TIL this Responsive Image Generator

    With website optimization, it's better to deliver only the image that the browser size needs. Do that here.

  49. TIL roman numerals in list elements

    In documentation, you often find roman numeral listings, and I never bothered to figure out how that was done!

  50. TIL the difference between embed and iframe

    What the heck is a <iframe> and a <embed>

  51. TIL Alt text for images that are important

    Alt text is required if the image is a critical part of the content.

  52. TIL Alt Text for everything else

    alt text for images with captions, that are decorative, part of image sets

  53. TIL Adding Alt text to Supporting Images

    For images not critical to the content but support it, a alt attribute must be present.

  54. TIL Alt text for images that contain text

    Alt text for images that contain text

  55. TIL alt text for logos, the right way

    Putting alt text on logos, the right way

  56. TIL Details element that creates a accordion

    HTML Clickable details element!

  57. TIL about the insides of SVGs and the text element

    SVGs are like mini-html files!

  58. TIL Input List with datalist

    datalists and autocomplete features

  59. TIL Triggering Reflow

    Have you ever been reading an article online when something suddenly changes on the pag

  60. TIL the 4 steps in rendering a webpage

    A typical browser renders a document in 4 steps: style, layout, paint, and compositing.

  61. TIL Clean Pasting

    Clean Paste

  62. TIL Scroll Margin for anchor links

    When you use anchor links, it jumps to the content with the assigned ID. But it sucks.

  63. TIL that you shouldn't use Placeholders as inputs

    Placeholder texts aren't labels.

  64. TIL When to use a button versus an "a href" link

    When to use one or the other

  65. TIL the difference between strong and i

    When to use strong vs i

  66. TIL reversing HTML lists

    Today I learned about the reverse attribute

  67. TIL about styling active/focus together

    Style active and focus at the same time. Some people get to your link or selection by keyboard.

  68. TIL how to use CSS to count things

    Using CSS Counter, counter-reset, and counter-increment.

  69. TIL You can look for elements with specific attributes

    Target elements via CSS with certain attributes

  70. TIL How to target Language

    Target language with CSS

  71. TIL the html lang affects the screen reader voice

    <html> element's lang attribute tells it which language it is written in.

  72. TIL image maps

    Find the image

  73. TIL Validation with pure HTML

    Validate without JS

  74. TIL the default is the first item

    Select all the html

  75. TIL The Address tag

    JS you so crazy

  76. TIL About Native Lazy Loading

    Native Lazy Loading is a thing!

See all tags.