CSS - шрифт скрывается в кнопке при изменении размера окна браузера

0

CSS

   #category{
    width: 85%;
    height: 65%;
    //border: thin darkgray solid;
    margin: 0 auto;
    margin-top: 2%;
    bottom: 0;
}
    .interest_categories{

        width: 21%;
        height: 15%;
        border: thin darkgrey solid;
        margin-left:10px ;
        margin-top: 10px;
        float: left;
    }

    .interest_categories input{
        width: 100%;
        height: 100%;
        font-size: 1em;
        text-align: center;
        vertical-align: middle;
    }

HTML

<div id="category" style="width: 96%; margin-top: 5px; height: 75%; top: 0; border: thin red solid;">
            <div class="interest_categories">
                <input type="button" id="films" value="Films"  style="background: #ffc561; color: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="music" value="Music"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="dance" value="Dance"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="reading" value="Reading"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="design_art" value="Design & Art"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="photography" value="Photography"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="science" value="Science"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="it" value="IT"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="technology" value="Technology"  style="background: #ffc561; color: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="business" value="Business"  style="background: #ffc561; color: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="entrepreneurship" value="Entrepreneurship"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="sports" value="Sports"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="games" value="Games"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="psychology" value="Psychology"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button"  id="humor" value="Humor"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories">
                <input type="button" id="travel" value="Travel"  style="color: #a1a1a1; background: white;">
            </div>

            <div class="interest_categories">
                <input type="button" id="nature" value="Nature"  style="color: #a1a1a1; background: white;">
            </div>

            <div class="interest_categories">
                <input type="button" id="food_drink" value="Food & Drink"  style="color: #a1a1a1; background: white;">
            </div>

            <div class="interest_categories">
                <input type="button" id="fashion" value="Fashion"  style="color: #a1a1a1; background: white;">
            </div>

            <div class="interest_categories">
                <input type="button" id="history" value="History"  style="color: #a1a1a1; background: white;">
            </div>

        </div><!--Category-->

Вот он, я хочу, чтобы мой шрифт не скрывался даже при изменении размера моего окна. когда я изменяю размер окна браузера, шрифты скрываются, как показано на изображении. поэтому я хочу сделать это, когда меняю размер моего окна, тогда categories должны соответствовать должным образом.

Изображение 287949

  • 0
    Вы не можете сделать это .. текст не регулируется по размеру элемента . Вам понадобится JavaScript.
  • 0
    я могу использовать font-size-Adjust? но это только для firefox. или есть ли способ, которым я могу положить дополнительный текст в кнопку.?
Показать ещё 5 комментариев
Теги:
resize
responsive-design

1 ответ

0
Лучший ответ

На самом деле вы не использовали Bootstrap. Вы должны разделить каждую row в четырех подразделениях.

3 + 3 + 3 + 3
3 + 3 + 3 + 3
3 + 3 + 3 + 3
3 + 3 + 3 + 3
3 + 3 + 3 + 3

Вы ничего не зафиксировали в Bootstrap. Я отредактировал ваш код с помощью Bootstrap. Может быть, это не 100% вашего ответа, но я думаю, вы сможете переделать его своими знаниями.

<div class="container" id="category" style="top: 0; border: thin red solid;">
  <div class="row">
    <div class="row">
            <div class="interest_categories col-md-3">
                <input type="button" id="films" value="Films"  style="background: #ffc561; color: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="music" value="Music"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="dance" value="Dance"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="reading" value="Reading"  style="color: #a1a1a1; background: white;">
            </div>
    </div>


   <div class="row">
            <div class="interest_categories col-md-3">
                <input type="button" id="films" value="Films"  style="background: #ffc561; color: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="music" value="Music"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="dance" value="Dance"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="reading" value="Reading"  style="color: #a1a1a1; background: white;">
            </div>
</div>


<div class="row">
            <div class="interest_categories col-md-3">
                <input type="button" id="films" value="Films"  style="background: #ffc561; color: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="music" value="Music"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="dance" value="Dance"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="reading" value="Reading"  style="color: #a1a1a1; background: white;">
            </div>
</div>

<div class="row">
            <div class="interest_categories col-md-3">
                <input type="button" id="films" value="Films"  style="background: #ffc561; color: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="music" value="Music"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="dance" value="Dance"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="reading" value="Reading"  style="color: #a1a1a1; background: white;">
            </div>
</div>


<div class="row">
            <div class="interest_categories col-md-3">
                <input type="button" id="films" value="Films"  style="background: #ffc561; color: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="music" value="Music"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="dance" value="Dance"  style="color: #a1a1a1; background: white;">
            </div>
            <div class="interest_categories col-md-3">
                <input type="button" id="reading" value="Reading"  style="color: #a1a1a1; background: white;">
            </div>
</div>

     </div>        
</div>

CSS:

 #category{
    //border: thin darkgray solid;
    margin: 0 auto;
    margin-top: 2%;
    bottom: 0;
}
    .interest_categories{

        border: thin darkgrey solid;
        float: left;
    }

    .interest_categories input
    {
        text-align: center;
    }

Ещё вопросы

Сообщество Overcoder
Наверх
Меню