代码改变世界

[CSS] Frequently used method or solutions for issues

2019-04-01 22:47  Johnson_强生仔仔  阅读(295)  评论(0编辑  收藏  举报
  • Stick button in right side in html

  Solution: 

  

//In the html
<div class="float__button" >
</div>

// In the css file
.float__button{
    margin-right: 5%;
    float: right;
}

 

  • Set the size of textarea in CSS.

  Solution: 

//In the html
<div class="product__details" >
<textarea rows= "5", cols="10">
</textarea>
</div>

// In the css file
.product__details {
textarea{
    width: 80%;
    height: 80px;
}

 

  • Set the item at the top besides the textarea

span{
    vertical-align: top;
}

 

  • set font like this(斜体)

  

font-style: italic;

 

  • disable resizable property of textarea

  Solution: 

textarea {
  resize: none;
}
  • set the maximun length of text in textarea

  Solution: 

//In the html
<div class="product__details" >
<textarea maxlength="255">
</textarea>
</div>