HTML5 has a new attribute, contenteditable, which can be applied to any element which allows it to be edited directly in the browser window. Think of text input with a predefined value, but it can literally be any element. Form elements like text inputs support the :focus pseudo class, which allow us to style those elements when they are clicked upon or otherwise navigated to.
Giving an element the contenteditable attribute means it also now
supports the :focus pseudo class, which opens up some interesting
possibilities!
We’ll exploit this little trick to make an expanding image (like a lightbox without the overlay) right within some content.
Comments
Be the first to write a comment
You must me logged in to write a comment.