I am using bootstrap with flask to build a web app. my code is as follows:
<div class="container col-xs-12">
<div class="jumbotron" style="background:url({{ url_for('static', filename='jumbotron-grass-bw.png') }});
background-size:cover;">
<h2><strong>Even we are ordinary, we can live better!</strong></h2>
<p style="color:#333333">I make PERSONAL server by which we can share information without control from those "big" and reach the real FREEDOM.</p>
<p> </p>
</div>
<ul class="nav nav-pills nav-stacked col-xs-2">
<li class="active">Personal</li>
<li>Circle1</li>
<li>Circle2</li>
<li>Circle3</li>
</ul>
<div class="tab-content col-xs-10">
<div class="tab-pane active" id="tab1">
<p>Tab 1 content goes here...abcdektessseedddddddddddddd here..ahaha!</p>
</div>
<div class="tab-pane" id="tab2">
<p>Tab 2 content goes here...</p>
</div>
<div class="tab-pane" id="tab3">
<p>Tab 3 content goes here...</p>
</div>
<div class="tab-pane" id="tab4">
<p>Tab 4 content goes here...</p>
</div>
</div>
</div>
I am using IPHONE6 as the test device to verify the display effect on a very small screen, and I get the following result:
There is NO problem on larger screen resolution.
So is there a bug for bootstrap display on very small screen or I did a wrong coding?
Thanks!
Well there are several things you could do:
Adjust your code. Even though your col formation is correct, it doesn't seem to suit your best interest in the designing of this particular web page. Try changing it so the tab menu is a bit wider with lets say col-xs-4 instead of col-xs-2 as you previously did. This way when you resize down to an iPhone 6, your problem should be fixed. The example code is down below:
<ul class="nav nav-pills nav-stacked col-xs-4">
<li class="active">Personal</li>
<li>Circle1</li>
<li>Circle2</li>
<li>Circle3</li>
</ul>
<div class="tab-content col-xs-8">
<div class="tab-pane active" id="tab1">
<p>Tab 1 content goes here...abcdektessseedddddddddddddd here..ahaha!</p>
</div>
<div class="tab-pane" id="tab2">
<p>Tab 2 content goes here...</p>
</div>
<div class="tab-pane" id="tab3">
<p>Tab 3 content goes here...</p>
</div>
<div class="tab-pane" id="tab4">
<p>Tab 4 content goes here...</p>
</div>
</div>
You could try and change the ratio again so it suits you better, until you've met your required criteria.
Use media queries. If you are still having issues, try using media queries in order to style the mobile version to your liking. This way you can specify the screen width and height in your code. W3S Media Queries
Here is a JS Fiddle with my solution on point 1.
Solution regarding point 1
Related
I want to use one tab navigation to control 2 tab-content blocks using foundation 6. At the moment my first tab-content blocks works as it should the second does not. When I click the second tab it adds the contents of the second tab to the bottom of the first in the second tab-content container and doesn't remove it.
<div class="cell medium-6 text-padding">
<ul class="tabs" data-tabs id="floorplan">
<li class="tabs-title is-active">Ground Floor</li>
<li class="tabs-title">First floor</li>
</ul>
<div class="tabs-content" data-tabs-content="floorplan">
<div class="tabs-panel is-active" id="ground">
<p>Tab 1</p>
</div>
<div class="tabs-panel" id="first">
<p>Tab 2</p>
</div>
</div>
</div>
<div class="cell medium-6">
<div class="tabs-content" data-tabs-content="floorplan">
<div class="tabs-panel is-active" id="ground">
<p>Tab 1</p>
</div>
<div class="tabs-panel" id="first">
<p>Tab 2</p>
</div>
</div>
</div>
</div>
</section>
The Tab Content uses id's so you can't get away with using two sets of tab content with the same id's.
If you have to control the tabs from one set of buttons, then you might switch to data-attributes and use the custom methods to trigger a tab change. https://foundation.zurb.com/sites/docs/tabs.html#js-functions
I've been asked by a friend to create a website.
I've used bootstrap 3 as a framework for the website and have hit a bit of a stumbling block.
My friend wanted a tabbed section where the background image of the section changes depending on which tab is active. I've been able to make it work for just the tab-pane using css, but I need to be able to change the entire section background and not just the tab pane.
I think it will require some JavaScript, but unfortunately my skills in that area a still a bit too weak to know how to do this, and google has been about as helpful as a hole in the head.
below is the section of html that i need the background image to change with each tab
<section id="about" class="content-section text-center">
<div class="row">
<div class="tab-content vertical-center">
<div id="aboutus" class="tab-pane fade in active">
<h2>...</h2>
<p>...</p>
</div>
<div id="history" class="tab-pane fade">
<h2>...</h2>
<p>...</p>
</div>
<div id="chef" class="tab-pane fade">
<h2>...</h2>
<p>...</p>
</div>
</div>
</div>
</section>
<div class="row">
<div class="col-lg-12 nav-pills-bg">
<ul class="nav nav-pills nav-justified">
<li class="active">
<a data-toggle="pill" href="#aboutus">...</a>
</li>
<li>
<a data-toggle="pill" href="#history">...</a>
</li>
<li>
<a data-toggle="pill" href="#chef">...</a>
</li>
</ul>
</div>
</div>
Any help is appreciated
Put your separate css background images on these:
#aboutus {
background-image:.....
}
#history {
background-image:.....
}
#chef {
background-image:.....
}
I checked your code, all works fine and if you want change only contents background, Carol McKay wrote what you have to add in your code. You don't need in this case any javascript code.
I created small example with your code and bootsrap classes: jsfiddle-link
All gaps you can see depends bootstrap classes, for example, by default class .alert has:
.alert {
padding: 15px;
margin-bottom: 20px;
...
}
And one more example with content below pills and looks more familiar): jsfiddle-link2
i'm using bootstrap tab and i want to divide this tab with bootstrap grid system but because of the float:left; , tabs background not showing.
here is my code;
<div role="tabpanel" class="tab-pane fade in active" id="home">
<div class="col-lg-6">
<h3>Categories</h3>
</div>
<div class="col-lg-6" >
<h3>Datasets</h3>
</div>
</div>
if i don't add this col-lg-6 classes it is working properly , thank you for your suggestions
Fixed Code; (just added row class before grid classes)
<div role="tabpanel" class="tab-pane fade in active" id="home">
<div class="row">
<div class="col-lg-6">
<h3>Categories</h3>
</div>
<div class="col-lg-6" >
<h3>Datasets</h3>
</div>
</div>
</div>
I'm guessing at what the actual problem is, but you almost always want to wrap columns in a row element.
<div class="row">
<div class="col-xs-6">
<h3>Categories</h3>
</div>
<div class="col-xs-6">
<h3>Datasets</h3>
</div>
</div>
Demo
The row element forces the tab element to clear the floated columns. If you already have a row element outside the tab panes, either move it inside or add a full-width column outside and a row inside.
Fiddle updated with tab color.
I have a website that is using tabs to switch between different content. In that content I have a box of design elements. What I would like to happen though is for that box to stay constant within all the tabs without repeating the html for it six or seven times. Is this possible?
<ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
<li class="active">Cover Design</li>
<li>Video Trailers</li>
<li>Web Banner</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="design">
<h2>Design Elements</h2>
<ul>
<li>This is the content that need to be static</li>
<li>Skill: I'm skilled!</li>
<li>Skill: I'm skilled!</li>
<li>Skill: I'm skilled!</li>
</ul>
<p>Content that needs to be switched between tabs</p>
</div>
</div>
Any help would be wonderful. I only placed one of my tabs above to show an example, If I posted them all then it would be too long to read.
This is how you can accomplish this... bring your static content out of the .tab-pane div but still under the .tab-content div. Live Example
<div class="tab-content">
<h2>Design Elements</h2>
<ul>
<li>This is the content that need to be static</li>
<li>Skill: I'm skilled!</li>
<li>Skill: I'm skilled!</li>
<li>Skill: I'm skilled!</li>
</ul>
<div class="tab-pane active" id="design">
<p>Content that needs to be switched between tabs 1</p>
</div>
<div class="tab-pane" id="video">
<p>Content that needs to be switched between tabs 2</p>
</div>
<div class="tab-pane" id="web">
<p>Content that needs to be switched between tabs 3</p>
</div>
</div>
Hi guys im making a website with Bootstrap and CodeIgniter, now im designing the news page with 2 side nav-list and I have a problem.
When I put a long text on the nav-list, the text comes out. Please help me.
<div class="container-fluid">
<div class="row-fluid">
<div class="span2"></div>
<div class="span8"></div>
<div class="span2">
<ul class="nav nav-list well">
<div class="row-fluid">
<li class="nav-header">Suggested Users</li>
<li class="span12">
<div class="span4">
<img src="http://i.imgur.com/0YJjVnH.gif" alt="User suggested">
</div>
<div class="span8">
Aezir ssssssssssssssssssssssssssssss
<button class="btn btn-mini btn-info pull-right">Follow</button>
<br>
<strong><small class="pull-right" style="font-size: 9px;">1024 followers</small></strong>
</div>
</li>
</div>
</ul>
</div>
</div>
</div>
The problem here is the length of the word overflowing the container, you can somewhat fix this by adding something like word-wrap: break-word; to that a tag to break the text that overflows out of the container but what I would suggest is to just add enough room for long words around that space. That way you won't have to force the words to break into a new line.