Zurb foundation accordion CSS breakpoint - css

I need help figuring out the breakpoint in my zurb foundation code. What the code does it adds both tabs and accordion. Tabs for big screens and accordion view for phones and tablets. However I have yet to figure out how I change the breakpoint(meaning the size where it hides the tab and show the accordion instead).
This is the foundation css file ( to large for stackoverflow )
http://pastebin.com/eSgHmSgK
This is the HTML
<section class="center-menu">
<div class="center-menu-container">
<div class="hide-for-small">
<dl class="tabs" data-tab="">
<dd class="active" id="#panel1dd" >IT</dd>
<dd id="#panel2dd">Telefoni</dd>
<dd id="#panel3dd">IT-Säkerhet</dd>
</dl>
<div class="tabs-content">
<div class="content active" id="panel1">
<p>This is the first panel of the basic tab example. This is the first
panel of the basic tab example.</p>
</div>
<div class="content" id="panel2">
<p>This is the second panel of the basic tab example. This is the
second panel of the basic tab example.</p>
</div>
<div class="content" id="panel3">
<p>This is the third panel of the basic tab example. This is the third
panel of the basic tab example.</p>
</div>
</div>
</div>
<dl class="accordion show-for-small" data-accordion>
<ul class="small-block-grid-1 medium-block-grid-3">
<li>
<dd>
Accordion 1
<div id="panel1c" class="content">
Panel 1. Lorem ipsum dolor
</div>
</dd>
<dd>
Accordion 2
<div id="panel2c" class="content">
Panel 2. Lorem ipsum dolor
</div>
</dd>
<dd>
Accordion 3
<div id="panel3c" class="content">
Panel 3. Lorem ipsum dolor
</div>
</dd>
</li>
</dd>
</li>
</ul>
</dl>
</div>
</section>
Thanks in advanced!

In Foundation 5 the tabs are displayed and the accordions are hidden when when #media only screen and (min-width: 40.063em) is reached in the browser; the .hide-for-small displays the tabs and the .show-for-small rule hides the accordions.
/* Medium Displays: 641px and up */
#media only screen and (min-width: 40.063em) {
.hide-for-small,
... {
display: inherit !important;
}
.show-for-small,
... {
display: none !important;
}
}
Otherwise the .show-for-small rule displays the accordion:
.show-for-small {
display: inherit !important;
}

Related

Place a "col-lg-12" in a responsive container using

