creating a span as color box inside a <p> tag

11,885

display: inline_block;

should be:

display: inline-block; (a hyphen instead of an underscore).

Always be sure to open up your browser's dev tools to easily find these types of mistakes. In Chrome, for example, inspecting the <span> element shows an "invalid property value" warning next to display: inline_block;

Share:
11,885

Related videos on Youtube

aherlambang
Author by

aherlambang

iOS and web developer passionate on building apps

Updated on June 04, 2022

Comments

  • aherlambang
    aherlambang almost 2 years

    I have the following code:

    <p style="font-size: 12px;line-height: 24px;font-weight: normal;color: #848484;padding: 0;margin: 0;"><b>COLOR:</b> <span style="width: 15px; height: 15px; margin:auto; display: inline_block; border: 1px solid gray; vertical-align: middle; border-radius: 2px; background: #FF0000 "></span> </p>
    

    The fiddle is here

    And I am trying to create the following effect:

    enter image description here

    Why isn't this showing up the color box in the span?

Related