Solutions to some common problems in html

Nonsense: This is the first time I write a blog, I am learning HTML5 recently, and I record the pits I encounter. First, I can deepen my impression. Second, I can help children’s shoes who encounter the same pit. Third, I can exercise my expressive ability. Yes, haha, if there are any mistakes, please criticize and correct......


1.a After the label is clicked on the mobile phone, a colored box will appear, which is extremely ugly. How to remove it? Method:

 Add to a tag style: -webkit-tap-highlight-color : rgba ( 0 , 0 , 0 , 0 ) ;

  Among them, tap means click, highlight means background highlighting, and setting the color to transparent will not have that ugly frame.


2. Run a project and set the width of the project to 100% and find that it still cannot be full screen, there will be some spacing next to it, the solution:

 

* {
      padding : 0 px ;
      margin : 0 px ;
}
* means to set all attributes in html

3. When setting margin-top, I found that sometimes it doesn't listen to you, either it has no effect, or it moves down together with the parent. Haha, there are three ways to solve the smallness of margin-top:

(1) Add a border to the parent tag
     You can add a border to the parent with the same color as the background, so that you can't see that a border has been added, hahaha
(2) Add the overflow:hidden attribute to the parent
    The role is to hide overflow
    
 (3) Parent setting padding-top
    Equivalent to the margin-top of the child

4. When there are two labels at the top and bottom of the child with the same level, one is set with margin-top=20px; the other is set with margin-bottom=30px; then what is their spacing? Xiaobai will definitely say, not 50px Well, I thought so too at first cry, but in fact their spacing is 30px, why, because their margins will be superimposed, so when this happens, whoever has a larger margin will listen to whoever.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325485630&siteId=291194637