• All geek questions in one place

    My CSS will not display: inline; for my buttons

    Here is my HTML:

    <div class="container">
        <ul>
        <li><a href="http://www.kbb.com/scion/fr-s/2013/" class="button">YES</a></li>
        </ul>
    </div>
    <div class="2"> 
        <ul>
        <li><a href="http://tinyurl.com/nk4k25r" class="button">NO</a></li>
        </ul>
    </div>
    
    
    <div class="3">
        <ul>
        <li><a href="http://tinyurl.com/pnaj3j2"  class="button">YES</a></li>
    
    </div>
    <div class="4">
        <ul>
        <li><a href="http://tinyurl.com/qybshxz" class="button">NO</a></li>
        </ul>
    </div>
    </div>
    

    And here is my CSS:

    .button {
            display: block;
            height: 100px;
            width: 200px;
            background: #ffff00;
            border: 2px solid #00E5EE;
            color: #551A8B;
    
            text-align: center;
            font: bold 3.2em/100px Impact;
    
            background: -webkit-linear-gradient(top, #ffff00, #2f5f63);
            background: -moz-linear-gradient(top, #ffff00, #2f5f63);
            background: -o-linear-gradient(top, #ffff00, #2f5f63);
            background: -ms-linear-gradient(top, #ffff00, #2f5f63);
            background: linear-gradient(top, #ffff00, #2f5f63);
    
            -khtml-border-radius: 50px;
            -moz-border-radius: 50px;
            border-radius: 90px;
            margin: 0px 0px 15px 15px;
        div li {
            display: inline;
            float: center;
        }
    

    I work to ensure that my buttons are centered and embedded, but every time I try to use display: inline;my buttons get smaller and stay upright.

    +4
    html css
    Jin ag Dec 18 '15 at 15:00
    source share
    2 answers

    .buttonhas display:block;, so you can center with margin:0 auto;and the floatproperty does not matter center.

    .button {
      display: block;
      height: 100px;
      width: 200px;
      background: #ffff00;
      border: 2px solid #00E5EE;
      color: #551A8B;
      text-align: center;
      font: bold 3.2em/100px Impact;
      background: -webkit-linear-gradient(top, #ffff00, #2f5f63);
      background: -moz-linear-gradient(top, #ffff00, #2f5f63);
      background: -o-linear-gradient(top, #ffff00, #2f5f63);
      background: -ms-linear-gradient(top, #ffff00, #2f5f63);
      background: linear-gradient(top, #ffff00, #2f5f63);
      -khtml-border-radius: 50px;
      -moz-border-radius: 50px;
      border-radius: 90px;
      margin: 0px auto 15px;
    }
    div li {
      display: block;
    }
    body {
      text-align: center;
    }
    div {
      display: inline-block;
    }
    <div class="container">
      <ul>
        <li><a href="http://www.kbb.com/scion/fr-s/2013/" class="button">YES</a>
        </li>
      </ul>
    </div>
    <div class="2">
      <ul>
        <li><a href="http://tinyurl.com/nk4k25r" class="button">NO</a>
        </li>
      </ul>
    </div>
    
    
    <div class="3">
      <ul>
        <li><a href="http://tinyurl.com/pnaj3j2" class="button">YES</a>
        </li>
    
    </div>
    <div class="4">
      <ul>
        <li><a href="http://tinyurl.com/qybshxz" class="button">NO</a>
        </li>
      </ul>
    </div>
    </div>
    Run code
    +3
    Alex Dec 18 '15 at 15:12
    source share

    Change your css as

    .button {
      display: block;
      height: 100px;
      width: 200px;
      background: #ffff00;
      border: 2px solid #00E5EE;
      color: #551A8B;
      text-align: center;
      font: bold 3.2em/100px Impact;
      background: -webkit-linear-gradient(top, #ffff00, #2f5f63);
      background: -moz-linear-gradient(top, #ffff00, #2f5f63);
      background: -o-linear-gradient(top, #ffff00, #2f5f63);
      background: -ms-linear-gradient(top, #ffff00, #2f5f63);
      background: linear-gradient(top, #ffff00, #2f5f63);
      -khtml-border-radius: 50px;
      -moz-border-radius: 50px;
      border-radius: 90px;
      margin: 0px 0px 15px 15px;
    }
    
    li {
      list-style: none;
    }
    
    div {
      display: inline-block;
    }
    

    and html like

    <div class="container">
      <div>
        <ul>
          <li><a href="http://www.kbb.com/scion/fr-s/2013/" class="button">YES</a></li>
        </ul>
      </div>
      <div class="2">
        <ul>
          <li><a href="http://tinyurl.com/nk4k25r" class="button">NO</a></li>
        </ul>
      </div>
    
    
      <div class="3">
        <ul>
          <li><a href="http://tinyurl.com/pnaj3j2" class="button">YES</a></li>
        </ul>
    
      </div>
      <div class="4">
        <ul>
          <li><a href="http://tinyurl.com/qybshxz" class="button">NO</a></li>
        </ul>
      </div>
    </div>
    
    0
    noisybuddha Dec 18 '15 at 15:17
    source share

    Source: https://habr.com/ru/post/1620768/

    More articles:

    • How is the internal operation of a Rust link attribute comparable to a C binding? - c
    • Windows.Forms.RichTextBox Теряет цвета фона стола - c#
    • как разрешить специальные символы в маршруте laravel? - laravel
    • GIDSignIn requires a password - ios
    • SKAudioNode plays sound once - swift
    • Spend all messages using MassTransit - c #
    • win32 / stdlib detects only half the number of logical cores in C / C ++ under Windows - c ++
    • https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1620771/c-saving-images-to-mysql-database-as-blob&usg=ALkJrhjL3eV23wAyeJydHUo7tmym2NYhNA
    • Python - input contains NaN, infinity or too much value for dtype ('float64') - python
    • ListView takes up all the space in LinearLayout - android

    All Articles

    Geek Questions | 2019