In CSS, can an ID inherit a Class?
For example, I got a header with a class denominated "x" and I wanna insert a image with an ID denominated "y" inside the header. I wanna the width of the image 50% the size of the width of the header. My CSS code right now is: body{ font-family: arial, sans-serif; background-color: white; color: black; } .cabecalho{ position: relative; max-width: 100%; max-height: 100px; border: 1px solid black; } #logoCabecalho{ position: relative; width: 50%; height: 50%; } My HTML code right now is: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"/> <title>Document</title> <link rel="stylesheet" type="text/css" href="StyleSheet/stylesheet.css"/> </head> <body> <header class="cabecalho"> <img src="https://d2yty0x2cuh2al.cloudfront.net/uploads/image/file/15384/regular_profite.jpg" id="logoCabecalho"/> <div id="busca"> </div> </header> </body> </html> But this doesnt make the image 50% the width and height of my header. How can I do it?