2018-10-10 18:03:03 -04:00
---
id: bad87fee1348cd8acef08812
title: Create a Block Element Bootstrap Button
challengeType: 0
2019-08-28 16:26:13 +03:00
forumTopicId: 16810
2018-10-10 18:03:03 -04:00
localeTitle: Создание кнопки бутстрапа с блочным элементом
---
## Description
2019-08-28 16:26:13 +03:00
< section id = 'description' >
2019-12-20 16:24:36 +01:00
Обычно ваши элементы < code > button< / code > с классами < code > btn< / code > и < code > btn-default< / code > имеют ширину текста, который они содержат. Например: < code > < button class=" btn btn-default" > Submit< /button> < / code > . Ширина этой кнопки равна ширине слова «Submit». С помощью добавления дополнительного класса < code > btn-block< / code > можно заставить вашу кнопку растянуться на всю ширину вашей страницы, а все последующие за ней элементы будут перетекать в «новую строку» под блоком. < code > < button class=" btn btn-default btn-block" > Submit< /button> < / code > Эта кнопка займет 100% доступной ширины. < button class = "btn btn-default btn-block" > Submit< / button > Обратите внимание, что эти кнопки все еще нуждаются в < code > btn< / code > классе. Добавьте класс < code > btn-block< / code > Bootstrap в вашу кнопку.
2019-08-28 16:26:13 +03:00
< / section >
2018-10-10 18:03:03 -04:00
## Instructions
2019-08-28 16:26:13 +03:00
< section id = 'instructions' >
< / section >
2018-10-10 18:03:03 -04:00
## Tests
< section id = 'tests' >
```yml
tests:
2019-12-20 16:24:36 +01:00
- text: Ваша кнопка всё ещё должна иметь классы < code > btn</ code > и < code > btn-default</ code > .
2019-08-28 16:26:13 +03:00
testString: assert($("button").hasClass("btn") & & $("button").hasClass("btn-default"));
2019-12-20 16:24:36 +01:00
- text: Ваша кнопка должна иметь класс < code > btn-block</ code > .
2019-08-28 16:26:13 +03:00
testString: assert($("button").hasClass("btn-block"));
2019-12-20 16:24:36 +01:00
- text: Убедитесь, что все < code > button</ code > -элементы имеют закрывающий тег.
2019-08-28 16:26:13 +03:00
testString: assert(code.match(/< \/button > /g) && code.match(/< button / g ) && code . match (/< \/button > /g).length === code.match(/< button / g ). length );
2018-10-10 18:03:03 -04:00
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'html-seed' >
```html
< link href = "https://fonts.googleapis.com/css?family=Lobster" rel = "stylesheet" type = "text/css" >
< style >
.red-text {
color: red;
}
h2 {
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}
.smaller-image {
width: 100px;
}
< / style >
< div class = "container-fluid" >
< h2 class = "red-text text-center" > CatPhotoApp< / h2 >
< p > Click here for < a href = "#" > cat photos< / a > .< / p >
< a href = "#" > < img class = "smaller-image thick-green-border" src = "https://bit.ly/fcc-relaxing-cat" alt = "A cute orange cat lying on its back." > < / a >
< img src = "https://bit.ly/fcc-running-cats" class = "img-responsive" alt = "Three kittens running towards the camera." >
< button class = "btn btn-default" > Like< / button >
< p > Things cats love:< / p >
< ul >
< li > cat nip< / li >
< li > laser pointers< / li >
< li > lasagna< / li >
< / ul >
< p > Top 3 things cats hate:< / p >
< ol >
< li > flea treatment< / li >
< li > thunder< / li >
< li > other cats< / li >
< / ol >
< form action = "/submit-cat-photo" >
< label > < input type = "radio" name = "indoor-outdoor" > Indoor< / label >
< label > < input type = "radio" name = "indoor-outdoor" > Outdoor< / label >
< label > < input type = "checkbox" name = "personality" > Loving< / label >
< label > < input type = "checkbox" name = "personality" > Lazy< / label >
< label > < input type = "checkbox" name = "personality" > Crazy< / label >
< input type = "text" placeholder = "cat photo URL" required >
< button type = "submit" > Submit< / button >
< / form >
< / div >
```
< / div >
< / section >
## Solution
< section id = 'solution' >
2019-08-28 16:26:13 +03:00
```html
< link href = "https://fonts.googleapis.com/css?family=Lobster" rel = "stylesheet" type = "text/css" >
< style >
.red-text {
color: red;
}
h2 {
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}
.smaller-image {
width: 100px;
}
< / style >
< div class = "container-fluid" >
< h2 class = "red-text text-center" > CatPhotoApp< / h2 >
< p > Click here for < a href = "#" > cat photos< / a > .< / p >
< a href = "#" > < img class = "smaller-image thick-green-border" src = "https://bit.ly/fcc-relaxing-cat" alt = "A cute orange cat lying on its back." > < / a >
< img src = "https://bit.ly/fcc-running-cats" class = "img-responsive" alt = "Three kittens running towards the camera." >
< button class = "btn btn-block btn-default" > Like< / button >
< p > Things cats love:< / p >
< ul >
< li > cat nip< / li >
< li > laser pointers< / li >
< li > lasagna< / li >
< / ul >
< p > Top 3 things cats hate:< / p >
< ol >
< li > flea treatment< / li >
< li > thunder< / li >
< li > other cats< / li >
< / ol >
< form action = "/submit-cat-photo" >
< label > < input type = "radio" name = "indoor-outdoor" > Indoor< / label >
< label > < input type = "radio" name = "indoor-outdoor" > Outdoor< / label >
< label > < input type = "checkbox" name = "personality" > Loving< / label >
< label > < input type = "checkbox" name = "personality" > Lazy< / label >
< label > < input type = "checkbox" name = "personality" > Crazy< / label >
< input type = "text" placeholder = "cat photo URL" required >
< button type = "submit" > Submit< / button >
< / form >
< / div >
2018-10-10 18:03:03 -04:00
```
2019-08-28 16:26:13 +03:00
2018-10-10 18:03:03 -04:00
< / section >