Use of style in react

Source: Internet
Author: User

The use of style in react is somewhat different from that used directly in HTML, first, react must be style= "opacity:{this.state.opacity};" This type of writing, second if multiple style formats are as follows, comma split between multiple style

var divstyle = {
  color: ' White ',
  backgroundimage: ' url (' + Imgurl + ') ',
  webkittransition: "All",//Note the Capital ' W ' here
  mstransition: ' All '//' Ms ' are the only lowercase vendor prefix
};


But in HTML we usually use it directly, with semicolons in the middle of multiple style;

<div style= "BackgroundColor: #FFFF90; Color: #FFFFFF ">white text2</div>
<!--div tags use the Style property to set the font color-->

<span style= "BackgroundColor: #FFFF90" ><a style= "color: #FF00FF" href= "http://www.baidu.com" >nihao</ A> </span>



The code example gives an example of the color of text in a table and the background color of a text box:

</pre><pre name= "code" class= "HTML" ><! DOCTYPE html>  


The final effect figure is as follows:


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.