Why does CSS work with fake elements ? Last Updated : 01 Jun, 2022 Comments Improve Suggest changes Like Article Like Report CSS (Cascading Style Sheets) is a stylesheet language used to design a webpage to make it attractive. The reason for using this is to simplify the process of making web pages presentable. It allows you to apply styles on web pages. More importantly, it enables you to do this independent of the HTML that makes up each web page. In this article, we are going to learn about CSS work with fake elements. Fake elements: Fake elements are elements in HTML that are not specified in the HTML document. It is possible to create fake elements. Just create an element with any name you want to but it is not recommended to use. let us see why it is not recommended to use. Example 1: In the below example, we have created some fake elements. We have created one element named "GeeksforGeeks" and it is working fine with the browser. HTML <!DOCTYPE html> <html> <head> <title>GeeksforGeeks</title> <style> body { text-align: center; } GeeksforGeeks { color: green; font-size: 60px; } </style> </head> <body> <GeeksforGeeks>GeeksforGeeks</GeeksforGeeks> </body> </html> Output: Why CSS is working with this element? This is because some browsers are designed to be compatible with future additions to HTML and unrecognized elements are parsed into the DOM but have no functions. Let us see the default functionality of the fake element. Example 2: In the below example, we will see the default functionality of fake elements. HTML <!DOCTYPE html> <html> <head> <style> body { text-align: center; } h1 { color: green; font-size: 60px; } </style> </head> <body> <h1>GeeksforGeeks</h1> <GeeksforGeeks>GeeksforGeeks</GeeksforGeeks><br> <is>GeeksforGeeks</is><br> <a>GeeksforGeeks</a><br> <computer>GeeksforGeeks</computer><br> <science>GeeksforGeeks</science><br> <portal>GeeksforGeeks</portal><br> <for>GeeksforGeeks</for><br> <geeks>GeeksforGeeks</geeks><br> </body> </html> Output: We recommended not to use fake elements for developing any web page because of the following reason: Fake elements are not allowed by the HTML specification.Fake elements might conflict with future standard elements with the same name.In HTML specification there must be a better element with some specialty because fake elements do nothing by default. Comment More infoAdvertise with us Next Article Why does CSS work with fake elements ? P pall58183 Follow Improve Article Tags : Web Technologies CSS CSS-Questions Similar Reads Does element width include padding in CSS ? Cascading Style Sheets fondly referred to as CSS, is a simply designed language intended to simplify the process of making web pages presentable. CSS allows you to apply styles to the web pages. More importantly, CSS enables you to do this independent of the HTML that makes up each web page. It desc 3 min read Pure CSS Hiding Elements While making an interactive website, there may be elements that need to be hidden by default or on some action of the user. In this article, we will be seeing how to hide elements in Pure CSS. Pure CSS Hiding Elements Classes: hidden: This class is used to hide elements while supporting old browsers 2 min read CSS element Selector The element selector in CSS is used to select HTML elements that are required to be styled. In a selector declaration, there is the name of the HTML element and the CSS properties which are to be applied to that element is written inside the brackets {}. Syntax:element { \\ CSS property}Example 1: T 2 min read Different ways to hide elements using CSS While working on UI/UX we have to take care of every web element that appears on the webpage to make the user experience easier. While designing such pages we often need to hide or show some particular HTML elements on any event or on any particular interval. In this article, we could do that easily 8 min read How does CSS work under the hood ? Cascading Style Sheets referred to as CSS, is a stylesheet language used to design and describe the presentation of the webpage to make it attractive. The main use of CSS is to simplify the process of making web pages presentable. The way elements should be rendered on screen is described by CSS. CS 3 min read CSS element > element Selector The element > element Selector in CSS is used to select direct child elements of a specified parent element. This selector ensures that the style is applied only to elements that are directly nested within another element, ignoring any deeper nested elements.Direct child selection: Targets only i 4 min read CSS element~element Selector The element ~ element selector in CSS is used to match the second element if it follows the first element (it doesn't need to be immediate). They both should have the same parent element. Syntax: element ~ element { //CSS Property}Example 1: In the below program you can see that "p ~ ul" will select 2 min read How to Blend Elements in CSS ? Blending elements in CSS refers to combining the visual content of multiple elements using blend modes. The mix-blend-mode and background-blend-mode properties allow you to blend backgrounds, images, and text, creating visually interesting effects similar to image editing software.Blend modes are us 2 min read CSS element+element Selector The element+element selector in CSS is a sibling combinator used to style an element that is immediately preceded by another specified element. It targets the second element only if it immediately follows the first element in the document structure.Syntaxelement1 + element2 { /* styles */}element1 i 3 min read CSS Pseudo Elements A pseudo-element is a keyword added to a selector that lets you style specific parts of an element. For example, you can style the first line of a paragraph, add content before or after an element, or create complex effects with minimal code. Pseudo-elements are denoted by a double colon (::) (or : 4 min read Like