`

javascript和css实现垂直方向自适应的三角提示菜单

阅读更多

这是一个比较简单实用的菜单,最重要的是他不需要引用jQuery库。菜单在垂直方向上能做到自适应,当主菜单靠近顶部,子菜单将会在下面,当主菜单靠近底部,子菜单在上面。运用Modernizr的触摸检测功能,我们可以让子菜单的响应在pc上是hover,而在触摸设备上是点击。例子中还示范了如何在宽度比较窄的情况下如何调整布局。分享一个最好用的UI前端框架!

html代码:

.代码 
  1. <ul id="cbp-tm-menu" class="cbp-tm-menu">  
  2.     <li>  
  3.         <a href="#">Home</a>  
  4.     </li>  
  5.     <li>  
  6.         <a href="#">Veggie made</a>  
  7.         <ul class="cbp-tm-submenu">  
  8.             <li><a href="#" class="cbp-tm-icon-archive">Sorrel desert</a></li>  
  9.             <li><a href="#" class="cbp-tm-icon-cog">Raisin kakadu</a></li>  
  10.             <li><a href="#" class="cbp-tm-icon-location">Plum salsify</a></li>  
  11.             <li><a href="#" class="cbp-tm-icon-users">Bok choy celtuce</a></li>  
  12.             <li><a href="#" class="cbp-tm-icon-earth">Onion endive</a></li>  
  13.             <li><a href="#" class="cbp-tm-icon-location">Bitterleaf</a></li>  
  14.             <li><a href="#" class="cbp-tm-icon-mobile">Sea lettuce</a></li>  
  15.         </ul>  
  16.     </li>  
  17.     <li>  
  18.         <a href="#">Pepper tatsoi</a>  
  19.         <ul class="cbp-tm-submenu">  
  20.             <li><a href="#" class="cbp-tm-icon-archive">Brussels sprout</a></li>  
  21.             <li><a href="#" class="cbp-tm-icon-cog">Kakadu lemon</a></li>  
  22.             <li><a href="#" class="cbp-tm-icon-link">Juice green</a></li>  
  23.             <li><a href="#" class="cbp-tm-icon-users">Wine fruit</a></li>  
  24.             <li><a href="#" class="cbp-tm-icon-earth">Garlic mint</a></li>  
  25.             <li><a href="#" class="cbp-tm-icon-location">Zucchini garnish</a></li>  
  26.             <li><a href="#" class="cbp-tm-icon-mobile">Sea lettuce</a></li>  
  27.         </ul>  
  28.     </li>  
  29.     <li>  
  30.         <a href="#">Sweet melon</a>  
  31.         <ul class="cbp-tm-submenu">  
  32.             <li><a href="#" class="cbp-tm-icon-screen">Sorrel desert</a></li>  
  33.             <li><a href="#" class="cbp-tm-icon-mail">Raisin kakadu</a></li>  
  34.             <li><a href="#" class="cbp-tm-icon-contract">Plum salsify</a></li>  
  35.             <li><a href="#" class="cbp-tm-icon-pencil">Bok choy celtuce</a></li>  
  36.             <li><a href="#" class="cbp-tm-icon-article">Onion endive</a></li>  
  37.             <li><a href="#" class="cbp-tm-icon-clock">Bitterleaf</a></li>  
  38.         </ul>  
  39.     </li>  
  40. <a style="font-family: Arial; white-space: normal; background-color: #ffffff;" target="_blank" href="/topic/1132907">前端UI分享</a>  
  41.   
  42. </ul>  

 

css代码分享一个最好用的UI前端框架!

.代码 
  1. /* Iconfont made with icomoon.com */  
  2. @font-face {  
  3.     font-family: 'cbp-tmicons';  
  4.     src:url('../fonts/tmicons/cbp-tmicons.eot');  
  5.     src:url('../fonts/tmicons/cbp-tmicons.eot?#iefix') format('embedded-opentype'),  
  6.         url('../fonts/tmicons/cbp-tmicons.woff') format('woff'),  
  7.         url('../fonts/tmicons/cbp-tmicons.ttf') format('truetype'),  
  8.         url('../fonts/tmicons/cbp-tmicons.svg#cbp-tmicons') format('svg');  
  9.     font-weight: normal;  
  10.     font-style: normal;  
  11. }  
  12.                                                                                                                                                                                   
  13. /* reset  list style */  
  14. .cbp-tm-menu,  
  15. .cbp-tm-menu ul {  
  16.     list-style: none;  
  17. }  
  18.                                                                                                                                                                                   
  19. /* set menu position; change here to set to relative or float, etc. */  
  20. .cbp-tm-menu {  
  21.     display: block;  
  22.     position: absolute;  
  23.     z-index: 1000;  
  24.     bottom: 0;  
  25.     width: 100%;  
  26.     background: #47a3da;  
  27.     text-align: right;  
  28.     padding: 0 2em;  
  29.     margin: 0;  
  30.     text-transform: capitalize;  
  31. }  
  32.                                                                                                                                                                                   
  33. /* first level menu items */  
  34. .cbp-tm-menu > li {  
  35.     display: inline-block;  
  36.     margin: 0 2.6em;  
  37.     position: relative;  
  38. }  
  39.                                                                                                                                                                                   
  40. .cbp-tm-menu > li > a {  
  41.     line-height: 4em;  
  42.     padding: 0 0.3em;  
  43.     font-size: 1.2em;  
  44.     display: block;  
  45.     color: #fff;  
  46. }  
  47.                                                                                                     <a style="font-family: Arial;" target="_blank" href="/topic/1132907">前端UI分享</a>  
.代码 
  1. .no-touch .cbp-tm-menu > li > a:hover,  
  2. .no-touch .cbp-tm-menu > li > a:active {  
  3.     color: #02639d;  
  4. }  
  5.                                                                                                                                                                                   
  6. /* sumbenu with transitions */  
  7. .cbp-tm-submenu {  
  8.     position: absolute;  
  9.     display: block;  
  10.     visibility: hidden;  
  11.     opacity: 0;  
  12.     padding: 0;  
  13.     text-align: left;  
  14.     pointer-events: none;  
  15.     -webkit-transition: visibility 0s, opacity 0s;  
  16.     -moz-transition: visibility 0s, opacity 0s;  
  17.     transition: visibility 0s, opacity 0s;  
  18. }  
  19.                                                                                                                                                                                   
  20. .cbp-tm-show .cbp-tm-submenu {  
  21.     width: 16em;  
  22.     left: 50%;  
  23.     margin: 0 0 0 -8em;  
  24.     opacity: 1;  
  25.     visibility: visible;  
  26.     pointer-events: auto;  
  27.     -webkit-transition: visibility 0s, opacity 0.3s;  
  28.     -moz-transition: visibility 0s, opacity 0.3s;  
  29.     transition: visibility 0s, opacity 0.3s;  
  30. }  
  31.                                                                                                                                                                                   
  32. .cbp-tm-show-above .cbp-tm-submenu {  
  33.     bottom: 100%;  
  34.     padding-bottom: 10px;  
  35. }  
  36.                                                                                                                                                                                   
  37. .cbp-tm-show-below .cbp-tm-submenu {  
  38.     top: 100%;  
  39.     padding-top: 10px;  
  40. }  
  41.                                                                                                                                                                                   
  42. /* extreme cases: not enough space on the sides */  
  43. .cbp-tm-nospace-right .cbp-tm-submenu {  
  44.     right: 0;  
  45.     left: auto;  
  46. }  
  47.                                                                                                                                                                                   
  48. .cbp-tm-nospace-left .cbp-tm-submenu {  
  49.     left: 0;  
  50. }  
  51.                                                                                                           <a style="font-family: Arial;" target="_blank" href="/topic/1132907">前端UI分享</a>  
.代码 
  1. /* last menu item has to fit on the screen */  
  2. .cbp-tm-menu > li:last-child .cbp-tm-submenu {  
  3.     right: 0;  
  4. }  
  5.                                                                                                                                                                                   
  6. /*  
  7. arrow: depending on where the menu will be shown, we set  
  8. the right position for the arrow  
  9. */  
  10.                                                                                                                                                                                   
  11. .cbp-tm-submenu:after {  
  12.     border: solid transparent;  
  13.     content: " ";  
  14.     height: 0;  
  15.     width: 0;  
  16.     position: absolute;  
  17.     pointer-events: none;  
  18. }  
  19.                                                                                                                                                                                   
  20. .cbp-tm-show-above .cbp-tm-submenu:after {  
  21.     top: 100%;  
  22.     margin-top: -10px;  
  23. }  
  24.                                                                                                                                                                                   
  25. .cbp-tm-show-below .cbp-tm-submenu:after {  
  26.     bottom: 100%;  
  27.     margin-bottom: -10px;  
  28. }  
  29.                                                                                                                                                                                   
  30. .cbp-tm-submenu:after {  
  31.     border-color: transparent;  
  32.     border-width: 16px;  
  33.     margin-left: -16px;  
  34.     left: 50%;  
  35. }  
  36.                                                                                                                                                                                   
  37. .cbp-tm-show-above .cbp-tm-submenu:after {  
  38.     border-top-color: #fff;  
  39. }  
  40.                                                                                                                                                                                   
  41. .cbp-tm-show-below .cbp-tm-submenu:after {  
  42.     border-bottom-color: #fff;  
  43. }  
  44.                                                                                                                                                                                   
  45. .cbp-tm-submenu > li {  
  46.     display: block;  
  47.     background: #fff;  
  48. }  
  49.                                                                                                                                                                                   
  50. .cbp-tm-submenu > li > a {  
  51.     padding: 5px 2.3em 5px 0.6em; /* top/bottom paddings in 'em' cause a tiny "jump" in Chrome on Win */  
  52.     display: block;  
  53.     font-size: 1.2em;  
  54.     position: relative;  
  55.     color: #47a3da;  
  56.     border: 4px solid #fff;  
  57.     -webkit-transition: all 0.2s;  
  58.     -moz-transition: all 0.2s;  
  59.     transition: all 0.2s;  
  60. }  
  61.                                                                                                                                                                                   
  62. .no-touch .cbp-tm-submenu > li > a:hover,  
  63. .no-touch .cbp-tm-submenu > li > a:active {  
  64.     color: #fff;  
  65.     background: #47a3da;  
  66. }  
  67.                                                                                                                                                                                   
  68. /* the icons (main level menu icon and sublevel icons) */  
  69. .cbp-tm-submenu li a:before,  
  70. .cbp-tm-menu > li > a:before {  
  71.     font-family: 'cbp-tmicons';  
  72.     speak: none;  
  73.     font-style: normal;  
  74.     font-weight: normal;  
  75.     font-variant: normal;  
  76.     text-transform: none;  
  77.     line-height: 1;  
  78.     vertical-align: middle;  
  79.     margin-right: 0.6em;  
  80.     -webkit-font-smoothing: antialiased;  
  81. }  
  82.                                                                                                               <a style="font-family: Arial;" target="_blank" href="/topic/1132907">前端UI分享</a>  
.代码 
  1. .cbp-tm-submenu li a:before {  
  2.     position: absolute;  
  3.     top: 50%;  
  4.     margin-top: -0.5em;  
  5.     right: 0.5em;  
  6. }  
  7.                                                                                                                                                                                   
  8. .cbp-tm-menu > li > a:not(:only-child):before {  
  9.     content: "\f0c9";  
  10.     font-size: 60%;  
  11.     opacity: 0.3;  
  12. }  
  13.                                                                                                                                                                                   
  14. .cbp-tm-icon-archive:before {  
  15.     content: "\e002";  
  16. }  
  17.                                                                                                                                                                                   
  18. .cbp-tm-icon-cog:before {  
  19.     content: "\e003";  
  20. }  
  21.                                                                                                                                                                                   
  22. .cbp-tm-icon-users:before {  
  23.     content: "\e004";  
  24. }  
  25.                                                                                                                                                                                   
  26. .cbp-tm-icon-earth:before {  
  27.     content: "\e005";  
  28. }  
  29.                                                                                                                                                                                   
  30. .cbp-tm-icon-location:before {  
  31.     content: "\e006";  
  32. }  
  33.                                                                                                                                                                                   
  34. .cbp-tm-icon-mobile:before {  
  35.     content: "\e007";  
  36. }  
  37.                                                                                                                                                                                   
  38. .cbp-tm-icon-screen:before {  
  39.     content: "\e008";  
  40. }  
  41.                                                                                                                                                                                   
  42. .cbp-tm-icon-mail:before {  
  43.     content: "\e009";  
  44. }  
  45.                                                                                                                                                                                   
  46. .cbp-tm-icon-contract:before {  
  47.     content: "\e00a";  
  48. }  
  49.                                                                                                                                                                                   
  50. .cbp-tm-icon-pencil:before {  
  51.     content: "\e00b";  
  52. }  
  53.                                                                                                                                                                                   
  54. .cbp-tm-icon-article:before {  
  55.     content: "\e00c";  
  56. }  
  57.                                                                                                                                                                                   
  58. .cbp-tm-icon-clock:before {  
  59.     content: "\e00d";  
  60. }  
  61.                                                                                                                                                                                   
  62. .cbp-tm-icon-videos:before {  
  63.     content: "\e00e";  
  64. }  
  65.                                                                                                                                                                                   
  66. .cbp-tm-icon-pictures:before {  
  67.     content: "\e00f";  
  68. }  
  69.                                                                                                                                                                                   
  70. .cbp-tm-icon-link:before {  
  71.     content: "\e010";  
  72. }  
  73.                                                                                                                                                                                   
  74. .cbp-tm-icon-refresh:before {  
  75.     content: "\e011";  
  76. }  
  77.                                                                                                                                                                                   
  78. .cbp-tm-icon-help:before {  
  79.     content: "\e012";  
  80. }  
  81.                                                                                                                                                                                   
  82. /* Media Queries */  
  83. @media screen and (max-width: 55.6875em) {  
  84.     .cbp-tm-menu {  
  85.         font-size: 80%;  
  86.     }  
  87. }  
  88.                                                                                                               <a style="font-family: Arial;" target="_blank" href="/topic/1132907">前端UI分享</a>  
.代码 
  1. @media screen and (max-height: 25.25em), screen and (max-width: 44.3125em) {  
  2.                                                                                                                                                                                   
  3.     .cbp-tm-menu {  
  4.         font-size: 100%;  
  5.         position: relative;  
  6.         text-align: center;  
  7.         padding: 0;  
  8.         top: auto;  
  9.     }  
  10.                                                                                                                                                                                   
  11.     .cbp-tm-menu > li {  
  12.         display: block;  
  13.         margin: 0;  
  14.         border-bottom: 4px solid #3793ca;  
  15.     }  
  16.                                                                                                                                                                                   
  17.     .cbp-tm-menu > li:first-child {  
  18.         border-top: 4px solid #3793ca;  
  19.     }  
  20.                                                                                                                                                                                   
  21.     li.cbp-tm-show > a,  
  22.     .no-touch .cbp-tm-menu > li > a:hover,  
  23.     .no-touch .cbp-tm-menu > li > a:active {  
  24.         color: #fff;  
  25.         background: #02639d;  
  26.     }  
  27.                                                                                                                                                                                   
  28.     .cbp-tm-submenu {  
  29.         position: relative;  
  30.         display: none;  
  31.         width: 100%;  
  32.     }  
  33.                                                                                                                                                                                   
  34.     .cbp-tm-submenu > li {  
  35.         padding: 0;  
  36.     }  
  37.                                                                                                                                                                                   
  38.     .cbp-tm-submenu > li > a {  
  39.         padding: 0.6em 2.3em 0.6em 0.6em;  
  40.         border: none;  
  41.         border-bottom: 2px solid #6fbbe9;  
  42.     }  
  43.                                                                                                                                                                                   
  44.     .cbp-tm-submenu:after {  
  45.         display: none;  
  46.     }  
  47.                                                                                                                                                                                   
  48.     .cbp-tm-menu .cbp-tm-show .cbp-tm-submenu {  
  49.         display: block;  
  50.         width: 100%;  
  51.         left: 0;  
  52.         margin: 0;  
  53.         padding: 0;  
  54.         bottom: auto;  
  55.         top: auto;  
  56.     }  
  57.                                                                                                                                                                                       
  58. }  

 

javascript代码

.代码 
  1. /**  
  2.  * cbpTooltipMenu.js v1.0.0  
  3.  * http://www.codrops.com  
  4.  *  
  5.  * Licensed under the MIT license.  
  6.  * http://www.opensource.org/licenses/mit-license.php  
  7.  *  
  8.  * Copyright 2013, Codrops  
  9.  * http://www.codrops.com  
  10.  */  
  11. ;( function( window ) {  
  12.                                                                                                                                                                                 
  13.     'use strict';  
  14.                                                                                                                                                                             
  15.     var document = window.document,  
  16.         docElem = document.documentElement;  
  17.                                                                                                                                                                             
  18.     function extend( a, b ) {  
  19.         for( var key in b ) {  
  20.             if( b.hasOwnProperty( key ) ) {  
  21.                 a[key] = b[key];  
  22.             }  
  23.         }  
  24.         return a;  
  25.     }  
  26.                                                                                                                                                                             
  27.     // from https://github.com/ryanve/response.js/blob/master/response.js  
  28.     function getViewportH() {  
  29.         var client = docElem['clientHeight'],  
  30.             inner = window['innerHeight'];  
  31.         if( client < inner )  
  32.             return inner;  
  33.         else  
  34.             return client;  
  35.     }  
  36.                                                                                                                                                                             
  37.     // http://stackoverflow.com/a/11396681/989439  
  38.     function getOffset( el ) {  
  39.         return el.getBoundingClientRect();  
  40.     }  
  41.                                                                                                                                                                             
  42.     // http://snipplr.com/view.php?codeview&id=5259  
  43.     function isMouseLeaveOrEnter(e, handler) {  
  44.         if (e.type != 'mouseout' && e.type != 'mouseover') return false;  
  45.         var reltg = e.relatedTarget ? e.relatedTarget :  
  46.         e.type == 'mouseout' ? e.toElement : e.fromElement;  
  47.         while (reltg && reltg != handler) reltg = reltg.parentNode;  
  48.         return (reltg != handler);  
  49.     }  
  50.                                                                                                                                                                             
  51.     function cbpTooltipMenu( el, options ) {  
  52.         this.el = el;  
  53.         this.options = extend( this.defaults, options );  
  54.         this._init();  
  55.     }  
  56.                                                                                                                <a target="_blank" href="/topic/1132907">前端UI分享</a>  
.代码 
  1. cbpTooltipMenu.prototype = {  
  2.     defaults : {  
  3.         // add a timeout to avoid the menu to open instantly  
  4.         delayMenu : 100  
  5.     },  
  6.     _init : function() {  
  7.         this.touch = Modernizr.touch;  
  8.         this.menuItems = document.querySelectorAll( '#' + this.el.id + ' > li' );  
  9.         this._initEvents();  
  10.     },  
  11.     _initEvents : function() {  
  12.                                                                                                                                                                                     
  13.         var self = this;  
  14.                                                                                                                                                                         
  15.         Array.prototype.slice.call( this.menuItems ).forEach( function( el, i ) {  
  16.             var trigger = el.querySelector( 'a' );  
  17.             if( self.touch ) {  
  18.                 trigger.addEventListener( 'click', function( ev ) { self._handleClick( this, ev ); } );  
  19.             }  
  20.             else {  
  21.                 trigger.addEventListener( 'click', function( ev ) {  
  22.                     if( this.parentNode.querySelector( 'ul.cbp-tm-submenu' ) ) {  
  23.                         ev.preventDefault();  
  24.                     }  
  25.                 } );  
  26.                 el.addEventListener( 'mouseover', function(ev) { if( isMouseLeaveOrEnter( ev, this ) ) self._openMenu( this ); } );  
  27.                 el.addEventListener( 'mouseout', function(ev) { if( isMouseLeaveOrEnter( ev, this ) ) self._closeMenu( this ); } );  
  28.             }  
  29.         } );  
  30.                                                                                                                                                                         
  31.     },  
  32.     _openMenu : function( el ) {  
  33.                                                                                                                                                                         
  34.         var self = this;  
  35.         clearTimeout( this.omtimeout );  
  36.         this.omtimeout = setTimeout( function() {  
  37.             var submenu = el.querySelector( 'ul.cbp-tm-submenu' );  
  38.                                                                                                                                                                         
  39.             if( submenu ) {  
  40.                 el.className = 'cbp-tm-show';  
  41.                 if( self._positionMenu( el ) === 'top' ) {  
  42.                     el.className += ' cbp-tm-show-above';  
  43.                 }  
  44.                 else {  
  45.                     el.className += ' cbp-tm-show-below';  
  46.                 }  
  47.             }  
  48.         }, this.touch ? 0 : this.options.delayMenu );  
  49.                                                                                                                                                                         
  50.     },  
  51.     _closeMenu : function( el ) {  
  52.                                                                                                                                                                                     
  53.         clearTimeout( this.omtimeout );  
  54.                                                                                                                                                                         
  55.         var submenu = el.querySelector( 'ul.cbp-tm-submenu' );  
  56.                                                                                                                                                                         
  57.         if( submenu ) {  
  58.             // based on https://github.com/desandro/classie/blob/master/classie.js  
  59.             el.className = el.className.replace(new RegExp("(^|\\s+)" + "cbp-tm-show" + "(\\s+|$)"), ' ');  
  60.             el.className = el.className.replace(new RegExp("(^|\\s+)" + "cbp-tm-show-below" + "(\\s+|$)"), ' ');  
  61.             el.className = el.className.replace(new RegExp("(^|\\s+)" + "cbp-tm-show-above" + "(\\s+|$)"), ' ');  
  62.         }  
  63.                                                                                                                                                                         
  64.     },  
  65.     _handleClick : function( el, ev ) {  
  66.         var item = el.parentNode,  
  67.             items = Array.prototype.slice.call( this.menuItems ),  
  68.             submenu = item.querySelector( 'ul.cbp-tm-submenu' )  
  69.                                                                                                                                                                         
  70.         // first close any opened one..  
  71.         if( this.current &&  items.indexOf( item ) !== this.current ) {  
  72.             this._closeMenu( this.el.children[ this.current ] );  
  73.             this.el.children[ this.current ].querySelector( 'ul.cbp-tm-submenu' ).setAttribute( 'data-open''false' );  
  74.         }  
  75.                                                                                                                                                                         
  76.         if( submenu ) {  
  77.             ev.preventDefault();  
  78.                                                                                                                                                                         
  79.             var isOpen = submenu.getAttribute( 'data-open' );  
  80.                                                                                                                                                                         
  81.             if( isOpen === 'true' ) {  
  82.                 this._closeMenu( item );  
  83.                 submenu.setAttribute( 'data-open''false' );  
  84.             }  
  85.             else {  
  86.                 this._openMenu( item );  
  87.                 this.current = items.indexOf( item );  
  88.                 submenu.setAttribute( 'data-open''true' );  
  89.             }  
  90.         }  
  91.                                                                                                                                                                         
  92.     },  
  93. arget="_blank" href="/topic/1132907">前端UI分享</a>  
  94.   
  95.     _positionMenu : function( el ) {  
  96.         // checking where's more space left in the viewport: above or below the element  
  97.         var vH = getViewportH(),  
  98.             ot = getOffset(el),  
  99.             spaceUp = ot.top ,  
  100.             spaceDown = vH - spaceUp - el.offsetHeight;  
  101.                                                                                                                                                                                     
  102.         return ( spaceDown <= spaceUp ? 'top' : 'bottom' );  
  103.     }  
  104. }  
  105.                                                                                                                                                                         
  106. // add to global namespace  
  107. window.cbpTooltipMenu = cbpTooltipMenu;  
  108.                                                                                                                                                                         
  109.  window );  
0
1
分享到:
评论

相关推荐

    js css实现垂直方向自适应的三角提示菜单

    以上这些知识点共同构成了实现垂直方向自适应三角提示菜单的核心要素,涵盖了从HTML结构到CSS样式再到JavaScript逻辑的完整实现路径。通过这些知识点的掌握,开发者可以灵活地创建出既美观又实用的菜单效果。

    【对话气泡】 css3 自适应 带角 带边框 可设背景

    本教程将详细介绍如何使用CSS3来创建一个自适应的、带有角度和边框的对话气泡,同时支持自定义背景色,实现更高效、更灵活的设计。 首先,我们需要创建HTML结构,为对话气泡提供基本的容器。一个简单的示例是: ``...

    个性css3三角形设计师案例bootstrap模板__H5模板_自适应响应式源码.rar

    在这个模板中,CSS3被用来创建复杂的三角形形状,通过控制边框宽度和颜色实现,还可能用于实现页面元素的平滑过渡和动画效果。 2. **三角形设计**:在CSS3中,通过设置元素的边框宽度和颜色,可以巧妙地创建出不同...

    css3实现六边形列表

    在CSS3的世界里,设计独特的形状不再依赖于复杂的图片或者JavaScript插件,而是可以通过纯CSS实现。本主题探讨的是如何利用CSS3技术创建一个自适应的六边形列表。六边形列表是一种创新的设计方式,它能为网页增添...

    296国外_HTML手机电脑网站_网页源码_移动端前端js效果_H5模板_自适应css样式ui组件.zip

    综合来看,这个压缩包包含的内容是网页开发的黄金三角——HTML、CSS和JavaScript的实战应用,还有H5模板和自适应的UI组件,为开发者提供了丰富的学习材料和实际项目的起点。无论是初学者还是经验丰富的开发者,都...

    NO JS css3 Tab页签切换效果选项卡切换源码下载

    【标题解析】 “NO JS css3 Tab页签切换效果选项卡...总的来说,这个资源提供了一种完全使用CSS3实现的选项卡切换效果,对于希望学习CSS3动态效果或者避免使用JavaScript的开发者来说,是一个很好的学习和实践素材。

    CSS 特效、实例(望有用)

    3. 图片轮播(Carousel):通过CSS和JavaScript实现图片自动切换的组件。 4. 悬停效果(Hover Effects):如按钮、链接的悬停变色、放大等效果。 5. 响应式设计(Responsive Design):根据屏幕尺寸调整布局和元素...

    个性css3三角形设计师案例bootstrap模板-css3动画 设计 设计师 案例 展示 企业 整站 html5 手机 响应式

    Bootstrap是一个流行的开源前端框架,它包含了一系列预设的CSS样式、JavaScript插件和HTML组件,极大地简化了响应式网页开发的过程。在这款模板中,Bootstrap被用来构建一个整站的响应式布局,这意味着无论用户是在...

    最全前端面试题-2(css篇-上百篇题集整理1个月)

    【CSS 居中】:CSS提供了多种居中方法,包括水平居中和垂直居中。水平居中对行内元素可以使用`text-align: center`,对块级元素可以使用`margin: 0 auto`或`position: absolute`结合`left: 50%`和`transform: ...

    最新版面试宝典(1).pdf

    - 用div+css实现固定宽度与自适应宽度布局的方法。 - display: inline-block时间隙产生的原因及处理方式。 - overflow属性的不同值的作用。 - 通过CSS去掉移动端默认样式的方法。 - CSS样式初始化的目的和好处...

    前端面试宝典系列(css+js+vue+网络)

    1. **居中布局**:多种方法实现元素的水平和垂直居中,如margin auto、text-align center、display: table-cell、绝对定位配合transform、BFC等。 2. **BFC(Block Formatting Context)**:BFC可以防止内部浮动...

    多边形导航

    在IT行业中,多边形导航是一种常见的网页设计技术,它通过使用HTML、CSS以及可能的JavaScript来创建具有吸引力和互动性的导航菜单。这种导航通常利用几何形状,特别是多边形,来增强用户界面的视觉效果,使网站看...

    CSS3实现六边形网格布局样式特效代码

    六边形网格布局的实现通常涉及JavaScript,以动态调整每个六边形的大小和位置,以适应不同的屏幕尺寸和设备。例如,使用媒体查询(`media queries`)来响应式布局,确保在各种设备上都有良好的显示效果。 此外,`...

    css高频笔试题目精讲

    ### CSS高频笔试题精讲知识点解析 ...以上是对CSS高频笔试题目的精讲,包含了常见的单位、居中技巧、响应式布局、0.5px线实现、Sass基础知识、弹性布局以及BFC的相关知识,希望能帮助大家更好地理解和掌握CSS。

    VUE.JS自适应蛇形曲线数据代码

    通过查看这些文件,我们可以看到具体的实现细节,如如何定义Vue组件,如何编写CSS来实现自适应布局,以及如何在JavaScript中处理和绘制数据。 总的来说,"VUE.JS自适应蛇形曲线数据代码"项目涵盖了Vue.js组件化开发...

    JS实现的非常漂亮的3D立体照片墙显示效果代码.zip

    总之,这个项目展示了如何综合运用JavaScript、HTML5和CSS3实现一个引人入胜的3D立体照片墙,同时涵盖了前端开发的多个重要方面,包括动态效果、布局、响应式设计以及性能优化等。通过学习和理解这个项目,开发者...

    Jquery实现纵向横向菜单

    总结起来,实现纵向横向菜单的关键在于理解jQuery的选择器、事件和动画方法,以及结合CSS来控制布局和样式。通过这样的组合,我们可以创建出富有动态效果、用户体验良好的交互式菜单。在实际项目中,可以根据需求...

    前端面试题前端面试题.pdf

    5. CSS中的居中方法包括了水平居中和垂直居中,使用的技术如margin: 0 auto、Flexbox布局等。 6. CSS选择器的优先级是由其特殊性决定的,特殊性由选择器的类型和数量决定。 7. 清除浮动的目的是为了防止浮动元素...

    HTML5 Canvas彩色粒子飘动特效.zip

    此外,还可以用到三角函数(如sine和cosine)来实现更复杂的运动轨迹。 8. 性能优化: 对于大量的粒子,性能优化至关重要。开发者可能采用批量绘制粒子,减少不必要的重绘,或者使用对象池技术来复用粒子,避免...

    前端面试知识点总结——可自行免费下载

    13. **用CSS画三角形**:通过调整边框颜色和透明度实现,通常用于制作箭头。 14. **字体奇偶数选择**:通常使用偶数字体大小,便于布局对齐和像素转换,提升视觉效果。 15. **CSS Reset**:重置浏览器默认样式,如...

Global site tag (gtag.js) - Google Analytics