Inner text shadow with CSS

后端 未结 22 1377
情深已故
情深已故 2020-11-28 18:07

I am currently playing around with CSS3 and trying to achieve a text effect like this (the black blurry inner shadow):

22条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 18:37

    For normal-sized text on small-ish buttons

    I found the other ideas on this page to lose their efficacy when used on small buttons with small text lettering. This answer expands on RobertPitt's answer.

    Here is the minor tweak:

    text-shadow: 1px 1px transparent, -1px -1px black;
    

    $('button').click(function(){
      $('button').removeClass('btnActive');
      $(this).addClass('btnActive');
    });
    body{background:#666;}
    .btnActive{
      border: 1px solid #aaa;
      border-top: 1px solid #333;
      border-left: 1px solid #333;
      color: #ecf0f8;
      background-color: #293d70;
      background-image: none;
      text-shadow: 1px 1px transparent, -1px -1px black;
      outline:none;
    }
    
    button{
      border: 1px solid #446;
      border-radius: 3px;
      color: white;
      background-color: #385499;
      background-image: linear-gradient(-180deg,##7d94cf,#1c294a 90%);
      cursor: pointer;
      font-size: 14px;
      font-weight: 600;
      padding: 6px 12px;
      xxtext-shadow: 1px 1px 2px navy;
    }
    
    
    

    Note:

    I used this site to finesse the color shades.

提交回复
热议问题