I tried to several ways to make the code below work. Now there is only one issue left and that the top-bar-title (Site Title) is having a white background when the user scrolls vertical up to the top when it should stay grey the color of the topbar. Does anybody know what is wrong?
<div data-sticky-container>
<div id="widemenu" class="top-bar" data-sticky data-options="marginTop:0;" style="width:100%">
<div class="top-bar-title menu-text">Site Title</div>
<div class="top-bar-right">
<ul class="dropdown menu" data-dropdown-menu>
<li>Item 1</li>
<li>Item 1</li>
/ul>
</div>
</div>
</div>
Style your widemenu div in order to keep it from being overwritten by scrolling upward. Here is your menu div with the height added. You could also add that style in your css file.
<div id="widemenu" class="top-bar" data-sticky data-options="marginTop:0;" style="width:100%;height:50px;">
Good luck!
Related
I have a menu and I want to have a vertical divider between Item 2 and Item 3. But Im not having success doing this because the divider is not occupying the full height of the menu and the menu items are not staying vertical aligned with the divider.
Also if you know how to have the logo aligned vertically with the menu items it would be nice because it is also not staying, the menu it's a bit more above the logo.
Menu html:
<header class="header container">
<div class="content">
<h1 class="main_logo fl-left">LOGO</h1>
<ul class="nav fl-right">
<li>Item 1</li>
<li>Item 2</li>
<li class="separator"></li>
<li>Item 3</li>
<li><a class="btn" href="">Item 4</a></li>
</ul>
<div class="clear"></div>
</div>
</header>
<div class="container">
<section class="section">Test</section>
</div>
The working example is here: https://jsfiddle.net/5rjdofu7/
You need a line-height to align the stuffs. So, adding the following CSS will make the logo and <ul> align middle vertically. Also, you have too much padding, which if you don't need, you have to get rid of.
h1, ul {
line-height: 100px;
}
Preview
If this is what you are expecting:
I am using wt-rotator carousel plugin with bootstrap. I have to place a menu on top of the carousel on the top left, in a fixed position. The menu should stay there even as the images fade in and fade out. Is there a way to do it using CSS?
Edit: added the code below.
So far just this code below. it is a bootstrap jumbotron, which has a wt-rotator carousel inside. On top of this carousel, I have to put a menu.
<div class="jumbotron">
<div class="container">
<div id="banner-container">
<div class="wt-rotator">
<div class="c-panel">
<div class="thumbnails">
<ul>
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
</ul>
</div>
<div class="buttons">
<div class="prev-btn"></div>
<div class="play-btn"></div>
<div class="next-btn"></div>
</div>
</div>
</div>
</div>
</div>
You can use a outside div with position absolute and z-index superior to the slider, and put that div on front of the slider.
I am new Bootstrap and have been trying to get my head around documentation but finding it a bit confusing.
My page has three blocks: a main header, a side navigation, and a main content.
I could easily do a layout with CSS but I am using Bootstrap and wanted to use this to do a responsive layout.
On a regular screen I would like it to be as follows (where header takes full width):
[HEADER]
[NAV][MAIN]
Then on a small screen:
[HEADER]
[NAV]
[MAIN]
But on a smallscreen I would like nav to be collapsed. My nav is "nav nav-list bs-docs-sidenav" and I am not sure how to get that effect with this.
Thanks very much for any help.
Here is the html. Not that it gives you much more info.
<body>
<header>
<h1>title</h1>
</header>
<nav>
<ul id="nav" class="nav nav-list bs-docs-sidenav" >
<li><a class="parent">item 1</a>
<ul class="bs-docs-sidenav" style="display:none;">
<li>
<a href="#">
subitem 1
</a>
</li>
</ul>
</li>
<li>item 2</li>
</ul>
</nav>
<main class="content">
<p>content</p>
</main>
</body>
The answer is to use col--
This tells you how many columns the block should take up on different size screens.
Still would like the menu box to shrink into 1 item on a small screen, but this is good enough.
<header class="row col-xs-12">
</header>
<nav class="row col-xs-12 col-sm-4 ">
</nav>
<main class="row col-xs-12 col-sm-8">
</main>
I'm using bootstrap and I need to implement a list of items to be displayed over many columns.
Bootstrap uses a grid that is 12 cells wide.
My item being 3 cells wide (that's how I roll), it means that a row holds only 4 items.
item 1 | item 2 | item 3 | item 4
item 5
My item is not a simple text but a "card" :
The code can be found there.
The straightforward way to write this would be:
<div class="row">
<div class="col-md-3">[item 1]</div>
<div class="col-md-3">[item 2]</div>
<div class="col-md-3">[item 3]</div>
<div class="col-md-3">[item 4]</div>
</div>
<div class="row">
<div class="col-md-3">[item 5]</div>
</div>
But it feels non semantic.
The fact that my items are displayed on many rows is truly pertaining to presentation choices.
Besides, if I now decide that my items should be wider, I have to change the structure of my document (as opposed to class attributes).
Besides that way of doing things is even more artificial on a mobile screen were all my items are displayed on top of each other.
Is there another way to write my list? A more 'semantic' way ?
From my stand, the best way to display an Unordered LIST with hypertext markup is :
<ul>
<li>
So, you can try a list of ul>li setting your <li> width to 25%, float-left.
Your 5th element is supposed to stack bottom left.
If you still want to use bootstrap grid system, just put your 'items' inside the same row.
<div class="row">
<div class="col-md-3">item 1</div>
<div class="col-md-3">item 2</div>
<div class="col-md-3">item 3</div>
<div class="col-md-3">item 4</div>
<div class="col-md-3">item 5</div>
<div class="col-md-3">item 6</div>
<div class="col-md-3">item 7</div>
</div>
The overflowed elements will be stack bottom left.
So give it a try:
<ul class="row">
<li class="col-md-3">item 1</li>
You could use a UL list..
<ul class="list-unstyled">
<li class="col-md-3">item 1</li>
<li class="col-md-3">item 2</li>
<li class="col-md-3">item 3</li>
<li class="col-md-3">item 4</li>
<li class="col-md-3">item 5</li>
<li class="col-md-3">item 6</li>
<li class="col-md-3">item 7</li>
</ul>
Demo: http://bootply.com/91825
However, you'd need to change this markup if you decide to make things wider.
1.You can always change the default 12 space grid to whatever you prefer by setting #gridColumns to your preference in this page or overriding the css.less if you prefer.
2.With Bootstrap you can use the custom class inline to build your list:
<ul class="inline">
<li>...</li>
</ul>
3.But as Milche refered col-md-3 will do the trick if you stick to one row. I think I would use a tag though, to make clear it's inline.
I'm working on a jQuery mobile app and was wondering if anyone could help with button alignment within a list divider. Here is a link to a jsFiddle I created showing the button next to the text. I was wondering if it was possible to align the button to the right. I've tried adding a div around the button with a style of style="text-align: right;", but that pushes the button down like this, which I don't want.
Is there anyway to keep the text and the button on the same line, with the button aligned to the right? Any help is appreciated.
you could do it by using a 2 column layout grid, see jsfiddle
code:
<div data-role="page" id="p1">
<div data-role="header"><h1>Header Page 1</h1></div>
<div data-role="content">
<ul data-role="listview" data-inset="true" data-divider-theme="a">
<li data-role="list-divider">
<div class="ui-bar ui-grid-a">
<div class="ui-block-a" style="margin-top:10px;">List Header</div>
<div class="ui-block-b" style="text-align:right;">Add</div>
</div>
</li>
<li>List item 1</li>
</ul>
</div>
<div data-role="footer"><h4>Footer</h4></div>
</div>
screenhsot: