Circle button css

后端 未结 9 770
忘了有多久
忘了有多久 2020-12-13 06:00

I\'m a beginner and very confused, as a div tag when I give the same width and height with border-radius: 50% it always becomes circle. but with the tag a in case I want to

相关标签:
9条回答
  • 2020-12-13 07:03

    An round button with box-shadow https://v2.vuetifyjs.com/en/components/floating-action-buttons/

    .btn {
      height: 50px;
      width: 50px;
      line-height: 50px;
      font-size: 2em;
      border-radius: 50%;
      background-color: red;
      color: white;
      text-align: center;
      border: none;
      cursor: pointer;
      position: fixed;
      z-index: 1;
      bottom: 10%;
      right: 4%;
      box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);
    }
    <div class="btn">+</div>

    0 讨论(0)
  • 2020-12-13 07:04

    For div tag there is already default property display:block given by browser. For anchor tag there is not display property given by browser. You need to add display property to it. That's why use display:block or display:inline-block. It will work.

    .btn {
      display:block;
      height: 300px;
      width: 300px;
      border-radius: 50%;
      border: 1px solid red;
      
    }
    <a class="btn" href="#"><i class="ion-ios-arrow-down"></i></a>

    0 讨论(0)
  • 2020-12-13 07:04

    .round-button {
      width:25%;
    }
    .round-button-circle {
      width: 100%;
      height:0;
      padding-bottom: 100%;
      border-radius: 50%;
      border:10px solid #cfdcec;
      overflow:hidden;
            
      background: #4679BD; 
      box-shadow: 0 0 3px gray;
    }
    .round-button-circle:hover {
      background:#30588e;
    }
    .round-button a {
      display:block;
      float:left;
      width:100%;
      padding-top:50%;
      padding-bottom:50%;
      line-height:1em;
      margin-top:-0.5em;
            
      text-align:center;
      color:#e2eaf3;
      font-family:Verdana;
      font-size:1.2em;
      font-weight:bold;
      text-decoration:none;
    }
    <div class="round-button"><div class="round-button-circle"><a href="http://example.com" class="round-button">Button!!</a></div></div>

    or very simple for <a/>

    .round-button {
        display:block;
        width:80px;
        height:80px;
        line-height:80px;
        border: 2px solid #f5f5f5;
        border-radius: 50%;
        color:#f5f5f5;
        text-align:center;
        text-decoration:none;
        background: #555777;
        box-shadow: 0 0 3px gray;
        font-size:20px;
        font-weight:bold;
    }
    .round-button:hover {
        background: #777555;
    }
    <a href="http://example.com" class="round-button">Button</a>

    for jsfiddle reference click here

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