阴影框中的字体颜色

时间:2015-08-14 10:40:32

标签: html

请您告诉我如何更改这段代码中的字体颜色?

<div style="background-color: #fff8c6; width: 250px; margin-left: 0px; margin-right: 20px; padding: 8px;"><b>What you get with your phone:</b>
  <br />• Mains Charger
  <br />• USB Cable
  <br />• Instructions
  <br />• Box
  <br />• Guarantee
</div>

1 个答案:

答案 0 :(得分:0)

使用:color:red

<div style="background-color: #fff8c6; width: 250px; margin-left: 0px; margin-right: 20px; padding: 8px;color:red;"><b>What you get with your phone:</b>
    <br />• Mains Charger
    <br />• USB Cable
    <br />• Instructions
    <br />• Box
    <br />• Guarantee
</div>

避免使用内联样式。使用css规则也可以这样做:

<强> CSS:

div {
    color:red;
    background-color: #fff8c6;
    width: 250px;
    margin-left: 0px;
    margin-right: 20px;
    padding: 8px;
}

HTML:

<div>
    <b>What you get with your phone:</b>
    <br />• Mains Charger
    <br />• USB Cable
    <br />• Instructions
    <br />• Box
    <br />• Guarantee
</div>