Div's contenteditable and placeholder pop out of the spark

Source: Internet
Author: User

Today, when you make a mobile phone-side release description, you need to implement line breaks and Plachholder.

Wrapping in a text box naturally thought of textarea.

The problem seems to have been resolved, but when the content is published, the line breaks are lost in the HTML.

This is the time to use contenteditable and placeholder.

<class= "Con"  contenteditable= "true"  placeholder = "Please enter description ..." ></ Div >
. Con:empty:before {    content: attr (placeholder);     color:#bbb;} . Con:focus:before {    content:none;}

Now bosses feel that the default placeholder benefits need to be changed. Keep searching:

. Con:empty:before {            content:attr (placeholder);             font-size: 16px;             color: green;        }         . Con:focus{            content:none;        }

Look at the final effect:

OK, fix it.

Div's contenteditable and placeholder pop out of the spark

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.