CSS Value Inherit Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report The value inherit keyword is used to inherit a property to an element from its parent element property value. The inherit keyword can be used for inheriting any CSS property, and on any HTML element. Inheritance is always from the parent element in the document tree, even when the parent element is not the containing block. Syntax: property_name: inherit; Example 1: Inheriting the font size from the parent element. html <!DOCTYPE html> <html> <meta charset="utf-8"> <head> <style> span { font-size: 10px; } .gfg { font-size: inherit; } </style> </head> <body> <h1 style="text-align: center; color: green;"> GeeksforGeeks </h1> <div style="text-align: center; font-size: 20px;"> <span class="gfg">Inherited size</span> </div> </body> </html> Output: Example 2: Inheriting the color from the parent element. html <!DOCTYPE html> <html> <meta charset="utf-8"> <head> <style> span { color: blue; } .gfg { color: inherit; } </style> </head> <body> <h1 style="text-align:center; color:green;"> GeeksforGeeks </h1> <div style="text-align: center; color: green"> <span class="gfg"> Inherited color is green but span color is set to blue </span> </div> </body> </html> Output: Supported Browsers: Chrome 1 Safari 1 Edge 12 Firefox 1 Opera 4 Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now! Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore. Last Updated : 24 Aug, 2022 Like Article Save Article Previous CSS width Property Next D3.js threshold.range() Function Share your thoughts in the comments Add Your Comment Please Login to comment...