Google's Imageless Buttons

后端 未结 11 2034
遥遥无期
遥遥无期 2020-12-02 03:19

There have been a few articles recently about Google\'s new imageless buttons:

  • http://stopdesign.com/archive/2009/02/04/recreating-the-button.html
  • htt
相关标签:
11条回答
  • 2020-12-02 03:56

    These were released as part of the closure library: see the button demo

    0 讨论(0)
  • 2020-12-02 03:57

    -- EDIT -- I didn't see the link in the original post. Sorry! Will try and re-write to reflect actual question

    StopDesign has an excellent post on this here. [edit 20091107] These were released as part of the closure library: see the button demo.

    Basically the custom buttons he shows are created using a simple bit of CSS.

    He originally used 9 tables to get the effect: 9 Tables

    But later he used a simple 1px left and right margin on the top and bottom borders to achieve the same effect.

    The gradient is faked by using three layers: Button Gradient

    All of the code can be found at the Custom Buttons 3.1 page. (although the gradient without the image is only working in Firefox and Safari)

    Step by Step Instructions

    1 - Insert the following CSS:

    /* Start custom button CSS here
    ---------------------------------------- */
    .btn {
      display:inline-block;
      background:none;
      margin:0;
      padding:3px 0;
      border-width:0;
      overflow:visible;
      font:100%/1.2 Arial,Sans-serif;
      text-decoration:none;
      color:#333;
      }
    * html button.btn {
      padding-bottom:1px;
      }
    /* Immediately below is a temporary hack to serve the 
       following margin values only to Gecko browsers
       Gecko browsers add an extra 3px of left/right 
       padding to button elements which can't be overriden.
       Thus, we use -3px of left/right margin to overcome this. */
    html:not([lang*=""]) button.btn {
      margin:0 -3px;
      }
    .btn span {
      background:#f9f9f9;
      z-index:1;
      margin:0;
      padding:3px 0;
      border-left:1px solid #ccc;
      border-right:1px solid #bbb;
      }
    * html .btn span {
      padding-top:0;
      }
    .btn span span {
      background:none;
      position:relative;
      padding:3px .4em;
      border-width:0;
      border-top:1px solid #ccc;
      border-bottom:1px solid #bbb;
      }
    .btn b {
      background:#e3e3e3;
      position:absolute;
      z-index:2;
      bottom:0;
      left:0;
      width:100%;
      overflow:hidden;
      height:40%;
      border-top:3px solid #eee;
      }
    * html .btn b {
      top:1px;
      }
    .btn u {
      text-decoration:none;
      position:relative;
      z-index:3;
      }
    
    /* pill classes only needed if using pill style buttons ( LEFT | CENTER | RIGHT ) */
    button.pill-l span {
      border-right-width:0;
      }
    button.pill-l span span {
      border-right:1px solid #ccc;
      }
    button.pill-c span {
      border-right-style:none;
      border-left-color:#fff;
      }
    button.pill-c span span {
      border-right:1px solid #ccc;
      }
    button.pill-r span {
      border-left-color:#fff;
      }
    
    /* only needed if implementing separate hover state for buttons */
    .btn:hover span, .btn:hover span span {
      cursor:pointer;
      border-color:#9cf !important;
      color:#000;
      }
    
    /* use if one button should be the 'primary' button */
    .primary {
      font-weight:bold;
      color:#000;
      }
    

    2 - Use one of the following ways to call it (more can be found in the links above)

    <a href="#" class="btn"><span><span><b>&nbsp;</b><u>button</u></span></span></a>
    

    or

    <button type="button" class="btn"><span><span><b>&nbsp;</b><u>button</u></span></span></button>
    
    0 讨论(0)
  • 2020-12-02 03:57

    The Web Developer Toolbar has a view style information under the css menu that will tell you what css is applied to an item. There is also the Edit CSS feature in that menu that will let you change the CSS on the fly to see how it affects the page.

    0 讨论(0)
  • 2020-12-02 03:58

    You could use this jquery plugin I've developed. The buttons work pratically anywhere and since it's a plugin they're easy to set up and configure.

    http://swizec.com/code/styledButton/

    0 讨论(0)
  • 2020-12-02 04:01

    The post with a link to the closure library does not apply. What was released as part of the closure library uses buttons with gradients.

    The other solutions listed are useless. You cannot go from there and get these buttons working on every browser Gmail has them working. What Bowman shows on his site is not working code.

    0 讨论(0)
  • 2020-12-02 04:02

    Updating this post for 2011:

    Google launched a new design across its services in July 2011. The new Google buttons have been recreated here: http://pixify.com/blog/use-google-plus-to-improve-your-ui/

    The new buttons look like this: enter image description here

    0 讨论(0)
提交回复
热议问题