How does style elements such as “color” in CSS apply to elements like img?

Tags: html,css

Problem :

I am currently reading a book on HTML to develop websites and I came across an exercise that required me to highlight the elements in a tree diagram that would be affected by the style rule

div#intro{color: red;}

Here is an image of the solution I don't quite agree with it because I don't think you can give an img element the color red. Is the solution incorrect or is it my understanding of inheritance incorrect?

Solution :

Well any text associated with the image will be red. If I don't provide a src, for instance, but provide alt text... the alt text will be red.

Look at this fiddle


<div id="red">
    <img alt="This is my alternate text" />


#red {
    color: #F00;

    CSS Howto..

    How to solve CSS background transparency?

    How to point to CSS default class using the class attribute

    How not to display / filter out special characters? (CSS or Javascript)

    How Should I Display This Background Using CSS?

    How to make the same distance between tags with only CSS?

    How do you make a div display two inline items that stretch the width?

    How do I loop a css animation with multiple keyframe definitions?

    Angularjs: How to *retrieve* css property from element in directive?

    How to control spaces/margin between bars?

    How to crop Google GeoChart and center its content?

    How can I prevent IE from displaying a website? [closed]

    How to reuse and override Css style?

    How to edit the css style of validation ng-class error

    How to prevent IE from loading hidden content using HTML/CSS only?

    DOM How to add two divs (with jQuery inside them) next to each other?

    How to move image in div with CSS?

    jquery show() not displaying properly for highcharts graph

    How to display Highcharts in rows (5)

    How to copy a CSS style from a website for re-use

    In CSS, how to select a particular tag under mutiple ids?

    How to put bootstrap glow (used in the 'form-control' CSS class) on a div?

    How to make section element in css to full width

    How to make a stable two column layout in HTML/CSS

    How style selected option with CSS without styling all the other options?

    How to make a full page header?

    How do I change CSS submenu width so it doesn't used the same width as the main menu?

    how to deal with repeated letters in a javascript hangman game

    How do you add multile vendor prefixes to one css property?

    How to style a single QToolButton using qss/css

    How to add a half circle at the bottom middle of my header?