css tips memo_html/css_WEB-ITnose
Preface: In the process of learning and practicing CSS, I often forget some seemingly commonly used codes. In order to strengthen my memory, I will summarize them here and add and delete them one after another for immediate reference. I hope that I can solve problems in time in the future and keep these strange characters in mind.
1. About forced alignment of paragraph text
text-align:justify; text-justify:inter-ideograph ;
If you want to align the text at both ends, you must first define the width of P, then { text-align:justify; text-justify :distribute-all-lines; }
2. Add CSS to the different states of the button
Html code
- ;input type="button"
- onMouseOver="this.className='over';"
- onMouseOut="this.className=' ';"
- onMouseDown= "this.className='down';"
- onMouseUp="this.className='over';"
- value="Unclicked button"
- onClick ="this.value='The clicked button'" name="Button">
- Three, in Import another CSS from one CSS file
@import url(***.css);
Four , Gradient background color (you must add width or height to use this)
FILTER:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#EEF5F8,endColorStr=#ffffff);
When using this, you must pay attention to defining the width or height value of the DIV.
Css code
.gradient {
/* Firefox 3.6 */
background-image: -moz-linear-gradient(top, #81a8cb, #4477a1);
- /* Safari & Chrome */ image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #4477a1),color-stop(1, #81a8cb));
- /* IE6 & IE7 */
- filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#81a8cb', endColorstr='#4477a1');
- /* IE8 */
- -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#81a8cb', endColorstr='#4477a1')";
- }
- background:#f4faff9; background:linear-gradient(#fff 0%,#f1f9ff 100 %) no-repeat;
- background:-moz-linear-gradient(#fff 0%,#f1f9ff 100%) no-repeat; background:-webkit-gradient(linear,0 0,0 100% ,from(#fff),to(#f1f9ff)) no-repeat;
5. Use PNG images to create transparent effects in IE6
*html #id{ filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled =true, sizingMethod=scale, src=images/*.png); background:none; }
6. Single line omitted text
{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
When using this, you must pay attention to defining the width of a single line (such as div or li) that needs to omit text value.
7. Code for setting as homepage and adding to favorites
Html code
8. Chinese stroke effect
Java code
- class="sizscolor"> Chinese stroke effect