CSS detail set (3)
1. Display layers on flash
Solution: Set transparency for FLASHOr
2. Vertically center a layer in the browser
Solution: use absolute percentage to locate the negative value of the external patch.
. Code
- {Position: absolute;
- Top: 50%;
- Left: 50%;
- Margin:-100px auto-100px;
- Width: 200px;
- Height: 200px;
- } 3. Add to favorites front-end framework for sharing
Solution:
. Code
- <Script type = "text/javascript">
- // <li>function bookmark(){ <li>var title=document.title <li>var url=document.location.href <li>if (window.sidebar) window.sidebar.addPanel(title, url,""); <li>else if( window.opera && window.print ){ <li>var mbm = document.create_r_rElement_x('a'); <li>mbm.setAttribute('rel','sidebar'); <li>mbm.setAttribute('href',url); <li>mbm.setAttribute('title',title); <li>mbm.click();} <li>else if( document.all ) window.external.AddFavorite( url, title); <li>} <li>//
- </Script>. Code
- Add to favorites
Iv. Implement page background gradient using IE (not supported by FF and chrome)From top to bottom:
. Code
- Body {filter: progid: DXImageTransform. Microsoft. Gradient (gradientType = 0, startColorStr = # ffffff, endColorStr = #000000 );}
Top left to bottom right:
. Code
- Body {
- Filte: Alpha (style = 1, opacity = 25, finishOpacity = 100, startX = 50, finishX = 100, startY = 50, finishY = 100); background-color: skyblue;
- }
From left to right:
. Code
- Body {FILTER: progid: DXImageTransform. Microsoft. Gradient (gradientType = 1, startColorStr = # ffffff, endColorStr = #000000 );}
From top to bottom:
. Code
- Style = "filter: progid: DXImageTransform. microsoft. gradient (gradienttype = 0, startColorStr = blue, endColorStr = white);" 5. border: none; different from border: 0
Theoretical performance differences:
Front-end framework sharingBorder: 0. Although border is set to "0" pixels, it cannot be seen on the page, but it is understood by the default value of border. The browser still renders border-width/border-color, that is, the memory occupied. Border: none; set border to "none", that is, none. When the browser parses "none", no rendering action is performed, that is, no memory value is consumed.
Compatibility differences:
Compatibility differences only apply to browsers such as Internet Explorer 6 and Internet Explorer 7, as well as tag buttons and inputs. This is true for Windows, Windows 7, and vista XP.
When border is "none", it seems that the border for IE6/7 is still invalid. When border is "0", it feels more effective than "none, all browsers hide borders in a consistent manner. How can we make border: none; fully compatible? You only need to add the background attribute on the same selector.
6. css achieves high-profile layout with multiple columns, positive and negative marginsApply a high-level column style to each column to be implemented:
. Code
- . E {padding-bottom: 32767px; margin-bottom:-32767px ;}
7. display: inline-block. As the name suggests, it is a block in the case of inline. You can set the height and width. Front-end framework sharing. Code
- . Element-class {
- Display:-moz-inline-stack; // Firefox only code
- Display: inline-block; // some standard browsers
- Zoom: 1; // IE only
- * Display: inline; // Only IE know this code (CSS Hack)
- } 8. Clear floating. Code
- . Clearfix: after {visibility: hidden; display: block; font-size: 0; content: ""; clear: both; height: 0 ;}
- . Clearfix {zoom: 1 ;}
9. Use the ellipsis to truncate text. Code
- Div {width: 200px; height: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap ;}