I have this code:
.navbar-default .navbar-nav>li>a {
width: auto;
/* width: 200px;*/
/* font-weight: bold;*/
}
.mega-dropdown {
position: static !important;
/* width: 100%;*/
}
.mega-dropdown-menu {
padding: 0px;
width: 100%;
box-shadow: none;
-webkit-box-shadow: none;
}
.mega-dropdown-menu > li > ul {
padding: 0;
margin: 0;
}
.mega-dropdown-menu > li > ul > li {
list-style: none;
}
.mega-dropdown-menu > li > ul > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: 300;
line-height: 1.428571429;
color: #243C78;
white-space: normal;
}
.mega-dropdown-menu .dropdown-header {
color: #243C78;
font-size: 18px;
font-weight: 500;
}
.mega-dropdown-menu form {
margin: 3px 20px;
}
.mega-dropdown-menu .form-group {
margin-bottom: 3px;
}
<section class="indexTop">
<div class="container">
<div class="row indexTopPadding">
<div class="col-xs-8 col-sm-12 col-md-12 col-lg-11 ">
<div class="topData">Poniedziałek, 11 października 2019</div>
</div>
<div class="col-xs-4 col-sm-12 col-md-12 col-lg-1">
<div class="topKontrast">
<img src="images/ikon2.png" class="img-responsive topIkonLeft topIkonLeft5">
<img src="images/ikon1.png" class="img-responsive topIkonLeft topIkonLeft5">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-3 topMargin15 visible-xs">
<div class="topSocialMedia">
<img src="images/ikon7.png" class="img-responsive topIkonLeft topIkonLeft10 ikonSocialMediaR">
<img src="images/ikon3.png" class="img-responsive topIkonLeft topIkonLeft10 ikonSocialMediaR">
<img src="images/ikon4.png" class="img-responsive topIkonLeft topIkonLeft10 ikonSocialMediaR">
<img src="images/ikon5.png" class="img-responsive topIkonLeft topIkonLeft10 ikonSocialMediaR">
<img src="images/ikon6.png" class="img-responsive topIkonLeft topIkonLeft10 ikonSocialMediaR">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-5 topMargin30R ">
<div class="logo">
<img src="images/logo.png" class="img-responsive ikonCenterR">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-4 topMargin10 hidden-xs">
<form method="post" name="contactformXX" class="form validate clearfix validate-form">
<div class="form-group ">
<div class="form-group has-feedback ">
<input type="text" class="form-control indexInputSzukaj" id="inputValidation" placeholder="Znajdź" /> <span class="glyphicon glyphicon-search form-control-feedback glyphiconColor"></span> </div>
</div>
</form>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-3 topMargin15 hidden-xs">
<div class="topSocialMedia">
<img src="images/ikon7.png" class="img-responsive topIkonLeft topIkonLeft10">
<img src="images/ikon3.png" class="img-responsive topIkonLeft topIkonLeft10">
<img src="images/ikon4.png" class="img-responsive topIkonLeft topIkonLeft10">
<img src="images/ikon5.png" class="img-responsive topIkonLeft topIkonLeft10">
<img src="images/ikon6.png" class="img-responsive topIkonLeft topIkonLeft10">
</div>
</div>
</div>
</div>
</section>
<!-- END TOP-->
<!-- MENU-->
<div class="paddingMenuTop"></div>
<nav class="navbar navbar-default navbarDefaultMop ">
<div class="container">
<!-- navbar-fixed-top -->
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".js-navbar-collapse"> <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 visible-xs" href="#">MegaMenu</a></div>
<div class="collapse navbar-collapse js-navbar-collapse">
<ul class="nav navbar-nav">
<li class="dropdown mega-dropdown menuMop"> Item xxx1
<ul class="dropdown-menu mega-dropdown-menu row dropdownMenuMop">
<div class="container topMenuColor">
<li class="col-sm-3">
<ul class="hideBullet">
<li class="dropdown-header hideBullet">Sprawy </li>
<li>pozycja 1</li>
<li>pozycja 2</li>
<li>pozycja 3</li>
<li>pozycja 4</li>
<li>pozycja 5</li>
<li class="dividerMop"></li>
<li class="dropdown-header hideBullet">pozycje 5</li>
<li>Bezpłatana imnformaja</li>
<li>dream</li>
<li>Callendar</li>
<li>Archiwum Mewspow</li>
</ul>
</li>
<li class="col-sm-3">
<ul class="hideBullet">
<li class="dropdown-header hideBullet">My life </li>
<li>Health</li>
<li>Bicycles</li>
<li>Cars</li>
<li>Education</li>
<li>Cash</li>
<li class="dividerMop"></li>
<li class="dropdown-header hideBullet">Fundation</li>
<li>xdcsdcsd cdscdscds</li>
<li>Magazine</li>
<li>Items</li>
<li>Items2</li>
</ul>
</li>
<li class="col-sm-3">
<ul class="hideBullet">
<li class="dropdown-header hideBullet">My life </li>
<li>Health</li>
<li>Bicycles</li>
<li>Cars</li>
<li>Education</li>
<li>Cash</li>
<li class="dividerMop"></li>
<li class="dropdown-header hideBullet">Fundation</li>
<li>xdcsdcsd cdscdscds</li>
<li>Magazine</li>
<li>Items</li>
<li>Items2</li>
</ul>
</li>
<li class="col-sm-3">
<ul>
<li class="dropdown-header">Accessories</li>
<li>Default Navbar</li>
<li>Lovely Fonts</li>
<li>Responsive Dropdown </li>
<li class="dividerMop"></li>
<li class="dropdown-header">Newsletter</li>
<form class="form" role="form">
<div class="form-group">
<label class="sr-only" for="email">Email address</label>
<input type="email" class="form-control" id="email" placeholder="Enter email"> </div>
<button type="submit" class="btn btn-primary btn-block">Sign in</button>
</form>
<li class="dropdown-header">zamknij mnie2
<button type="button" class="close">×</button>
</li>
</ul>
</li>
</div>
</ul>
</li>
</ul>
</div>
<!-- /.nav-collapse -->
</div>
</nav>
I have a problem with the menu (NAVBAR).
I would like it to descend with scrolling the page down (stuck to the top of the browser).
The effect that I would like to get is here: https://www.gdynia.pl
Dla mieszkańców, aktualności, dla turystów, o Gdyni,
Does anyone know how to improve my code to get this effect?
Prview: http://serwer1356363.home.pl/pub/menu_fixed/
You can add to .navbar some other class with style like this: position: fixed; top:0; and replace position:relative with position:fixed;.
- Add this class only after you scroll down some pixels.
- If you not scrolled some pixels use remove or don't add class.
- Use Javascript or JQuery to detect how many user already scrolled pixels and also to add or remove element class.
I think everything is clear here. I just opened your site and used chrome dev tools to see applied effects. Just play with code and styles. After apply changes in real code.
You can look more here: set div position to fixed after scrolling 100px?
Related
I am just learning how to use css and bootstrap to create an website based on a psd template, problem is that i cant keep my search box inside the container and it stays in the bottom of it.
Here is my code
.search-area {
margin-top: 3px;
text-align: right;
}
.search-area input {
background: #333333;
color: #ffffff;
border: 0px solid;
}
<body>
<div id="header-area1">
<div class="container">
<div class="top-header col-12 bg-succes">
<div class="left-header col-8">
<div class="feed-area">
<ul>
<li> Sign Up</li>
<li> Login</li>
<li> Rss Feed</li>
<li id="last"> Archived News</li>
</ul>
</div>
<div class="right-header col-4">
<div class="search-area">
<form action="">
<input type="textplaceholder=" Search...">
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
I rewrote your code to fix it. do not forget to user "row" class out of your columns in bootstrap
<div id="header-area1">
<div class="container">
<div class="top-header col-12 bg-succes">
<div class="row">
<div class="left-header col-8">
<div class="feed-area">
<ul>
<li> Sign Up</li>
<li> Login</li>
<li> Rss Feed</li>
<li id="last"> Archived News</li>
</ul>
</div>
</div>
<div class="right-header col-4">
<div class="search-area">
<form action="">
<input type="textplaceholder=" Search...">
</form>
</div>
</div>
</div>
</div>
</div>
</div>
Update my answer missing of row before col
.search-area {
margin-top: 3px;
text-align: right;
}
.search-area input {
background: #333333;
color: #ffffff;
border: 0px solid;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<body>
<div id="header-area1">
<div class="container">
<div class="top-header row bg-succes">
<div class=" col-8">
<div class="feed-area">
<ul>
<li> Sign Up</li>
<li> Login</li>
<li> Rss Feed</li>
<li id="last"> Archived News</li>
</ul>
</div>
</div>
<div class=" col-4">
<div class="search-area">
<form action="">
<input type="text" placeholder=" Search...">
</form>
</div>
</div>
</div>
</div>
</div>
</body>
Use this HTML structure for right align to searchbox.
Add col-6 with feed-area class. And instead os this <div class="left-header col-8"> use this <div class="left-header row">
<div id="header-area1">
<div class="container">
<div class="row">
<div class="top-header col-12 bg-succes">
<div class="left-header row">
<div class="feed-area col-6">
<ul>
<li>
Sign Up
</li>
<li>
Login
</li>
<li>
Rss Feed
</li>
<li id="last">
Archived News
</li>
</ul>
</div>
<div class="right-header col-4">
<div class="search-area">
<form action="">
<input type="textplaceholder=">
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
.search-area {
margin-top: 3px;
text-align: right;
}
.search-area input {
background: #333333;
color: #ffffff;
border: 0px solid;
}
I am creating a landing page. I am adding a dropdown when user click on button on top bar (on mobile view). but I want the dropdown to be relative to other divs when active (toggled on). when the user clicks on button, the dropdown should be visible as a div and all divs on bottom should go downward according to the dropdown height.
Here is the code I am working on:
.top_menu {
height: 70px;
height: 70px;
font-weight: 600;
font-size: 20px;
padding: 10px 0;
}
.top-nav-form {
width: 100%;
height: auto;
background: #ffffff;
position: absolute;
top: 0px;
left: 0px;
padding: 10px 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row top_menu">
<div class="col-md-2 col-sm-2 top-menu-title">
the page title
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#top-form">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- this is the div of which i am talking about -->
<div id="top-bar" class="col-md-10 col-sm-10">
<div id="top-form" class="collapse navbar-collapse top-nav-form">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#top-form"><label class="toggle" for="nav-toggle"></label></button>
<form class="page-form">
<div class="row">
<div class="col-md-1 col-sm-1">
<label class="radio-inline"><input type="radio" name="optradio">Option 1</label>
</div>
<div class="col-md-1 col-sm-1">
<label class="radio-inline"><input type="radio" name="optradio">Option 2</label>
</div>
<div class="col-md-4 col-sm-4">
<input type="text" placeholder="Enter in a keyword or phrase">
</div>
<div class="col-md-2 col-sm-2">
<div id="dropdown-outer-div" class="" data-toggle="collapse" data-target="#list-item">
<span>Collapsible</span>
<div id="list-item" class="collapse dropdown-list collapse">
<ul>
<li>Web</li>
<li>Image</li>
<li>Shopping</li>
<li>Youtube</li>
<li>News</li>
</ul>
</div>
</div>
</div>
<div class="col-md-2 col-sm-2">
<div id="language-dropdown-outer-div" class="" data-toggle="collapse" data-target="#list-item-language">
<span>Collapsible</span>
<div id="list-item-language" class="collapse language-dropdown-list collapse">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
</div>
</div>
<div class="col-md-2 col-sm-2">
<input type="submit" value="Look up">
</div>
</div>
</form>
</div>
</div>
</div>
Using Bootstrap 4, I'm having difficulty targetting the list items on hover. I'm trying to have a default color of the text to a gray, but on hover, make the text a regular black, and on active, have the text white, bolded, with a background color for the different states of the list items.
Here's what it looks like now:
Here is my HTML:
<div class="container mt-5">
<div class="row">
<div class="col-sm-4">
<div class="card">
<div class="card-header">
<h4 class="card-title">
<img src="resources/icons/icon-monster/iconmonstr-gear-11-48.png" alt="" class="mr-2">
Account Settings
</h4>
</div>
<div class="card-body">
<ul class="list-group list-group-flush">
<li class="list-group-item active">About You</li>
<li class="list-group-item">Education and background</li>
<li class="list-group-item">Professional Development</li>
<li class="list-group-item">Password</li>
<li class="list-group-item">Email/Notifications</li>
<li class="list-group-item">Reviews</li>
<li class="list-group-item">Privacy Settings</li>
</ul>
</div>
</div>
</div><!--end of col-sm-4-->
Here is my CSS:
/*----------------------------------------*/
/*--------SIDEBAR ACCOUNT SETTINGS---------*/
/*-----------------------------------------*/
.list-group-item.active {
background-color: #328cc1;
border-color: #328cc1;
font-weight: bold;
color: #fff;
}
.list-group-item {
color: gray;
}
.list-group-item: hover {
color: black;
}
Everything works great except the list item isn't capturing the change on hover. I've tried targetting it by ul li .list-group-item: hover and that doesn't work either.
There's a space between : and hover. That was the problem with it.
.list-group-item.active {
background-color: #328cc1;
border-color: #328cc1;
font-weight: bold;
color: #fff;
}
.list-group-item {
color: gray;
}
.list-group-item:hover {
color: black;
}
<div class="container mt-5">
<div class="row">
<div class="col-sm-4">
<div class="card">
<div class="card-header">
<h4 class="card-title">
<img src="resources/icons/icon-monster/iconmonstr-gear-11-48.png" alt="" class="mr-2"> Account Settings
</h4>
</div>
<div class="card-body">
<ul class="list-group list-group-flush">
<li class="list-group-item active">About You</li>
<li class="list-group-item">Education and background</li>
<li class="list-group-item">Professional Development</li>
<li class="list-group-item">Password</li>
<li class="list-group-item">Email/Notifications</li>
<li class="list-group-item">Reviews</li>
<li class="list-group-item">Privacy Settings</li>
</ul>
</div>
</div>
</div>
<!--end of col-sm-4-->
I have a basic thumbnail display using bootstrap. I want to have 3 images in a row and go down to 2 images when making the page smaller. I had this worked out until I added a margin-right to add some space in between thumbnails. Once I did this it pushed that third image down to the next line. I tried playing around with the padding and margin and I just cant get that third thumbnail to stay on the same line. I also tried changing it to col-sm-3 and that did not seem to work either.
HTML:
<div class="work">
<ul>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
</ul>
</div>
CSS:
.work {
padding: 0px 40px 0px 0px;
max-width: 100%;
}
.thumbnail {
margin-right: 10px;
}
I'm not 100% if this what you mean, but here it goes:
HTML
<div class="work">
<ul>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
<li class="thumbnail col-sm-4 col-xs-6"><img src="thumbnails.png"/></li>
</ul>
</div>
CSS
.thumbnail {
border:0;
}
.thumbnail a{
display:block;
padding:10px;
background:red;
}
.thumbnail img{
width:100%;
}
https://jsfiddle.net/ax7wcLo4/2
If you really want to separate the li elements, you should do that without bootstrap's default grid system.
<ul class="list-unstyled list-inline">
Use class .list-inline on th eul element and set the below css for them;
ul {
margin: 0;
padding: 0;
width: 100%
}
li {
width: calc(100% - 10px);
margin: 0 5px;
}
Be Aware: calc has some compatibility issues based on your browser support range.
Can I Use Link for CALC
You should put the thumbnail inside of a column, not combined. If you need this inside a list it can be change to that as well > See Default Bootstrap Example.
See working Snippet at Full Page.
body,
html {
padding-top: 50px;
}
.row.no-list-style {
list-style: none;
margin-left: -55px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<h3>Default</h3>
<div class="row">
<div class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/f00" />
</a>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/000" />
</a>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/f00" />
</a>
</div>
</div>
</div>
</div>
<hr>
<div class="container">
<h3>Inside a List</h3>
<ul class="row no-list-style">
<li class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/ff0" />
</a>
</div>
</li>
<li class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/000" />
</a>
</div>
</li>
<li class="col-sm-4 col-xs-6">
<div class="thumbnail">
<a href="#honey">
<img src="http://placehold.it/350x350/ff0" />
</a>
</div>
</li>
</ul>
</div>
Which class i need to use for tabbed panel? Is there one?
i do the following and looks bad :-(
A tabbed navigation + a panel with and 0 padding between them-
<div id="dashboardheader" class="container" style="padding-top: 20px;">
<ul class="nav nav-tabs tab-pane">
<li class="active">Dashboard</li>
</ul>
</div>
<div id="dashboardpanel " style="padding-top: 0px">
<div class="panel panel-primary container" style="padding-top: 30px;">
<div class="row">
<div class="col-md-offset-2 col-md-8 col-md-offset-2">
<div class="row">
<img src="..\..\Content/Images/Dashboard/fgh.png" class="btn btn-lg" role="button" onclick="OpenDialog()" />
<img src="..\..\Content/Images/Dashboard/fgh.png" class="btn btn-lg" role="button" />
<img src="..\..\Content/Images/Dashboard/fgh.png" class="btn btn-lg" role="button" />
<img src="..\..\Content/Images/Dashboard/fgh.png" class="btn btn-lg" role="button" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-offset-2 col-md-8 col-md-offset-2">
<div class="row">
<img src="..\..\Content/Images/Dashboard/fgh.png" class="btn btn-lg" role="button" />
<img src="..\..\Content/Images/Dashboard/fgh.png" class="btn btn-lg" role="button" />
<img src="..\..\Content/Images/Dashboard/fgh.png" class="btn btn-lg" role="button" />
</div>
</div>
</div>
</div>
</div>
whats the alternate?
I think what you want is just the regular bootstrap tabs
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="active">Home</li>
<li>Profile</li>
<li>Messages</li>
<li>Settings</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="home">...</div>
<div class="tab-pane" id="profile">...</div>
<div class="tab-pane" id="messages">...</div>
<div class="tab-pane" id="settings">...</div>
</div>
Demo in jsFiddle
With a little bit of styling, you can get it to look how you want:
For V4, you'll want to style with the .nav-tabs class and also invoke the tab JavaScript plugin
Here's some simple less you can add that allows you to include .nav.nav-tabs inside a .panel .panel-heading
An example codepen : http://codepen.io/anon/pen/utGaK
IMHO it doesn't quite look as "clean" as the components are when used independently w/o additional styles..
I've tested it with .panel-title too using .pull-right on the .nav. While it worked I found it best to add .clearfix to the header as the tabs are 1/2px too tall ATM. Should be simple to resolve it.
Here's the code I use in the above example.
For example :
<div class="panel panel-default">
<div class="panel-heading">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="active">Home</li>
<li>Profile</li>
<li>Messages</li>
<li>Settings</li>
</ul>
</div>
<!-- Tab panes + Panel body -->
<div class="panel-body tab-content">
<div class="tab-pane active" id="home">HOME</div>
<div class="tab-pane" id="profile">PROFILE</div>
<div class="tab-pane" id="messages">MESSAGES</div>
<div class="tab-pane" id="settings">SET</div>
</div>
</div>
This is the less :
// Need to compensatve for padding in panel-heading
// Must be a way to invert this
// variable - #panel-heading-padding.
#panel-heading-padding-negate: -10px -15px;
.panel {
.panel-heading {
.nav-tabs {
margin:#panel-heading-padding-negate;
border-bottom-width:0;
> li {
> a {
// re-apply the original padding
padding:#panel-heading-padding;
margin-bottom:1px;
border:solid 0 transparent;
&:hover {
border-color: transparent;
}
}
&.active > a {
&,
&:hover,
&:focused {
border:solid 0 transparent;
}
}
}
}
}
}
UPDATE
I've added the following to the li definition and removed the margin-right & border-radius on the > li > a so that when I pull the nav to the right of the header it fits & looks cleaner.
&:first-child > a {
border-top-left-radius:#panel-border-radius;
}
&:last-child > a {
border-top-right-radius:#panel-border-radius;
}
Here's an updated codepen : http://codepen.io/anon/pen/hJsEC
There's a Bootsnipp snippet that does this: http://bootsnipp.com/snippets/MaA0A
It contains CSS to allow embedding tabs in the panel header like this:
<div class="panel with-nav-tabs panel-default">
<div class="panel-heading">
<ul class="nav nav-tabs">
<!--...-->
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<!--...-->
</div>
</div>
</div>
Result:
Found a simple styling solution based on Andrew Scott's html structure:
.panel-heading>.nav-tabs {
border-bottom: none;
margin-bottom: -10px;
}
<ul class="nav nav-tabs ">
<li class="active" > One </li>
<li > Two <li>
</ul>
<div class="tab-content clearfix">
<div class="tab-pane fade in active" id="One">
This is one
</div>
<div class="tab-pane fade " id="Two">
This is Two
</div>
</div>