http://jsfiddle.net/r9dunwzs/1/
<ul id="myTab" class="nav nav-tabs">
<li class="active">one</li>
<li>
<a href="#profile" data-toggle="tab">
<i class="glyphicon glyphicon-exclamation-sign" style="font-size: 25px"></i>
</a>
</li>
</ul>
As you can see in jsFiddle, I'm having problems to increase the font size of an icon within a tab in bootstrap 3.
The expected behaviour is the following:
but when I increase the font-size my tabs get deformed:
How can I increase the glyph-icon size without deforming my tabs ?
Add a class to the a href of the icon and set a new line-height to the icon
HTML
<div class="bs-docs-example">
<ul id="myTab" class="nav nav-tabs">
<li class="active">one</li>
<li>
<a href="#profile" data-toggle="tab" class="bicon">
<i class="glyphicon glyphicon-exclamation-sign" style="font-size: 25px"></i>
</a>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="home">
1
</div>
<div class="tab-pane fade" id="profile">
2
</div>
</div>
</div>
CSS
a.bicon{ padding: 0px 6px !important;
}
a.bicon i{ line-height: 1.45em !important;
}
DEMO HERE
Related
I am using Bootstrap 4, and I'm having a tough time with this. On this page wyckofftwosmartcookies.com the recipe section has three tabs, then a vertical navigation that selects between cookie types.
The first one displays correct then when you switch cookies instead of fading the first remains and the next selection appears underneath. I spent the last three hours looking at this and am missing something obvious. Any help or suggestions where to look would be greatly appreciated. Need to get this done for my daughters project =)
body{max-width:1440px;margin:auto;background-color:#f6f6f6}
#mobile-recipies{display:none}
#recipie-selector-desktop{display:none}
#mobile-selector{display: block}
.mor img {width:40%}
.hero-background{background-image:url("2 smart cookies hero desktop.jpg");background-repeat: no-repeat;height:500px}
.hero-headline{font-family:'Permanent Marker';color:#000111;font-size:36px}
.cookiefont-white{font-family:'Cookie',cursive ;font-size:1.5em;padding:24 0 0px;color:#666;font-weight:400}
.bg-drkgreen {background-color:#166937}
.bg-black{background-color:#232020}
.bg-orange{background-color:#F7941D}
.bg-blue{background-color:#3A71B8}
.font-white{color:#fff}
.section-lead-copy{font-family:'pacifico';font-size:24px;color:#888888;text-align: center}
.menu-item-font-white{font-family:'Cookie';font-size:20px;color:#666666;text-align: center}
.description-header{font-family:'Cookie';font-size:22px ;font-weight:600;color:#FFFFFF;text-align: center}
.spacer{padding-top:65px; padding-bottom:45px}
.spacer-b{padding-top:35px; padding-bottom:5px}
.spacer-c{padding-top:15px; padding-bottom:5px}
.spacer-d{padding-top:10px}
img.center {display: block;margin: 0 auto}
/* recipie box */
#mobile-recipies .btn-link {color:#000000}
#recipie-desktop a{color:#000000}
#recipie-desktop .nav-link.active {background-color:#000000;color:#FFFFFF;font-family:'pacifico'}
#recipie-desktop ul{padding-left: 3px}
.mb-0{font-family:'pacifico';color:#000}
.card-header{background-color:#ffffff}
.border-box{width:100%; border:dotted medium #000;border-radius: 5px;max-height: 700px}
.recipie-headline{font-family: 'pacifico';font-weight:400;font-size:30px;color:#000}
.recipie-subheadline{font-family:'roboto';font-size:14px;color:#999}
/* Ecommerce Styling */
.rep-product-Headline{font-family:'roboto';font-height:18px;color:#000000}
.rep-product-description{font-family:'roboto';font-size:16px;color:#888}
.rep-product-price{font-family:'Permanent Marker';font-size:45px}
.rep-image-box{width:50px;height:75px}
.ecomm-format button{background-color:#f6f6f6;font-family:'roboto';color:#000;width:200px;border:1px solid #000;font-size:24px;font-weight:bold}
.ecomm-format img {width:250px;height:275px}
#media (max-width: 995px){
#recipie-selector-desktop{display:none}
#mobile-selector{display: block}
.mor img {width:40%}
#ecomm-format img{width:200px; height:225px}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="https://cdn.snipcart.com/themes/v3.0.3/default/snipcart.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="recipie-desktop">
<div class ="container-fluid">
<div class = "border-box">
<div class ="recipie-headline"> Four Awesome Cookie Mixes </div>
<hr>
<div class ="spacer-c"></div>
<div class="row">
<div class="col-3">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<a class="nav-link active" id="v-pills-sfcatc-tab" data-toggle="pill" href="#v-pills-sfcatc" role="tab" aria-controls="v-pills-sfcatc-tab" aria-selected="true">Santa's Favorite Cookies</a>
<a class="nav-link" id="v-pills-wsc-tab" data-toggle="pill" href="#v-pills-wsc" role="tab" aria-controls="v-pills-wsc-tab" aria-selected="false">Wintry Sugar Cookies</a>
<a class="nav-link" id="v-pills-rc-tab" data-toggle="pill" href="#v-pills-rc" role="tab" aria-controls="v-pills-rc-tab" aria-selected="false">Reindeer Cookies</a>
<a class="nav-link" id="v-pills-ccoc-tab" data-toggle="pill" href="#v-pills-ccoc" role="tab" aria-controls="v-pills-ccoc-tab" aria-selected="false">Chocolate Chip & Oatmeal Cookies</a>
</div>
</div>
<div class="col-9">
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-sfcatc" role="tabpanel" aria-labelledby="v-pills-sfcatc-tab">
<div hidden id="snipcart" data-api-key="NmM2YTU4NzUtZGUwZS00OTAwLWFiZTEtNDQ2ZmE5ZTQwMDEzNjM2ODY4NTk3OTAxMjYwMDA5"></div>
<script src="https://cdn.snipcart.com/themes/v3.0.3/default/snipcart.js"></script>
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-sfcatc-tab" data-toggle="tab" href="#nav-sfcatc" role="tab" aria-controls="nav-sfcatc-tab" aria-selected="true">About The Cookies</a>
<a class="nav-item nav-link" id="nav-sfcd-tab" data-toggle="tab" href="#nav-sfcd" role="tab" aria-controls="nav-sfcd-tab" aria-selected="false">Directions</a>
<a class="nav-item nav-link" id="nav-sfcv-tab" data-toggle="tab" href="#nav-sfcv" role="tab" aria-controls="nav-sfcv-tab" aria-selected="false">Video Directions</a>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-sfcatc" role="tabpanel" aria-labelledby="nav-sfcatc-tab">
<div class = "row">
<div class ="col-5" >
<div class ="spacer-c"></div>
<div class="ecomm-format"><img src="sfcjar.png"></div>
</div>
<div class ="col-4">
<div class ="spacer-c"></div>
<div class ="rep-product-Headline">Holiday M&M Cookie Mix in a decorative 16oz Jar</div>
<div class ="rep-product-price">$11.99</div>
<div class ="spacer-d"></div>
<div class ="ecomm-format">
<button class="snipcart-add-item" data-item-id="Santa's Favorite Cookies" data-item-price="11.99" data-item-url="/product/Santas-favorite-cookie-jar" data-item-description="M&M Cookie Mix"data-item-image="sfcjar.png" data-item-name="Santa's Favorite M&M Cookie">Order Now</button></div>
</div>
</div>
</div>
<div class="tab-pane fade" id="nav-sfcd" role="tabpanel" aria-labelledby="nav-sfcd-tab">
<div class ="row">
<div class ="col-4">
<br>
<div class ="recipie-subheadline">What You Need To Have:</div>
<ul>
<li>¾ cup( 1 and ½ sticks) unsalted butter,softened</li>
<li>1 large egg</li>
<li>½ tablespoon vanilla extract</li>
</ul>
</div>
<div class ="col-6">
<br>
<div class ="recipie-subheadline">Directions:</div>
<ul>
<li>Preheat oven to 350 degrees F. </li>
<li>Beat butter, egg, and vanilla extract in large mixing bowl until blended. </li>
<li>Add mason jar mix and mix well. </li>
<li>Drop by rounded tablespoon onto parchment paper lined baking sheet. </li>
<li>Bake for 9 to 11 minutes or until lightly golden brown. </li>
<li>Cool on baking sheets for 2 minutes before moving to cooling rack. </li>
</ul>
</div>
</div>
</div>
<div class="tab-pane fade" id="nav-sfcv" role="tabpanel" aria-labelledby="nav-sfcv-tab">video</div>
</div>
</div></div>
<div class="tab-pane fade" id="v-pills-wsc" role="tabpanel" aria-labelledby="v-pills-wsc-tab">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-wscatc-tab" data-toggle="tab" href="#nav-wscatc" role="tab" aria-controls="nav-wscatc" aria-selected="true">About The Cookies</a>
<a class="nav-item nav-link" id="nav-wscd-tab" data-toggle="tab" href="#nav-wscd" role="tab" aria-controls="nav-wscd" aria-selected="false">Directions</a>
<a class="nav-item nav-link" id="nav-wscv-tab" data-toggle="tab" href="#nav-wscv" role="tab" aria-controls="nav-wscv" aria-selected="false">Video Directions</a>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show " id="nav-wscatc" role="tabpanel" aria-labelledby="nav-wscatc-tab">wsc atc</div>
<div class="tab-pane fade" id="nav-wscd" role="tabpanel" aria-labelledby="nav-wscd-tab">
<div class ="row">
<div class ="col-4">
<div class ="recipie-subheadline">What You Need To Have:</div>
<ul>
<li>½ cup unsalted butter(softened)</li>
<li>1 egg, room temperature</li>
<li>½ teaspoon vanilla extract</li>
<li>½ cup sour cream</li>
</ul>
</div>
<div class ="col-6">
<div class ="recipie-subheadline">Directions:</div>
<ul>
</li>
<li>Mix all ingredients together and roll out to ¼ inch thickness on lightly floured surface.</li>
<li>Chill dough for about an hour before using cookie cutters to shape. Add sprinkles if desired.</li>
<li>Bake at 350 degrees for 10 to 12 minutes(do not overbake)</li>
</ul>
</div>
</div></div>
<div class="tab-pane fade" id="nav-wscv" role="tabpanel" aria-labelledby="nav-wscv-tab">Video</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-rc" role="tabpanel" aria-labelledby="v-pills-rc-tab">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-rcatc-tab" data-toggle="tab" href="#nav-rcatc" role="tab" aria-controls="nav-rcatc" aria-selected="true">About The Cookies</a>
<a class="nav-item nav-link" id="nav-rcdir-tab" data-toggle="tab" href="#nav-rcdir" role="tab" aria-controls="nav-rcdir" aria-selected="false">Directions</a>
<a class="nav-item nav-link" id="nav-rcvid-tab" data-toggle="tab" href="#nav-rcvid" role="tab" aria-controls="nav-rcvid" aria-selected="false">Video Directions</a>
</div>
</nav>
<div class="tab-rc" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-rcatc" role="tabpanel" aria-labelledby="nav-rcatc-tab">ATC</div>
<div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-rcdir-tab">
<div class ="row">
<div class ="col-4">
<div class ="recipie-subheadline">What You Need To Have:</div>
<ul>
<li>½ cup softened butter</li>
<li>1 egg </li>
<li>1 teaspoon vanilla</li>
</ul>
</div>
<div class ="col-6">
<div class ="recipie-subheadline">Directions:</div>
<ul>
<li>Dump jar in a large mixing bowl</li>
<li>add ½ cup softened butter</li>
<li>add 1 egg</li><li>add 1 teaspoon vanilla.</li>
<li>Mix well and drop onto a cookie sheet lined with parchment paper. </li>
<li>Bake at 375 degrees for 8 to 10 minutes</li>
</ul>
</div>
</div></div>
<div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-rcvid-tab">RC Video</div>
</div> </div>
<div class="tab-pane fade" id="v-pills-ccoc" role="tabpanel" aria-labelledby="v-pills-ccoc-tab">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-ccocatc-tab" data-toggle="tab" href="#nav-ccocatc" role="tab" aria-controls="nav-ccocatc" aria-selected="true">About The Cookies</a>
<a class="nav-item nav-link" id="nav-ccocd-tab" data-toggle="tab" href="#nav-ccocd" role="tab" aria-controls="nav-ccocd" aria-selected="false">Directions</a>
<a class="nav-item nav-link" id="nav-ccocv-tab" data-toggle="tab" href="#nav-ccocv" role="tab" aria-controls="nav-ccocv" aria-selected="false">Video Directions</a>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-ccocatc" role="tabpanel" aria-labelledby="nav-ccocatc-tab">atc ccoc</div>
<div class="tab-pane fade" id="nav-ccocd" role="tabpanel" aria-labelledby="nav-ccocd-tab">
<div class ="row">
<div class ="col-4">
<div class ="recipie-subheadline">What You Need To Have:</div>
<ul>
<li>1 egg, slightly beaten</li>
<li>1 teaspoon vanilla extract</li>
<li>1 stick butter, softened</li>
</ul>
</div>
<div class ="col-6">
<div class ="recipie-subheadline">Directions:</div>
<ul>
<li>Preheat oven to 375 degrees.</li>
<li>Empty jar contents into a large mixing bowl</li>
<li>Add the egg</li>, <li>Add the vanilla</li>
<li> Add the butter and mix well</li>
<li>Drop by spoonfuls onto an ungreased cookie sheet about 2 inches apart</li>
<li>Bake for 8 to 10 minutes or until the edges are golden brown</li>
<li>Remove to a wire rack and let cool</li>
</ul>
</div>
</div></div>
<div class="tab-pane fade" id="nav-ccocv" role="tabpanel" aria-labelledby="nav-ccocv-tab">ccoc v</div>
</div> </div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous">
</script>
There is a problem in your HTML code.
In this div tab-content you haven't added all your tab-pane divs.
Hope this will help you.
body {
max-width: 1440px;
margin: auto;
background-color: #f6f6f6
}
#mobile-recipies {
display: none
}
#recipie-selector-desktop {
display: none
}
#mobile-selector {
display: block
}
.mor img {
width: 40%
}
.hero-background {
background-image: url("2 smart cookies hero desktop.jpg");
background-repeat: no-repeat;
height: 500px
}
.hero-headline {
font-family: 'Permanent Marker';
color: #000111;
font-size: 36px
}
.cookiefont-white {
font-family: 'Cookie', cursive;
font-size: 1.5em;
padding: 24 0 0px;
color: #666;
font-weight: 400
}
.bg-drkgreen {
background-color: #166937
}
.bg-black {
background-color: #232020
}
.bg-orange {
background-color: #F7941D
}
.bg-blue {
background-color: #3A71B8
}
.font-white {
color: #fff
}
.section-lead-copy {
font-family: 'pacifico';
font-size: 24px;
color: #888888;
text-align: center
}
.menu-item-font-white {
font-family: 'Cookie';
font-size: 20px;
color: #666666;
text-align: center
}
.description-header {
font-family: 'Cookie';
font-size: 22px;
font-weight: 600;
color: #FFFFFF;
text-align: center
}
.spacer {
padding-top: 65px;
padding-bottom: 45px
}
.spacer-b {
padding-top: 35px;
padding-bottom: 5px
}
.spacer-c {
padding-top: 15px;
padding-bottom: 5px
}
.spacer-d {
padding-top: 10px
}
img.center {
display: block;
margin: 0 auto
}
/* recipie box */
#mobile-recipies .btn-link {
color: #000000
}
#recipie-desktop a {
color: #000000
}
#recipie-desktop .nav-link.active {
background-color: #000000;
color: #FFFFFF;
font-family: 'pacifico'
}
#recipie-desktop ul {
padding-left: 3px
}
.mb-0 {
font-family: 'pacifico';
color: #000
}
.card-header {
background-color: #ffffff
}
.border-box {
width: 100%;
border: dotted medium #000;
border-radius: 5px;
max-height: 700px
}
.recipie-headline {
font-family: 'pacifico';
font-weight: 400;
font-size: 30px;
color: #000
}
.recipie-subheadline {
font-family: 'roboto';
font-size: 14px;
color: #999
}
/* Ecommerce Styling */
.rep-product-Headline {
font-family: 'roboto';
font-height: 18px;
color: #000000
}
.rep-product-description {
font-family: 'roboto';
font-size: 16px;
color: #888
}
.rep-product-price {
font-family: 'Permanent Marker';
font-size: 45px
}
.rep-image-box {
width: 50px;
height: 75px
}
.ecomm-format button {
background-color: #f6f6f6;
font-family: 'roboto';
color: #000;
width: 200px;
border: 1px solid #000;
font-size: 24px;
font-weight: bold
}
.ecomm-format img {
width: 250px;
height: 275px
}
#media (max-width: 995px) {
#recipie-selector-desktop {
display: none
}
#mobile-selector {
display: block
}
.mor img {
width: 40%
}
#ecomm-format img {
width: 200px;
height: 225px
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdn.snipcart.com/themes/v3.0.3/default/snipcart.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="recipie-desktop">
<div class="container-fluid">
<div class="border-box">
<div class="recipie-headline"> Four Awesome Cookie Mixes </div>
<hr>
<div class="spacer-c"></div>
<div class="row">
<div class="col-3">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<a class="nav-link active" id="v-pills-sfcatc-tab" data-toggle="pill" href="#v-pills-sfcatc" role="tab" aria-controls="v-pills-sfcatc-tab" aria-selected="true">Santa's Favorite Cookies</a>
<a class="nav-link" id="v-pills-wsc-tab" data-toggle="pill" href="#v-pills-wsc" role="tab" aria-controls="v-pills-wsc-tab" aria-selected="false">Wintry Sugar Cookies</a>
<a class="nav-link" id="v-pills-rc-tab" data-toggle="pill" href="#v-pills-rc" role="tab" aria-controls="v-pills-rc-tab" aria-selected="false">Reindeer Cookies</a>
<a class="nav-link" id="v-pills-ccoc-tab" data-toggle="pill" href="#v-pills-ccoc" role="tab" aria-controls="v-pills-ccoc-tab" aria-selected="false">Chocolate Chip & Oatmeal Cookies</a>
</div>
</div>
<div class="col-9">
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-sfcatc" role="tabpanel" aria-labelledby="v-pills-sfcatc-tab">
<div hidden id="snipcart" data-api-key="NmM2YTU4NzUtZGUwZS00OTAwLWFiZTEtNDQ2ZmE5ZTQwMDEzNjM2ODY4NTk3OTAxMjYwMDA5"></div>
<script src="https://cdn.snipcart.com/themes/v3.0.3/default/snipcart.js"></script>
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-sfcatc-tab" data-toggle="tab" href="#nav-sfcatc" role="tab" aria-controls="nav-sfcatc-tab" aria-selected="true">About The Cookies</a>
<a class="nav-item nav-link" id="nav-sfcd-tab" data-toggle="tab" href="#nav-sfcd" role="tab" aria-controls="nav-sfcd-tab" aria-selected="false">Directions</a>
<a class="nav-item nav-link" id="nav-sfcv-tab" data-toggle="tab" href="#nav-sfcv" role="tab" aria-controls="nav-sfcv-tab" aria-selected="false">Video Directions</a>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-sfcatc" role="tabpanel" aria-labelledby="nav-sfcatc-tab">
<div class="row">
<div class="col-5">
<div class="spacer-c"></div>
<div class="ecomm-format"><img src="sfcjar.png"></div>
</div>
<div class="col-4">
<div class="spacer-c"></div>
<div class="rep-product-Headline">Holiday M&M Cookie Mix in a decorative 16oz Jar</div>
<div class="rep-product-price">$11.99</div>
<div class="spacer-d"></div>
<div class="ecomm-format">
<button class="snipcart-add-item" data-item-id="Santa's Favorite Cookies" data-item-price="11.99" data-item-url="/product/Santas-favorite-cookie-jar" data-item-description="M&M Cookie Mix" data-item-image="sfcjar.png" data-item-name="Santa's Favorite M&M Cookie">Order Now</button></div>
</div>
</div>
</div>
<div class="tab-pane fade" id="nav-sfcd" role="tabpanel" aria-labelledby="nav-sfcd-tab">
<div class="row">
<div class="col-4">
<br>
<div class="recipie-subheadline">What You Need To Have:</div>
<ul>
<li>¾ cup( 1 and ½ sticks) unsalted butter,softened</li>
<li>1 large egg</li>
<li>½ tablespoon vanilla extract</li>
</ul>
</div>
<div class="col-6">
<br>
<div class="recipie-subheadline">Directions:</div>
<ul>
<li>Preheat oven to 350 degrees F. </li>
<li>Beat butter, egg, and vanilla extract in large mixing bowl until blended. </li>
<li>Add mason jar mix and mix well. </li>
<li>Drop by rounded tablespoon onto parchment paper lined baking sheet. </li>
<li>Bake for 9 to 11 minutes or until lightly golden brown. </li>
<li>Cool on baking sheets for 2 minutes before moving to cooling rack. </li>
</ul>
</div>
</div>
</div>
<div class="tab-pane fade" id="nav-sfcv" role="tabpanel" aria-labelledby="nav-sfcv-tab">video</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-wsc" role="tabpanel" aria-labelledby="v-pills-wsc-tab">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-wscatc-tab" data-toggle="tab" href="#nav-wscatc" role="tab" aria-controls="nav-wscatc" aria-selected="true">About The Cookies</a>
<a class="nav-item nav-link" id="nav-wscd-tab" data-toggle="tab" href="#nav-wscd" role="tab" aria-controls="nav-wscd" aria-selected="false">Directions</a>
<a class="nav-item nav-link" id="nav-wscv-tab" data-toggle="tab" href="#nav-wscv" role="tab" aria-controls="nav-wscv" aria-selected="false">Video Directions</a>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show " id="nav-wscatc" role="tabpanel" aria-labelledby="nav-wscatc-tab">wsc atc</div>
<div class="tab-pane fade" id="nav-wscd" role="tabpanel" aria-labelledby="nav-wscd-tab">
<div class="row">
<div class="col-4">
<div class="recipie-subheadline">What You Need To Have:</div>
<ul>
<li>½ cup unsalted butter(softened)</li>
<li>1 egg, room temperature</li>
<li>½ teaspoon vanilla extract</li>
<li>½ cup sour cream</li>
</ul>
</div>
<div class="col-6">
<div class="recipie-subheadline">Directions:</div>
<ul>
<li>Mix all ingredients together and roll out to ¼ inch thickness on lightly floured surface.</li>
<li>Chill dough for about an hour before using cookie cutters to shape. Add sprinkles if desired.</li>
<li>Bake at 350 degrees for 10 to 12 minutes(do not overbake)</li>
</ul>
</div>
</div>
</div>
<div class="tab-pane fade" id="nav-wscv" role="tabpanel" aria-labelledby="nav-wscv-tab">Video</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-rc" role="tabpanel" aria-labelledby="v-pills-rc-tab">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-rcatc-tab" data-toggle="tab" href="#nav-rcatc" role="tab" aria-controls="nav-rcatc" aria-selected="true">About The Cookies</a>
<a class="nav-item nav-link" id="nav-rcdir-tab" data-toggle="tab" href="#nav-rcdir" role="tab" aria-controls="nav-rcdir" aria-selected="false">Directions</a>
<a class="nav-item nav-link" id="nav-rcvid-tab" data-toggle="tab" href="#nav-rcvid" role="tab" aria-controls="nav-rcvid" aria-selected="false">Video Directions</a>
</div>
</nav>
<div class="tab-rc" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-rcatc" role="tabpanel" aria-labelledby="nav-rcatc-tab">ATC</div>
<div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-rcdir-tab">
<div class="row">
<div class="col-4">
<div class="recipie-subheadline">What You Need To Have:</div>
<ul>
<li>½ cup softened butter</li>
<li>1 egg </li>
<li>1 teaspoon vanilla</li>
</ul>
</div>
<div class="col-6">
<div class="recipie-subheadline">Directions:</div>
<ul>
<li>Dump jar in a large mixing bowl</li>
<li>add ½ cup softened butter</li>
<li>add 1 egg</li>
<li>add 1 teaspoon vanilla.</li>
<li>Mix well and drop onto a cookie sheet lined with parchment paper. </li>
<li>Bake at 375 degrees for 8 to 10 minutes</li>
</ul>
</div>
</div>
</div>
<div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-rcvid-tab">RC Video</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-ccoc" role="tabpanel" aria-labelledby="v-pills-ccoc-tab">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-ccocatc-tab" data-toggle="tab" href="#nav-ccocatc" role="tab" aria-controls="nav-ccocatc" aria-selected="true">About The Cookies</a>
<a class="nav-item nav-link" id="nav-ccocd-tab" data-toggle="tab" href="#nav-ccocd" role="tab" aria-controls="nav-ccocd" aria-selected="false">Directions</a>
<a class="nav-item nav-link" id="nav-ccocv-tab" data-toggle="tab" href="#nav-ccocv" role="tab" aria-controls="nav-ccocv" aria-selected="false">Video Directions</a>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-ccocatc" role="tabpanel" aria-labelledby="nav-ccocatc-tab">atc ccoc</div>
<div class="tab-pane fade" id="nav-ccocd" role="tabpanel" aria-labelledby="nav-ccocd-tab">
<div class="row">
<div class="col-4">
<div class="recipie-subheadline">What You Need To Have:</div>
<ul>
<li>1 egg, slightly beaten</li>
<li>1 teaspoon vanilla extract</li>
<li>1 stick butter, softened</li>
</ul>
</div>
<div class="col-6">
<div class="recipie-subheadline">Directions:</div>
<ul>
<li>Preheat oven to 375 degrees.</li>
<li>Empty jar contents into a large mixing bowl</li>
<li>Add the egg</li>,
<li>Add the vanilla</li>
<li> Add the butter and mix well</li>
<li>Drop by spoonfuls onto an ungreased cookie sheet about 2 inches apart</li>
<li>Bake for 8 to 10 minutes or until the edges are golden brown</li>
<li>Remove to a wire rack and let cool</li>
</ul>
</div>
</div>
</div>
<div class="tab-pane fade" id="nav-ccocv" role="tabpanel" aria-labelledby="nav-ccocv-tab">ccoc v</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">
</script>
I would prefer that all my menu items remain visible at all times, and simply switch from a centered row formation into a centered column when the screen size is too small.
<div style="position: sticky; top: 0px;">
<!--<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar9">
<span class="navbar-toggler-icon"></span>
</button> this is the fricking collapse button -->
<div class="navbar-collapse collapse" id="navbar10">
<ul class="navbar-nav nav-fill w-100">
<li class="nav-item">
<a class="nav-link" href="#">aaa</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">bbb</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">ccc</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">ddd</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">eee</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">ffff</a>
</li>
</ul>
</div>
</div>
You can use the regular bootsrap class used to build your layout and drop the collapsing navbar classes: see https://getbootstrap.com/docs/4.0/utilities/flex/
Flex
Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive flexbox utilities. For more complex implementations, custom CSS may be necessary.
example with :flex-md-row class (play snippet in fullpage and resize windows to see it toggling row/column. You can try also flex-lg-row if you think it turns into column too late.
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<div class="navbar " id="navbar10">
<ul class="navbar-nav nav-fill w-100 flex-md-row">
<li class="nav-item">
<a class="nav-link" href="#">aaa</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">bbb</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">ccc</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">ddd</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">eee</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">ffff</a>
</li>
</ul>
</div>
</div>
Using CSS media queries, you can set specific break-points to change your elements. In this example, if the window is less than 480px then we can adjust the width to 100%.
(To see it in action, click run > full page > then resize window)
.navTitle {
width: 20%;
float: left;
background-color: lightGrey;
outline: 1px solid black;
}
#media screen and (max-width: 480px) {
.navTitle {
width: 100%;
}
}
<div class="navTitle">
<p>Section 1</p>
</div>
<div class="navTitle">
<p>Section 2</p>
</div>
<div class="navTitle">
<p>Section 3</p>
</div>
<div class="navTitle">
<p>Section 4</p>
</div>
<div class="navTitle">
<p>Section 5</p>
</div>
i have just started learning web development and I have been facing a few issues related to the alignment of tags, buttons and icons.
Here are the issues I'm facing:
The brand name is not in line with the a tags. i tried display:inline; in every class but its not working.
the social media tags are hanging in mid air, I want them to be in line with the a tags. Again, i tried reducing the margin, padding and using the inline command but nothing seems to be working.
the bootstrap search button is also hanging mid air. I want all the above three to be in line.
Here's a screenshot of the page.
And here's the code
header {
background: #669999;
color: white;
padding: 5px 5px 5px 15px;
}
.fontsize {
color: white;
margin: 0px 0px 0px 10px;
font-size: 25px;
padding: 5px;
}
.icon {
float: right;
list-style-type: none;
margin: 0px 10px 0px 10px;
padding: 5px;
display: inline;
}
body {
margin: 0px;
}
.colors {
margin: 5px 10px 5px 10px;
padding: 10px;
color: white;
}
a:hover.colors {
color: black;
text-decoration: none;
}
.picturefont {
font-size: 25;
font-style: italic;
}
.whitespace {
padding: 10px;
margin: 50px;
}
#margin {
margin: 0px;
}
.frontpageimage {
width: 90%;
display: inline;
border: 1px solid black;
}
<h1 class="fontsize"> Brand name </h1>
<nav>
<a class="colors" href="home.html"> Home </a>
<a class="colors" href="contact.html"> Contact </a>
<a class="colors" href="recipe.html"> Recipes </a>
<a class="colors" href="order.html"> Order </a>
<ul>
<li class="icon">
<img src="icon-insta.png">
</li>
<li class="icon">
<img src="fb-icon.png">
</li>
<li class="icon">
<img src="phone-icon.png">
</li>
</ul>
</nav>
<form id="margin" class="navbar-form navbar-right">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<!-- <li>Link</li> -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span
class="caret"></span></a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</header>
<body>
<div class="row">
<div class="col-sm-2 whitespace picturefont">
<a href="recipe.html">
<img class="frontpageimage" src="oreo-cake.jpg"></a> Chocolate Cake</div>
<div class="col-sm-2 whitespace picturefont">
<a href="recipe.html">
<img class="frontpageimage" src="kitkat-cake.jpg"></a> Rasberry Sponge Cake
</div>
<div class="col-sm-2 whitespace picturefont">
<a href="recipe.html">
<img class="frontpageimage" src="green-cake.jpg"></a> Red Velvet Cake</div>
<div class="col-sm-2 whitespace picturefont">
<a href="recipe.html">
<img class="frontpageimage" src="KitKatCake3.jpg"></a> Mango Rose Tart
</div>
</div>
<div id="slider">
<div id="slider2">
<img id="choclatecake" src="oreo-cake.jpg" alt="Moist Chocolate Cake" />
<img id="choclatecake" src="kitkat-cake.jpg" alt="Moist Chocolate
Cake" />
<img id="choclatecake" src="green-cake.jpg" alt="Moist Chocolate Cake" />
<img id="choclatecake" src="KitKatCake3.jpg" alt="Moist Chocolate
Cake" />
</div>
</div>`
Forgive me for the improper format but I'm new here. Hoping to find some answers. Thanks
From my experience, the best way to organize the layout of a web page is to use tables (rows and columns). Start by sketching the layout and imagining boundaries around the items of your website.
I suggest that you use Bootstrap stylesheet by including the CSS file at your page header
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
Then using the CSS classes row and .col-md-* for div containter element classes.
Refer to the page (https://getbootstrap.com/docs/3.3/css/#grid-example-basic) for code examples.
Your structure might be something like the following:
<div class="row">
<div class="col-md-8">Brand name</div>
<div class="col-md-4">social media tags</div>
</div>
<div class="row">
<div class="col-md-6">navigation</div>
<div class="col-md-6">search</div>
</div>
<div class="row">
<div class="col-md-12">Body</div>
</div>
You need to put h1 tag inside nav tag.
You have closed the nav tag before starting form and you have another closing nav tag later.
Same reason as above.
Try it like this:
<nav>
<h1 class="fontsize"> Brand name </h1>
<a class="colors" href="home.html"> Home </a>
<a class="colors" href="contact.html"> Contact </a>
<a class="colors" href="recipe.html"> Recipes </a>
<a class="colors" href="order.html"> Order </a>
<ul>
<li class="icon">
<img src="icon-insta.png">
</li>
<li class="icon">
<img src="fb-icon.png">
</li>
<li class="icon">
<img src="phone-icon.png">
</li>
</ul>
<form id="margin" class="navbar-form navbar-right">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span
class="caret"></span></a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</li>
</ul>
</nav>
#Student, you have a lot going on here, but most of your issues revolve around malformed HTML. So let's go through your issues one-by-one.
1) The brand name is not in line with the a tags. i tried
display:inline; in every class but its not working.
I'm only seeing your use of display:inline in a couple of your classes, but not on the brand name. Regardless, Bootstrap already has a brand with links built in for you. As you can see in the code below.
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button class="navbar-toggle collapsed" aria-expanded="false" type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand Name</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Contact</li>
<li>Recipes</li>
<li>Orders</li>
</ul>
...
2) The social media tags are hanging in mid air, I want them to be in
line with the a tags. Again, i tried reducing the margin, padding and
using the inline command but nothing seems to be working.
To get these to go on the same line, you can nest the form and the social media icons in a div tag that pulls both of them to the right of the navigation bar using the navbar-right class. To make sure they're on the same line, use Bootstrap's float class: pull-left and pull-right. You'll need to add padding to the top of the a tags using padding-top CSS property. I've done it to one, so you can get an idea of how.
<div class="navbar-right">
<form class="navbar-form pull-left">
<div class="form-group">
<input class="form-control" type="text" placeholder="Search">
</div>
<button class="btn btn-default" type="submit">Submit</button>
</form>
<ul class="nav navbar-nav pull-right">
<li>
<img src="fb-icon.png">
</li>
<li>
<img src="phone-icon.png">
</li>
<li>
<img src="icon-insta.png">
</li>
</ul>
</div>
You'll just need to reapply some of your classes.
I'm using the default collapse navbar from bootstrap 3, but when I resize the browser window or open the page on a mobile device, the menu will first collapse and reduce nice to just the button and when I hit this button to expand the menu, all the menu items are too far on the left side so you can't read them properly an the language selection (just a flag) disappears completely. I tried several things like inline styling in html (left margin/padding, width, max width etc) and I also tried to remove the negative margin for .navbar-nav in my bootstrap css. I'll attach a screenshot and here is the code for my navigation (of course it's nested in a container div):
<div class="row formRow">
<div class="col-sm-12 searchCol">
<form class="searchBox" action="/en/search.html" method="get">
<div class="form-group" style="display:inline;">
<div class="input-group">
<input type="text" name="q" class="form-control" maxlength="2048">
<span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
</div>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<nav class="navbar navbar-default">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" ><!--aria-controls="navbar"-->
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/en/"><img class="img-responsive" src="/img/primeralogo.png" alt="Primera Technology Europe Logo"></a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav" style="padding: auto; max-width: 100%;">
<li class="dropdown" style="padding: auto; max-width: 100%;">
PRODUCTS
<ul class="dropdown-menu">
<li>Slide Printer</li>
<li>Cassette Printer - Autoloader</li>
<li>Cassette Printer - Manual</li>
<li>Medical IT Equipment</li>
<li role="separator" class="divider"></li>
<li>LX500e Color Label Printer</li>
<li>Disc Publishers</li>
<li role="separator" class="divider"></li>
<li>Product Brochure</li>
<li>Portable All-in-One Printer</li>
</ul>
</li>
<li class="dropdown" style="padding: auto; max-width: 100%;">
SUPPORT
<ul class="dropdown-menu">
<li>Contact Support</li>
<li>Knowledge Base</li>
<li role="separator" class="divider"></li>
<li>Product Registration</li>
<!-- <li>Sign up for training</li>-->
<li role="separator" class="divider"></li>
<li>Slide Printer</li>
<li>Cassette Printer</li>
<li>LIS Integration</li>
</ul>
</li>
<li class="dropdown" style="padding: auto; max-width: 100%;">
COMPANY
<ul class="dropdown-menu">
<li>About Primera </li>
<li>Press</li>
<li>Contact Primera </li>
</ul>
</li>
<li class="dropdown" style="padding: auto; max-width: 100%;">
<span class="lang-sm" lang="en"></span>
<ul class="dropdown-menu"> <li><span class="lang-sm lang-lbl-full" lang="en"></span></li>
<li><span class="lang-sm lang-lbl-full" lang="de"></span></li>
<li><span class="lang-sm lang-lbl-full" lang="fr"></span></li>
<!--<li><span class="lang-sm lang-lbl-full" lang="es"></span></li>-->
<li><span class="lang-sm lang-lbl-full" lang="nl"></span></li>
<li><span class="lang-sm lang-lbl-full" lang="bg"></span></li>
<li><span class="lang-sm lang-lbl-full" lang="cz"></span></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</nav>
</div>
</div>
<div class="row formRowBelow">
<div class="col-sm-12 searchCol">
<form class="searchBoxAlt" action="/en/search.html" method="get">
<div class="form-group" style="display:inline;">
<div class="input-group">
<input type="text" name="q" class="form-control" value="" maxlength="2048">
<span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
</div>
</div>
</form>
</div>
</div>
Screenshot of the problem
EDIT: It seems that if the window gets small enough (320px width) the navigation gets displayed almost correct. As the window gets larger, the text goes to the left and disappears "letter for letter" until it hits the breaking point where it becomes a normal navbar again
If you're using Chrome, then this is a browser bug that I've experienced as well. When moving to a different breakpoint from mobile view sometimes Chrome zooms in. Try just resetting your browser zoom level (Ctrl/Cmnd + 0).
You also have a JS error in your console that you should consider resolving.
I'm developing a web with Ruby on Rails, using Twitter-Bootstrap and Simple-Navigation gem. The navigation menu works fine on any browser, something like this:
When displaying the web on a mobile device and clicking the nav button, the whole menu is displayed on vertical block, enlarging the size of the header to a max. height than can hold the menu. The problem is that opening any submenú increases the size of the menu, overflowing and hiding the last options, as you can see in the comparison:
Any idea?
The code of nav_menu on the mobile version:
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="brand">
<img alt="NRG Consulting logo" src="/assets/nrg-logo.png" title="NRG Consulting">
</div>
<span class="development" id="rails-env"><span>development</span></span>
<div class="container nav-collapse in collapse" style="height: 496px;">
<ul class="nav pull-right align-top">
<li>
<a href="manual_path">
Help
</a>
</li>
<li>
Español <img alt="Switch to English" class="lang" data-locale="en" src="/assets/lang-es.png" title="English">
</li>
</ul>
<ul class="nav pull-right align-bottom">
<li id="home">Home</li>
<li id="formulas">Formulas</li>
<li id="deals">Deals</li>
.
.
.
<li class="active dropdown" id="admin">
Admin <b class="caret"></b>
<ul class="dropdown-menu">
<li id="subscription">Subscriptions</li>
<li class="divider" id="nav_header"></li>
<li id="historic">Recalculate historic prices</li>
<li class="divider" id="nav_header"></li>
<li id="export">export data</li>
<li id="import_tuple_eod_check">Check data</li>
<li class="divider" id="nav_header"></li>
<li id="alerts">Alert</li>
<li id="product_price_alerts">Price alerts</li>
<li id="import_tuples">Import tuple</li>
<li id="fixing_errors">fixing errors</li>
<li class="divider" id="nav_header"></li><li id="redis">Resque</li>
<li id="copycopter">Translate</li>
<li class="divider" id="nav_header"></li>
<li class="active simple-navigation-active-leaf" id="client">Clients</li>
<li id="user">Users</li>
<li id="user_activities">User activity</li></ul></li>
<li id="user">Users</li>
</ul>
</div>
</div>
</div>
</div>
Collapsed nav menu appears to set a fixed height value when displaying nav menu, preventing the div to enlarging when submenu dropdowns display:
<div class="container nav-collapse in collapse" style="height: 496px;">
Adding this lines to style.css set height property to auto, allowing the div to enlarge when needed, showing the whole menu:
.container.nav-collapse.in.collapse{
height: auto !important;
}
Perhaps there is a cleaner solution, but this worked pretty fine for me, and don't want to change Bootstrap code itself.
A link displaying some usefull info about similar issues.