I am trying to place Bootstrap breadcrumb navigation in a template.
What I would like is a full-width 100% with a background color, and then within that place a col-lg-12 but I can't figure it out.
This image might help:
<div class="container-fluid darkgrey">
<div class="row">
<div class="col-lg-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">Home</li>
<li class="breadcrumb-item">Section</a></li>
<li class="breadcrumb-item active" aria-current="page"><?php the_title();?></li>
</ol>
</nav>
</div>
</div>
</div>
I think I might need to "nest" columns but I can't figure it out.
Am I on the right path? Thanks
Read the docs, Luke :-)
Use .container-fluid for a full width container, spanning the entire width of the viewport.
You are using .container-fluid, so you get a fluid, 100% width container. Use .container to get a fixed with container.
Here's a workig JSFiddle.
Also note you have an unbalanced </a> after Section, maybe just a copy-paste error here on SO.
To align the contents to .content width while keeping section background full-page width, you could nest a .container inside your .container-fluid:
.darkgrey {
background-color: #e9ecef;
}
.darkgrey .breadcrumb {
background-color: transparent;
margin-bottom: 0;
padding: .75rem 0;
}
.darkgrey + .container {
padding-top: .75rem;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid darkgrey">
<div class="container">
<div class="row">
<div class="col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href>Home</a></li>
<li class="breadcrumb-item">Section</li>
<li class="breadcrumb-item active" aria-current="page">
Test Post 3
</li>
</ol>
</nav>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-12">
<h2>Test Post 3</h2>
<p> Lorem ipsum dolor sit amet... </p>
</div>
</div>
Important note: .containers can be placed inside .container-fluids but should not be placed inside another .container.
Another note: you probably don't need the CSS (from the screenshot it looks like your theme already handles that part, but I needed it on SO).

Reposition row for small screens

I'm using bootstrap to distribute my header elements in two columns.
So there is a row, with 2 col-md-6 to separate elements to the left and to the right. This is ok.
But when resizing to Smartphones, I'd like to show items in this order (top to bottom):
1) text (I'd like to show it on top but reduce font-size)
2) Buttons (1 on top of the other)
3) Image (Smaller Image doesn't matter).
How to do that using Bootstrap?
CodePen:
https://codepen.io/ogonzales/pen/ebKNoK
HTML
<header class="header" id="header1">
<div class="row">
<div class="col-md-6">
<div class="circle">
<br>
<div class="caption">
<h2 class="title display-3">Stickers <strong>Personalizados</strong></h2>
<p>Lorem m nisi! Eum vitae ipsam veniam, ullam explicabo quaerat asperiores veritatis nam
reprehenderit necessitatibus sequi.</p>
</div>
<div class="row">
<div class="col-md-5">
Comprar
</div>
<div class="col-md-5 my-home-banner-image">
<a href="{% url 'shop:SamplePackPage' %}" class="btn btn-naranja text-white btn-block">Muestras
</a>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<br>
<img class="" src="https://www.austinhomebrew.com/assets/images/sticke-alt-8989.png" width="440px" height="300px">
</div>
</div>
</header>
Reference:
UPDATE 1:
I'm getting this results from AnnieP's answer. But:
How to give spacing between sections and specially between buttons?
What you have should work, as far as the Bootstrap goes. col-md-6 is saying "I want this column to be 6-wide on screens greater than 767 px" and because you don't specify anything for col-xs and col-sm, by default every div with a .col- will be col-12, or full-width, on screens 767 and smaller. It looks like you don't have bootstrap hooked up to the Codepen, so it won't act responsively there, but it should when Bootstrap is working. It looks like you have a lot of CSS in there that's trying to handle what Bootstrap's columns would do for you. For instance the following CSS that you have should all be handled with <div class="col-md-6">:
/*=== Large devices (desktops, 992px and up) ===*/
#media (min-width: 992px) {
.header .center {
width: 50%;
}
What you need to do is change the CSS using media queries for the text size change and the image sizing/positioning. Your image is set with absolute positioning, which is why it's on top of the buttons when it responsively adjusts to a smaller screen. Instead, utilize Bootstrap's grid system and give it col-md-6 as well. Here's the general outline of all you should need:
<div class="container">
<div class="row">
<div class="col-md-6">
<h2>Stickers Personalizados</h2>
<p>Lorum impsum</p>
<div class="row">
<div class="col-md-6">
Comprar
</div>
<div class="col-md-6">
Muestras
</div>
</div>
</div>
<div class="col-md-6">
<img class="" src="https://raw.githubusercontent.com/alphadsy/alpha-ui/master/images/man.png" width="440px" height="300px">
</div>
</div>
</div>
Revisit the Bootstrap getting started docs if you need help setting it up, and you likely don't need most of the CSS in your Codepen.
Update:
To achieve spacing below sections, you can add a wrapper div with class="row", but that won't work for the buttons because they start on the same row. In that case, you'll want to add margin-bottom in the css. For example:
.btn {
margin-bottom: 10px;
}

Selectively Apply Vertical Align to Individual Bootstrap Columns

I would like to vertically center an image on a page which is using bootstrap. I was able to apply vertical alignment to the entire bootstrap row using this answer, but that affects all columns within the bootstrap row, rather than what I want, which is for just one of the columns to be affected.
How can I selectively apply this styling?
<div>
<div class="row">
<div class="col-xs-6">
<p> lorem ispum bla bla </p>
</div>
<div class="col-xs-6"> <!-- column I want vertically aligned -->
<img href="#">
</div>
</div>
</div>
You can achieve that by using align-self: center like this:
HTML
<div>
<div class="row flex">
<div class="col-xs-6">
<p> lorem ispum bla bla </p>
</div>
<div class="col-xs-6 center-me"> <!-- column I want vertically aligned -->
<img href="#">
</div>
</div>
</div>
CSS
.flex {
display: flex
}
.center-me {
align-self: center
}

Boostrap indenting columns in row

I am new to bootstrap. Why is the second row with 3 columns (col-sm-3, col-sm-6 and col-sm-3) being indented, the other two rows have a wider width? How can I make all rows the same width?
.header {background-color: #9933cc;}
.menu ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.menu li {
background-color :#33b5e5;
margin-bottom: 7px;
}
.aside {background-color: #33b5e5;}
.footer {background-color: #0099cc;}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class='container'>
<div class='row'>
<div class='header'>
<h1>China</h1>
</div><!--end header-->
</div>
<div class='row'>
<div class='menu col-sm-3'>
<ul>
<li>The Flight</li>
<li>The City</li>
<li>The Island</li>
<li>The Food</li>
</ul>
</div><!--end menu-->
<div class='col-sm-6'>
<h1>The City</h1>
<p>Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city.</p>
<p>Resize the browser window to see how the content respond to the resizing.</p>
</div>
<div class='col-sm-3'>
<div class='aside'>
<h2>What?</h2>
<p>Chania is a city on the island of Crete.</p>
<h2>Where?</h2>
<p>Crete is a Greek island in the Mediterranean Sea.</p>
<h2>How?</h2>
<p>You can reach Chania airport from all over Europe.</p>
</div>
</div>
</div>
<div class='row'>
<div class='footer'>
<p>Resize the browser window to see how the content respond to the resizing.</p>
</div><!--end footer-->
</div>
</div><!--end container-->
Because .col-sm-3 and .col-md-6 adds padding to the div elements.
Wrap the header and footer in col-sm-12
HTML
<div class="col-md-12">
<div class='header'>
<h1>China</h1>
</div><!--end header-->
</div>
<div class="col-sm-12">
<div class='footer'>
<p>Resize the browser window to see how the content respond to the resizing.</p>
</div><!--end footer-->
</div>
Working Fiddle
Adding .col-sm-12 class to .footer and .header div's don't change because, background-color property is applied on .header and .footer and color is applied including the padding.
Wrapping these elements (footer and header) divs in .col-sm-12 adds padding to parent elements.

How to add link on navigation bar? html

so I've just started making my own personal website, however, I'm running into issues with my navigation bar. Basically I want to be able to click on the titles on my navigation bar and then it will direct me to section pertaining to that title on my page.
To make things more clear. Take for example, this is what I have so far for my navigation bar:
<div class="about"> <a> About </a> </div>
<div class="blog"> <a> Blog </a> </div>
<div class="projects"> <a> Projects &nbsp </a> </div>
Now my nav bar should look something along the lines of this:
About Blog Projects
And the rest of my webpage looks likes this
<h1> About me </h1>
<p> Hi im nikki.. </p>
<h2> Blog </h2>
<p> This is my blog.. </p>
<h3> Projects </h3>
<p> First project last year .... </p>
Now what I want to be able to do to is to click on About on my navigation bar and make it take me to the About section on my page? How do I do this?
Thanks :)
Try the below code, add the style to your stylesheet.
<style>
.nav:after {
content:"";
clear:both;
display:block;
}
.nav li {
float: left;
list-style-type: none;
}
</style>
<ul class="nav">
<li>About</li>
<li>Blog</li>
<li>Projects</li>
</ul>
<div id="about">
Lorem Ipsum
</div>
<div id="blog">
Lorem Ipsum
</div>
<div id="projects">
Lorem Ipsum
</div>
Do you need something like this ?
Then easy way of doing it is , using JQuery-UI Tabs.
To know n learn more about it , just read through the documentation, Its easy comparatively doing it with plain css & JS.
reference Link : https://jqueryui.com/tabs/

Resources