[Learning]#5 Types of CSS Selector

body{
font-size:16;font-family:"Arial"
}
h3{
font-size:24;text-decoration:underline;
}
  • Add a “dot” before the class. Also, we can connect a specific tag before the class if we want it to be the exclusive use of the tag.
div.content{
padding:10px;border:1px dashed #888888;
}
  • Add a “#” before the id
#btn{
border:1px solid #888888;
background-color:#ffffff;padding:5px;
}
  • Often used with other selectors
  • Example1. #:hover — for button clicking design
#btn:hover{
background-color:#888888;
}
  • Example2. #:focus — for getting cursor’s focus
input:focus{
border:2px solid #ff0000;
}
  • Often used with other selectors
.content1 a{
color:#0000ff;
}
.content2 a{
color:#008800;
}

Music of Today: Peaches covered by 吱吱郭芝吟ChihChih

Clap/Share/Follow

If you guys find this article helpful, please kindly do the writer a favor — giving 5 clicks at the GREEN area and 10~50 claps at the bottom of this page.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vida Lin

Vida Lin

PM, Relationship, Travel, or anything quirky but interesting.|Subscribe & buy Vida a drink @LikerLand, the bottom of each article. 在文章底下LikerLand訂閱、請Vida喝一杯飲料 ❤