Using FoundationCSS, if I use the basic grid system by defining a row and then columns, I get a grid that is 1000px wide on desktop.
<div class="row">
<div class="small-12 columns">
...
</div>
</div>
However, if I do the same thing, but omit the "row", I get a full width layout.
<div class="small-12 columns">
...
</div>
Are there any side affects I should be aware of by omitting the "row"?
The safest thing I found was to add a new class to make the container full-width:
.full-width {
width: 100%;
margin-left: auto;
margin-right: auto;
max-width: initial;
}
And use it in the html:
<body>
<div class="row full-width">
<div class="small-12 columns">
....
</div>
<div class="row"
<div class="small-6 columns>...</div>
<div class="small-6 columns>...</div>
</div>
</div>
</body>
Related
I want to develop image gallery. I want to present each image and its description under it and when I click on an image or text or white space got "modal"
I wrote this for an element in gallery
<div class="m-4 img99">
<a href="#ml">
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" class="simg " alt="..." data-toggle="modal" data-target="#ml">
<div class="">
<h5 class="">test</h5>
<p>test</p>
</div>
</a>
</div>
The modal part is
<div class="modal fade" id="ml">
<div class="modal-dialog modal-dialog-centered modal-xl ">
<div class="modal-content">
<!-- Modal Header -->
<!-- Modal body -->
<div class="modal-body ">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 ">
<p>
test
</p>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
and CSS part
.simg {
width: auto;
height: 60px;
}
.img99 {
margin-right: auto !important;
margin-left: auto !important;
width: max-content;
height: max-content;
border: 1px solid rgba(0, 0, 0, 0.15);
}
My problem is when I click on a text or white space the model didn't work. "when I click on image :the model work normally"
https://codepen.io/ahof920/pen/MWYGRYp?editors=1100
What is the problem?
Replace your HTML with this:
Reason why its not working :
Modal are triggered by following tag's in bootstrap data-toggle="modal" data-target="#ml" and you added those inside <img> tag that's the reason modal is opened when clicked on image. So add data-toggle="modal" data-target="#ml" to <a>.
.simg {
width: auto;
height: 60px;
}
.img99 {
margin-right: auto !important;
margin-left: auto !important;
width: max-content;
height: max-content;
border: 1px solid rgba(0, 0, 0, 0.15);
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<div class="shadow2 m-4 img99">
<a href="#ml" data-toggle="modal" data-target="#ml">
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" class="simg " alt="...">
<div class="">
<h5 class="">test</h5>
<p>test</p>
</div>
</a>
</div>
<div class="modal fade" id="ml">
<div class="modal-dialog modal-dialog-centered modal-xl ">
<div class="modal-content">
<!-- Modal Header -->
<!-- Modal body -->
<div class="modal-body ">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 ">
<p>
test
</p>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
I'm using the grid-xy system and I'm attempting to change the gutter width of Foundation 6 with my settings.scss file but I'm having no luck. My ultimate goal is to have the gutters between my cells to be 20px wide instead of 15px. I tried changing any variable I could think of or find in my research. Below is a list of variables I've tried.
$grid-column-gutter: (
small: 30px,
medium: 45px,
);
$column-gutter: rem-calc(20);
$gutters: rem-calc(20);
$gutter: rem-calc(20);
$grid-margin-gutters: rem-calc(20);
I know for sure my _settings.scss is working though because I was able to change $global-width and it did have an effect.
Here is the html I'm using
<div class="grid-x grid-padding-x grid-container">
<div class="cell large-4 medium-6 small-12">
<h2>Test</h2>
</div>
<div class="cell large-4 medium-6 small-12">
<h2>Test 2</h2>
</div>
<div class="cell large-4 medium-6 small-12">
<h2>Test 3</h2>
</div>
<div class="cell large-4 medium-6 small-12">
<h2>Test 4</h2>
</div>
<div class="cell large-4 medium-6 small-12">
<h2>Test 5</h2>
</div>
<div class="cell large-4 medium-6 small-12">
<h2>Test 6</h2>
</div>
</div>
How do you change the default padding width between grid-xy cells?
Turns out I wasn't using the right variables
$grid-padding-gutters: 40px;
$grid-margin-gutters: 40px;
Worked
I sometimes use columns as spacers, and so when there is no content, I don't want the column to collapse, which is the default behavior. Is there a built-in way to prevent empty columns from collapsing?
I know I can add some invisible div or something, but I'm asking if there's a standard way to accomplish this without resorting to hacks like that.
You can use offsets to create gaps:
<div class="row">
<div class="large-1 columns">1</div>
<div class="large-11 columns">11</div>
</div>
<div class="row">
<div class="large-1 columns">1</div>
<div class="large-10 large-offset-1 columns">10, offset 1</div>
</div>
<div class="row">
<div class="large-1 columns">1</div>
<div class="large-9 large-offset-2 columns">9, offset 2</div>
</div>
<div class="row">
<div class="large-1 columns">1</div>
<div class="large-8 large-offset-3 columns">8, offset 3</div>
</div>
I created a hacky style for this. Like so:
.row.no-collapse .columns {
min-height: 1px;
}
<div class="row no-collapse">
<div class="large-1 columns">1</div>
<div class="large-11 columns">11</div>
</div>
I'll try to ask this here, because on Foundation forums I got no answer.
I'm making a mixed layout and I want to use Equalizer to make the first column and the second column the same height. The catch is that the second column is another grid layout. Inside that second grid, Equalizer works like a charm, but between the first and second column it does nothing. I've searched here and there are a lot of people with similar problems, but I did not found a solution for mixed layout, even with simple jQuery functions.
Anyone can help?
Here's the code:
<div class="row">
<div class="large-12 columns">
<div class="row" data-equalizer>
<!-- first column -->
<div class="large-2 small-2 columns">
<div class="panel" data-equalizer-watch>
<!-- here goes an image -->
</div>
</div>
<!-- second column -->
<div class="large-10 small-10 columns" data-equalizer-watch>
<div class="row" data-equalizer>
<div class="large-4 small-12 columns">
<p class="panel" data-equalizer-watch>Text</p>
</div>
<div class="large-4 small-12 columns">
<p class="panel" data-equalizer-watch>Text</p>
</div>
<div class="large-4 small-12 columns">
<p class="panel" data-equalizer-watch>Text</p>
</div>
</div>
<div class="row">
<div class="large-12 small-12 columns">
<p class="panel">Longer text</p>
</div>
</div>
<div class="row" data-equalizer>
<div class="large-4 small-12 columns">
<p class="panel" data-equalizer-watch>Text</p>
</div>
<div class="large-4 small-12 columns">
<p class="panel" data-equalizer-watch>Text</p>
</div>
<div class="large-4 small-12 columns">
<p class="panel" data-equalizer-watch>Text</p>
</div>
</div>
<div class="row">
<div class="large-12 small-12 columns">
<p class="panel">Longer text</p>
</div>
</div>
</div>
</div>
</div>
I checked on version 5.2.2: you just cannot do this.
I looked at Foundation foundation.equalizer.js file,
this function is simply not suited for equalize an equalizer inside an equalizer.
In 5.2.2 version, at line 30, you can see how it select elements to equalize:
vals = equalizer.find('[' + this.attr_name() + '-watch]:visible')
There is no dinstinction between dom levels, it catches every data-equalizer-watch without looking for any data-equalizer inside a data-equalizer
i have the following situation in a project
<div class="row">
<div class="large-3"></div>
<div class="large-3"></div>
<div class="large-3"></div>
<div class="large-3"></div>
</div>
i would like to use media query to modify to hide a div (large-3) for a certain width and let the other three to be large-4
how can i achieve this ?
thanks
There should be a more efficient way to do that, but this is the first thing that comes to mind:
Sample HTML:
<div class="row design-4-columns">
<div class="large-3 columns"></div>
<div class="large-3 columns"></div>
<div class="large-3 columns"></div>
<div class="large-3 columns"></div>
</div>
<div class="row design-3-columns">
<div class="large-4 columns"></div>
<div class="large-4 columns"></div>
<div class="large-4 columns"></div>
</div>
Your css would be something like this:
/* Used to alter styles for screens at least 500px wide.*/
#media only screen and (min-width: 500px) {
.design-4-columns {
display: none !important;
}
}