i want navbar Bootstrap 4 over all element,
now can over all element but when use Carousel in Body navbar-collapse
NAVBAR - HTML
<nav class="navbar navbar-expand-md navbar-dark bg-main">
<a class="navbar-brand d-md-none order-1" style="font-size:26px;line-height:0" href="#">【K】【S】【J】</a>
<button class="navbar-toggler" type="button">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse d-flex flex-column flex-row flex-lg-row flex-xl-row justify-content-lg-end bg-main p-3 p-lg-0 mt-5 mt-lg-0 mobileMenu" id="navbarSupportedContent">
<ul class="navbar-nav d-flex d-flex justify-content-around text-right px-3" dir="rtl">
<li class="nav-item active" style="">
<a class="nav-link" href="#">
<span>Home</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span>Anout</span>
</a>
</li>
</ul>
</div>
</nav>
NAVBAR - CSS
/* Mobile Menu */
#media only screen and (max-width: 992px) {
.mobileMenu {
position: fixed;
top: 70px;
bottom: 0;
right: -100rem;
margin: auto;
transform: translateX(-100);
transition: all ease .25s;
}
.open-nav {
right:0;
}
.body-blur{
filter: blur(5px)
}
}
Carousel - HTML
<div id="mainCarousel" class="carousel slide" data-ride="carousel">
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
<li data-target="#demo" data-slide-to="3"></li>
</ul>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="~/Content/documents/shared/dev1.jpg" alt="Los Angeles">
<div class="carousel-caption">
<h3>Los Angeles</h3>
<p>We had such a great time in LA!</p>
</div>
</div>
<div class="carousel-item">
<img src="~/Content/documents/shared/dev2.jpg" alt="Chicago">
<div class="carousel-caption">
<h3>Chicago</h3>
<p>Thank you, Chicago!</p>
</div>
</div>
<div class="carousel-item">
<img src="~/Content/documents/shared/dev7.jpg" alt="New York">
<div class="carousel-caption">
<h3>New York</h3>
<p>We love the Big Apple!</p>
</div>
</div>
<div class="carousel-item">
<img src="~/Content/documents/shared/dev6.jpg" alt="New York">
<div class="carousel-caption">
<h3>New York</h3>
<p>We love the Big Apple!</p>
</div>
</div>
</div>
#*<a class="carousel-control-prev shadow-lg" href="#mainCarousel" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next shadow-lg" href="#mainCarousel" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>*#
</div>
Carousel - CSS
.carousel-inner img {
width: 100%;
height: 600px;
}
Open Nav
$('.navbar-toggler').on('click',function () {
$('.mobileMenu').toggleClass('open-nav');
$('.app-content').toggleClass('body-blur');
});
Use Bootstrap 4, ASP.NET MVC5
Open Nav and
Close Nav
When Remove Carousel code nav bar work and open success
Remove Carousel
if use any div not problem and work but when use Carousel nav hidden back Carousel.
**Thanks for all suggestions **
Try it:
.mobileMenu {
z-index: 9999999;
}
Related
I have a carousel with modified css because the default font and color of the captions/icons on the images are impossible to see, so I changed the arrows' style and color as well as the caption position/color.
However, when I activate my modal on the page, it resets all of the css applied to the carousel. Why is this happening?
My CSS:
/* CAROUSEL CSS */
.carousel-caption {
position: relative;
left: 0;
right: 0;
}
.carousel-control-prev {
justify-content: start;
}
.carousel-control-next{
justify-content: end;
}
.carousel-control-next-icon {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='red' viewBox='0 0 8 8'%3E%3Cpath d='M2.75 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3E%3C/svg%3E");
}
.carousel-control-prev-icon {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='red' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E");
}
/* for screens smaller then mobile */
#media only screen and (max-width: 600px) {
.carousel-caption {
color: red;
font-size:12px;
}
}
/* for screens bigger then mobile */
#media only screen and (min-width: 600px) {
.carousel-caption {
color: black;
font-size:18px;
}
}
HTML:
<!-- NavBar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Land Power</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home<span class="sr-only"></span></a>
</li>
<!-- <li class="nav-item ">
<a class="nav-link" href="contact.html">Contact Us<span class="sr-only"></span></a>
</li> -->
</ul>
</div>
<div class="d-flex justify-content-end">
<button class="signup btn btn-outline-success my-2 my-sm-0" type="button" linkFile="contact.html" data-toggle="modal" data-remote="contact.html" data-target="#theModal">Sign Up</button>
</div>
</div>
</nav>
<!-- Modal -->
<div class="modal fade" id="theModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
</div>
</div>
</div>
<!-- Carousel -->
<div class="container">
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner ">
<div class="carousel-item active">
<img class="d-block mw-80 mx-auto img-fluid" src="https://placeimg.com/1080/500/arch" alt="First slide">
<div class="carousel-caption bg-secondary ">
<h5>First Slide</h5>
<p>Random Architect Pictures</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block mw-80 mx-auto img-fluid" src="https://placeimg.com/1080/500/nature" alt="Second slide">
<div class="carousel-caption bg-secondary ">
<h5>Second Slide</h5>
<p>Random Nature Pictures</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block mw-80 mx-auto img-fluid" src="https://placeimg.com/1080/500/animals" alt="Third slide">
<div class="carousel-caption bg-secondary ">
<h5>Third Slide</h5>
<p>Random Animal Pictures</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
</a>
</div>
</div>
Im trying to learn Bootstrap and get a little bit into web development, so I challenged myself to build a existing page.
This is the link to the website that I'm trying to rebuild/"copy":
https://www.fahrradhaus-griesmann.de/
Now my question is, how do I format the right side with "Kontakt Impressum Datenschutz" etc. correctly to get the alignment and responsiveness?
Part of my HTML Code:
<div class="row">
<div class="sliderL col-xs-9">
<div id="slider" class="carousel slide" data-ride="carousel">
<!-- indicators dot nav -->
<ol class="carousel-indicators">
<li data-target="#slider" data-slide-to="0" class="active"></li>
<li data-target="#slider" data-slide-to="1"></li>
<li data-target="#slider" data-slide-to="2"></li>
<li data-target="#slider" data-slide-to="3"></li>
<li data-target="#slider" data-slide-to="4"></li>
</ol>
<!-- wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block w-100" src="img/slideshow1.jpg" alt="slideshow1">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/slideshow2.jpg" alt="slideshow2">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/slideshow3.jpg" alt="slideshow3">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/slideshow4.jpg" alt="slideshow4">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/slideshow5.jpg" alt="slideshow5">
</div>
<!-- navigation controls -->
<a class="carousel-control-prev" href="#slider" role="button" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#slider" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
<div class="sliderR col-xs-3">
<div class="col-xs-12" id="sliderLink">
<nav class="navbar navbar-expand-md">
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="#">Kontakt</a></li>
<li class="nav-item"><a class="nav-link" href="#">Impressum</a></li>
<li class="nav-item"><a class="nav-link" href="#">Datenschutz</a></li>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
My CSS Code:
.header-container {
background-color: #055dae;
padding-top: 35px;
}
.header-inner {
padding-top: 15px;
background-color: #ffffff;
}
.row {
margin-left: -15px;
margin-right: -15px;
}
.header-adresse {
text-align: right;
}
.header-adresse p {
margin: 0;
}
.sliderL {
max-width: 70%;
}
.sliderR {
background-color: #055dae;
max-width: 30%;
float: right;
}
.div#sliderLink.col-xs-12 {
margin: 0;
padding: 0;
}
If you want to mimic how that section (or row) behaves with alignment and responsiveness, this requires bootstrap classes to be applied to both the slider and right side section.
So lets first analyze the behavior. Looking at the site and source, I confirm the following behavior on the 3 main view sizes:
Desktop - slider takes 9 columns, right side takes 3 columns
Tablet - slider takes 8 columns, right side takes 4 columns
Mobile - slider takes 12 columns and right side is hidden
So taking your HTML mark up, you could do something similar to the following which is entirely bootstrap powered:
<div class="row">
<div class="sliderL col-lg-9 col-md-8 col-xs-12">
...
...
</div>
<div class="sliderR col-lg-3 col-md-4 hidden-sm hidden-xs">
...
...
</div>
</div>
I am tring to make a carousel fill all the space in a section. But it is flowing out of the section. I need to position my carousel inside first section.
I am using twitter bootstrap3 and html5.
CSS
#section1 {
height: 500px;
color: #fff;
background-color: #1E88E5;
background-image: url("http://i.stack.imgur.com/2OrtT.jpg");
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 50%;
}
img {
height: 50px;
}
HTML
<body data-spy="scroll" data-target=".navbar" data-offset="50">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Section 1</li>
<li>Section 2</li>
<li>Section 3</li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Section 4 <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Section 4-1</li>
<li>Section 4-2</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav>
---------------------------------------------------------------------------
<div id="section1" class="container-fluid">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="1.jpg" alt="Los Angeles" style=" height=20px ">
<div class="carousel-caption">
<h3>Los Angeles</h3>
<p>LA is always so much fun!</p>
</div>
</div>
<div class="item">
<img src="2.jpg" alt="Chicago">
<div class="carousel-caption">
<h3>Chicago</h3>
<p>Thank you, Chicago!</p>
</div>
</div>
<div class="item">
<img src="3.jpg" alt="New York">
<div class="carousel-caption">
<h3>New York</h3>
<p>We love the Big Apple!</p>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</body>
jsFiddle
first of all if you are dealing with responsiveness then your style will be as following:
#section1 {
min-height: 500px; //according to your background image size
color: #fff;
background-color: #1E88E5; // no need if you are setting background image on whole div
background-image: url("http://i.stack.imgur.com/2OrtT.jpg");
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 50%;
}
img {
height: 50px; // Don't hardcoded the height of image untill you deal with some specific div width.
}
In your case the <div> has class called container-fluid.
In your carousel <div> you have to add your <img> as follow:
<div class="item active">
<img class="img-responsive" src="1.jpg" alt="Los Angeles" style="display:inline-block;">
<div class="carousel-caption">
<h3>Los Angeles</h3>
<p>LA is always so much fun!</p>
</div>
</div>
And to clear this plz provide the snippet of your code to proper understanding.
I am currently trying to create side bar next to my carousel, However for some reason, I can't get the carousel to center on the page while the aside is next to it. I tried using margin:auto auto but had no luck. I also tried using Justify-content:center. Anyone know why it won't move?
html:
<section id="carouselSlides" class="carousel slide container" data-ride="carousel" style="background:#979BAF; ">
<!--Indicators-->
<ol class="carousel-indicators">
<li data-target="#carouselSlides" data-slide-to="0" class="active"></li>
<li data-target="#carouselSlides" data-slide-to="1"></li>
</ol>
<!--The slideshow-->
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block img-fluid" src="slideshow/sunglasses.jpg" alt="sunglasses">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="slideshow/lady.jpeg" alt="women">
</div>
<!--<div class="carousel-item">
<img src="" alt>
</div>-->
<!--Left and right controls-->
<a class="carousel-control-prev" href="#carouselSlides" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#carouselSlides" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</section>
<aside class="rightSideSection container clearfix">
<header style="background: #2A2A36;"><h1 class="bold">Whats popular</h1></header><br>
<ul class="popularList">
<li>example1</li>
<li>example2</li>
<li>example3</li>
</ul>
</aside>
CSS:
#carouselSlides{
display: inline-block;
width: 700px;
justify-content: center;
}
.carousel-inner img{
}
/*right side bar*/
.rightSideSection{
background: #ffffff;
width: 280px;
float: right;
margin-top: 40px;
}
.rightSideSection h1{
font-size: 30px;
}
.popularList li{
margin-left: 20px;
}
maybe this can work for you, to align the carousel to center:
<div style="text-align: center; text-align: -webkit-center;">
<section id="carouselSlides" class="carousel slide container" data-ride="carousel" style="background:#979BAF; ">
<!--Indicators-->
<ol class="carousel-indicators">
<li data-target="#carouselSlides" data-slide-to="0" class="active"></li>
<li data-target="#carouselSlides" data-slide-to="1"></li>
</ol>
<!--The slideshow-->
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block img-fluid" src="slideshow/sunglasses.jpg" alt="sunglasses">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="slideshow/lady.jpeg" alt="women">
</div>
<!--<div class="carousel-item">
<img src="" alt>
</div>-->
<!--Left and right controls-->
<a class="carousel-control-prev" href="#carouselSlides" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#carouselSlides" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</section>
<div>
Here basically the "carouselSlides" is contained in a div
providing the div styles as:
div{
text-align: center;
text-align: -webkit-center;
}
Hello I'm using kind of standard bootstrap code from tutorials and such trying to get my head around bootstrap. However I've searched everywhere and I can't find code that actually solves my problem.
<header>
<!-- Toggler/collapsible Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Navbar links -->
<nav class="navbar navbar-expand-sm bg-dark navbar-dark navbar-default fixed-top">
<div class="container">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact</a>
</li>
</ul>
</div>
</nav>
</header>
<section id="home" class="carousel slide" data-ride="carousel">
<div id="container">
<!-- Indicators -->
<ul class="carousel-indicators">
<li data-target="#home" data-slide-to="0" class="active"></li>
<li data-target="#home" data-slide-to="1"></li>
<li data-target="#home" data-slide-to="2"></li>
</ul>
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="la.jpg" alt="Los Angeles">
<div class="carousel-caption">
<h3>Los Angeles</h3>
<p>We had such a great time in LA!</p>
</div>
</div>
<div class="carousel-item">
<img src="chicago.jpg" alt="Chicago">
<div class="carousel-caption">
<h3>Chicago</h3>
<p>Thank you, Chicago!</p>
</div>
</div>
<div class="carousel-item">
<img src="ny.jpg" alt="New York">
<div class="carousel-caption">
<h3>New York</h3>
<p>We love the Big Apple!</p>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#home" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#home" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</section>
This is a navbar with a standard carousel under.
The problem is I want a sticky navbar that always stays on top.
But as it is now it overlaps the carousel so I would like it to start below the navbar. I've tried adding padding-top and such with no lucky Ive also tried the codes that handle smaller resolution and ended up with big white spaces in between no matter how much padding I added. My navbar seems to be 56px in height.
I'm guessing this is easy if you have soem basic knowledge about Bootstrap.
There is also other questions I mark these with number if you are able to help.
Home link doesnt go all the way to the top. Is there anyway to fix this.
How do you handle so that multiple pages doesnt show up on one page. Is there a way to make f.ex have a min-height of display height?
add this to your css or download bootstrap.min.css from https://bootswatch.com/
1. for sticky navbar
.fixed-top {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 1030;
}
2.
<header id="top">
<a class="nav-link" href="#top">Home</a>
#navbar {
overflow: hidden;
background-color: #333;
}
#navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px;
text-decoration: none;
}
.content {
padding: 16px;
}
.sticky {
position: fixed;
top: 0;
width: 100%
}
.sticky + .content {
padding-top: 60px;
}
add new class in section for identification not-navbar
<section id="home" class="carousel slide not-navbar" data-ride="carousel"> </section>
add CSS for not-navbar class, default height Bootstrap navbar is 50px (without padding) and 70px (with padding). translateY(56px) because your navbar height is 56px.
.not-navbar {
transform: translateY(56px);
}
So, your content will be exactly below navbar, without overlap with your top content.