CSS icon text alignment and form input box text alignment compatibility example

Source: Internet
Author: User

1. Icon and text alignment

General icon and text alignment HTML code:

<p><i class= "icon" ></i> Front-End development blog </p>

<p><a href= "javascript:" class= "icon" > Delete </a> front-end Development blog </p>

Zxx CSS Code:

p{line-height:20px; font-size:14px;}
. Icon {
Display:inline-block;
width:20px; height:20px;
Background:..;
White-space:nowrap;
Letter-spacing: -1em;
Text-indent: -99em;
Color:transparent;
* IE7 * *
*text-indent:0;
*zoom:expression (this.runtimestyle[' zoom '] = ' 1 ', this.innerhtml = ' \3000 ');
}
. icon:before {
/* pseudo element Insert space text * *
Content: ' \3000 ';
}

This code is mainly through Line-height to control the text of the icon and the adjacent text is also high, implemented in the same line.

2. Form input box and content alignment

A simple text and text input

<div class= "Clearfix mt15" >
<label class= "left" > Mobile phone number <span class= "Red abs" >*</span></label>
<div class= "Cell" >
<input type= "Tel" class= "Ui_input" name= "tel" required= "" >
</div>
</div>

CSS code:

body{font:14px/1.42858 ' Microsoft Yahei ', Arial, Sans-serif;-webkit-font-smoothing:antialiased}/* Line height is 20 pixels */
. cell {
Display:table-cell;
*display:inline-block;
width:2000px;
*width:auto;
}
Input.ui_input,
. ui_input > Input {
height:20px
line-height:20px;
padding:9px 8px;
border: 1px solid #d0d0d5;
Border-radius:4px;
Background-color: #fff;
Font-size:14px;
Outline:none;
Color: #545a6c;
-webkit-transition:border-color 15s, Background-color 15s;
Transition:border-color 15s, Background-color. 15s;

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.