Equal height children images in responsive Bootstrap 4 columns. How to? - flexbox

Using Bootstrap 4, I'd like to create 3 columns that adjust their width so that padding of each column is consistent and the height of each image is consistent between each column. The goal is for the width and height of each image to increase/decrease as page width changes. Notice, the height of the images and columns should always be synced. I know I can use percentages, but I was hoping there was a flexbox solution. Thanks
Codepen: https://codepen.io/danielgetsthis/pen/qJgyNx
<div class="container">
<div class="row">
<div class="col">
<a href="#" class="text-center">
<span>1</span>
<img src="http://placehold.jp/100x100.png" />
</a>
</div>
<div class="col">
<a href="#" class="text-center">
<span>2</span>
<img src="http://placehold.jp/200x100.png" />
</a>
</div>
<div class="col">
<a href="#" class="text-center">
<span>3</span>
<img src="http://placehold.jp/300x100.png" />
</a>
</div>
</div>
</div>

I'm not sure that I understand the height issue. The columns and images are the same height. To equalize the padding around the images use col-auto instead of col. This makes the columns shrink to fit the width of their content.
<div class="container">
<div class="row justify-content-center">
<div class="col-auto">
<a href="#" class="text-center">
<span>1</span>
<img src="http://placehold.jp/100x100.png" />
</a>
</div>
<div class="col-auto">
<a href="#" class="text-center">
<span>2</span>
<img src="http://placehold.jp/200x100.png" />
</a>
</div>
<div class="col-auto">
<a href="#" class="text-center">
<span>3</span>
<img src="http://placehold.jp/300x100.png" />
</a>
</div>
</div>
</div>
https://www.codeply.com/go/XtNGjb765u

body{
background-color: #eee;
box-sizing: border-box;
}
.col {
display: flex;
flex: 0;
flex-direction: initial;
}
.col a {
display: flex;
flex-wrap: wrap;
padding: 10%;
background-color: tomato;
border: 1px solid green;
color: #FFF;
font-size: 26px;
justify-content: center;
}
span{
display: block;
text-align:center;
}

Related

SVG Logo with Bootstrap

I am developing a web in Bootstrap 4 and in the header I have a SVG format logo that has to be responsive (without fixed size) but it is not possible to visualize it unless you leave the property wide at a fixed value in .px some way to be responsive without leaving a fixed value in .px? Because in Chrome, Opera, Safari, Internet explorer leaving the Width property in auto. In all browsers it appears without problem but in Firefox it does not
<div class="col-md-2 col-sm-12 col-xs-12 text-center" style="padding-left: 0px; padding-right: 0px;">
<div style="height: 80px; display: flex; align-items: center;">
<a href="index">
<img style="width: 100% !important; height: auto !important;" src="img/imprentaonline24.svg" alt="imprentaonline24" />
</a>
</div>
</div>
It works fine from if use use directly from url. I'm using FireFox and it works
<div class="col-md-2 col-sm-12 col-xs-12 text-center" style="padding-left: 0px; padding-right: 0px;">
<div style="display: flex; align-items: center;">
<a href="index">
<svg>
<img src="https://www.imprentaonline24.es/img/imprentaonline24.svg"/>
</svg>
</a>
</div>
</div>

Flexbox children don't have equal height on iPad [duplicate]

This question already has answers here:
Chrome / Safari not filling 100% height of flex parent
(5 answers)
Closed 6 years ago.
I can't figure out why flexbox children do not have equal height on iPad (Chrome and Safari). When testing this works fine on the desktop:
But this is how it looks on iPad:
HTML structure:
<div class="flex-grid-quarters">
<div class="tile col">
<div class="tile-content border martlet">
<img src="/images/martlet.jpg"/>
</div>
</div>
<div class="tile col quicklinks">
<div class="tile-content border">
<h3>Quick Links</h3>
{module_menu, version="2", menuId="1958990", moduleTemplateGroup=""}
</div>
</div>
<div class="tile col gold-links">
<div class="tile-content border">
Mill Hill Enterprise
Development Office
Mill Hill School Foundation
National Liberal Club
</div>
</div>
<div class="tile col contact-us">
<div class="tile-content border">
<h3>Contact Us</h3>
<p>Old Millhillians Club</p>
<p>Mill Hill School</p>
<p>The Ridgeway</p>
<p>London NW7 1QS</p>
<br/>
<p>t 020 8906 7948 / 7949</p>
<p>e sk#millhill.org.uk</p>
</div>
</div>
</div>
CSS:
.flex-grid-quarters, .flex-grid-thirds {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
}
.flex-grid-quarters .col {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
width: 25%;
}
I don't believe it is necessary to have display: flex on the children, but I added that anyway in an attempt to get it working. No such luck (the result is exactly the same with or without that). The link to the site if anyone needs it is http://omclub.streeten.co.uk/ Any help much appreciated.
There's a ton of vendor prefixes that are no longer needed, so I removed everything but justify-content and display: flex; It looks like each flex-item has equal heights. Unfortunately I am not able to test it on an iPad (it's the only device I don't have yet)
SNIPPET
.flex-grid-quarters, .flex-grid-thirds {
display: flex;
justify-content: center;
}
.flex-grid-quarters .col {
width: 25%;
outline: 3px dashed red;
}
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<div class="flex-grid-quarters">
<div class="tile col">
<div class="tile-content border martlet">
<img src="/images/martlet.jpg"/>
</div>
</div>
<div class="tile col quicklinks">
<div class="tile-content border">
<h3>Quick Links</h3>
{module_menu, version="2", menuId="1958990", moduleTemplateGroup=""}
</div>
</div>
<div class="tile col gold-links">
<div class="tile-content border">
Mill Hill Enterprise
Development Office
Mill Hill School Foundation
National Liberal Club
</div>
</div>
<div class="tile col contact-us">
<div class="tile-content border">
<h3>Contact Us</h3>
<p>Old Millhillians Club</p>
<p>Mill Hill School</p>
<p>The Ridgeway</p>
<p>London NW7 1QS</p>
<br/>
<p>t 020 8906 7948 / 7949</p>
<p>e sk#millhill.org.uk</p>
</div>
</div>
</div>
</body>
</html>

"Element is not currently visible and so may not be interacted with" Watir

Facing the issue when the code is executed in test script. the same code executes fine in irb
#browser.div(:class=>/DownArrowButton/).when_present.click #works fine, dropdown
popup = #browser.div(:id=>'pgObjectSelector_Popover')
popup.text_fields(:id=>/dijit_form_TextBox_/).select{|s| s.visible?}[0].when_present.set('ethernet')
While setting the key the widget gets closed with an error:
Element is not currently visible and so may not be interacted with
[remote server] file:///C:/Users/suchanna/AppData/Local/Temp/webdriver-profile20150319-30448-a96p5v/extensions/fxdriver#googl
ecode.com/components/command-processor.js:8991:in `fxdriver.preconditions.visible'
Please help me out for the above problem
Html:
<div id="pgObjectSelector_Popover" class="xwtPopover dijitTooltipDialog xwt_BasePickerPopover dijitTooltipABLeft dijitTooltipBelow" wairole="presentation" widgetid="pgObjectSelector_Popover" style="top: 0px; display: none;">
<div class="dijitTooltipContainer" data-dojo-attach-event="onkeypress: _onKey" wairole="dialog" waistate="labelledby-pgObjectSelector_Popover_title" data-dojo-attach-point="_outsideContainer" style="">
<table class="xwtPopoverMenuBar" cellspacing="0" cellpadding="0" data-dojo-attach-point="menuBar" wairole="presentation"></table>
<div class="xwtPopoverPadding" data-dojo-attach-point="_paddingContainer">
<div class="dijitTooltipContents dijitTooltipFocusNode" tabindex="-1" data-dojo-attach-point="_scrollBox" style="overflow-x: hidden;">
<table class="xwtPopoverTable" wairole="presentation">
<tbody>
<tr>
<td wairole="presentation">
<div class="xwtPopoverContainer" wairole="presentation" tabindex="-1" data-dojo-attach-point="containerNode">
<div id="dijit_layout_BorderContainer_0" class="dijitBorderContainerNoGutter dijitContainer dijitLayoutContainer" widgetid="dijit_layout_BorderContainer_0" style="padding: 0px; width: 275px; height: 300px;">
<div id="dijit_layout_ContentPane_1" class="dijitContentPane dijitBorderContainerNoGutter-child dijitBor…nerNoGutterPane dijitAlignCenter dijitContentPaneSingleChild" widgetid="dijit_layout_ContentPane_1" style="left: 0px; top: 0px; position: absolute; width: 275px; height: 300px;">
<div id="pgObjectSelector_osInstance" class="xwtobjectselector" minheight="100" minwidth="220" data-dojo-attach-point="osNode" widgetid="pgObjectSelector_osInstance" style="cursor: default; width: 273px; height: 298px;">
<div id="xwt_widget_objectselector__Titlebar_0" class="xwtOsTitlebar" minwidth="100" data-dojo-attach-point="titleBar" widgetid="xwt_widget_objectselector__Titlebar_0"></div>
<div class="xwtobjectselectorcontents xwtOSDataReady" data-dojo-attach-point="osContents">
<div class="xwtObjectSelectorToolbars" data-dojo-attach-point="toolbars">
<div id="xwt_widget_objectselector__ObjectSelectorToolbar_0" class="xwtOsToolbar" data-dojo-attach-point="ButtonToolbar" minwidth="100" data-dojo-type="xwt.widget.toolbar.LayoutToolbar" widgetid="xwt_widget_objectselector__ObjectSelectorToolbar_0" style="display: none;"></div>
<div id="xwt_widget_filtertoolbar_FilterToolbar_0" class="xwtFilterToolbar" widgetid="xwt_widget_filtertoolbar_FilterToolbar_0" style="width: 273px;">
<div class="xwtFilterbarLeft" data-dojo-attach-point="SearchLeftGroup"></div>
<div class="xwtFilterbarCenter" data-dojo-attach-point="SearchCenterGroup">
<div class="xwtFilterSearchIcon icon-cisco-search" title="Search" tabindex="0" data-dojo-attach-point="searchButton">
<div class="xwt-ButtonSearchTextHighContrast" data-dojo-attach-point="searchTextHighCont"></div>
<span class="xwtFilterSearchText" data-dojo-attach-point="searchText"></span>
</div>
<span class="dijit dijitReset dijitInline xwtFilterDownButton xwtFilterDownIcon xwtFilterbarDropdownOff" widgetid="dijit_form_DropDownButton_3">
<span class="dijitReset dijitInline dijitButtonNode" data-dojo-attach-point="_buttonNode" data-dojo-attach-event="ondijitclick:__onClick"></span>
<input class="dijitOffScreen" type="button" aria-hidden="true" role="presentation" data-dojo-attach-point="valueNode" data-dojo-attach-event="onclick:_onClick" tabindex="-1" value=""></input>
</span>
<div id="widget_dijit_form_TextBox_1" class="dijit dijitReset dijitInline dijitLeft xwtFilterSearchBox dijitTextBox" role="presentation" widgetid="dijit_form_TextBox_1" style="width: 185px;">
<div class="dijitReset dijitInputField dijitInputContainer">
<input id="dijit_form_TextBox_1" class="dijitReset dijitInputInner" type="text" autocomplete="off" data-dojo-attach-point="textbox,focusNode" tabindex="0" value=""></input>
<span class="dijitPlaceHolder dijitInputField">
Search All
</span>
</div>
</div>
<div class="xwtFilterClearIcon" data-dojo-attach-event="ondijitclick: _clearIconClicked" tabindex="0" data-dojo-attach-point="closeButton"></div>
<div class="xwtClear"></div>
</div>
<div class="xwtFilterbarRight" data-dojo-attach-point="SearchRightGroup"></div>
<div class="xwtAdvFilterButton" data-dojo-attach-point="advancedFilter"></div>
<div class="xwtClear"></div>
</div>
<div id="dijit_layout_ContentPane_0" class="dijitContentPane xwtOsScopeTabs" dolayout="true" minwidth="100" data-dojo-type="dijit/layout/ContentPane" data-dojo-attach-point="scopeTabs" widgetid="dijit_layout_ContentPane_0"></div>
<div id="xwt_widget_objectselector__SelectionDisplayBar_0" class="xwtOsSelectionBar" minwidth="100" data-dojo-attach-point="selectionBar" widgetid="xwt_widget_objectselector__SelectionDisplayBar_0" style="width: 268px;"></div>
</div>
<div id="dijit_layout_StackContainer_0" class="xwtobjectselectorview dijitStackContainer dijitContainer dijitLayoutContainer xwtOSDataReady xwtOsStackContainer" dolayout="true" data-dojo-attach-point="containerNode" widgetid="dijit_layout_StackContainer_0" style="width: 273px; height: 214px;"></div>
</div>
<div class="resizeHandleBoth" data-dojo-attach-point="resizeHandleAP" style="display: none;"></div>
<div class="xwtOsFooter"></div>
<div class="xwtOsLeftShadow"></div>
<div class="xwtOsRightShadow"></div>
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="xwtPopoverFooter" data-dojo-attach-point="footer"></div>
</div>
<!--
Added connector attach point
-->
<div class="dijitTooltipConnector" data-dojo-attach-point="connector" wairole="presentation" style="left: 8px;"></div>
<div class="xwtPopoverLoader icon-spinner icon-spin" data-dojo-attach-point="loader" style="bottom: 139.333px; left: 153.5px; display: none;"></div>
</div>
</div>
Ok, first at all, if you need to set any text to this field, you can make div with:
id => 'pgObjectSelector_Popover' with JavaScript, using execute_script: #browser.execute_script("document.getElementById('pgObjectSelector_Popover').style.display = 'block';"), after, this pop-up have just one text_field so, you can do: #browser.div(pgObjectSelector_Popover).text_field.set 'ethernet'
Second,
#browser.div(:class=>/DownArrowButton/).when_present.click
#browser.div(:id=>'pgObjectSelector_Popover').text_field.set 'ethernet'

div with masonry layout inside another masonry layout

My question is: i have a container with masonry layout, is possible that one or more item have inside another container with masonry?
<div class="masonry">
<div class="item"></div>
<div class="item">
<div class="masonry_inside">
<div class="item_inside"></div>
<div class="item_inside"></div>
<div class="item_inside"></div>
</div>
</div>
<div class="item"></div>
</div>
You will have to init Masonry seperately on each grid container:
// Init masonry on outer container
$('.masonry').masonry({
itemSelector: '.item',
});
// Init masonry on inner container
$('.masonry_inside').masonry({
// You need to use another item selector class on the inner elements
itemSelector: '.item_inside',
});
.masonry {
width: 440px;
background-color: gray;
}
.item {
width: 200px;
background-color: black;
margin: 10px;
}
.item_inside {
width: 80px;
margin: 10px;
background-color: white;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="https://unpkg.com/masonry-layout#4/dist/masonry.pkgd.min.js"></script>
<div class="masonry">
<div class="item" style="height: 150px;"></div>
<div class="item" style="height: 200px;"></div>
<div class="item" style="height: 180px;"></div>
<div class="item">
<div class="masonry_inside">
<div class="item_inside" style="height: 180px;"></div>
<div class="item_inside" style="height: 80px;"></div>
<div class="item_inside" style="height: 120px;"></div>
<div class="item_inside" style="height: 35px;"></div>
</div>
</div>
<div class="item" style="height: 80px;"></div>
</div>

Bootstrap layout - not centered and bad zooming

i am now working for several days now on a header for our project. Everything is ok - but the layout not.
In my Layout I have on the left a logo, in the middle a navbar, and on the right Login/Logout/Register links.
My Problem is, that I can't center the navbar as I want, if I try, then it is only for my display resolution ok and e.g. if I zoom in or out, it is going bad.
This is also very nice, but I don't know how to do it.
I would be really glad if somebody could help me.
Thanks in advance.
HTML
<body>
<div class="row">
<div class="span3">
<img src="/resources/img/logos/bb_logotype_blue_110.png" />
</div>
<div class="span6">
<!-- NavBar -->
<ul id="navbar">
<li>Product</li>
<li>Support</li>
<li>Blog</li>
<li>About</li>
</ul>
</div>
<div class="span3"></div>
<div id="nav-account" class="nav-collapse pull-right">
<ul class="nav">
<li><a id="register" href="/register">Register</a></li>
<li><a id="login" href="/login/form">Login</a></li>
</ul>
</div>
</div>
</div>
<div class="container" style="margin-top:3em">
<h1 id="title"></h1>
... some stuff ...
</div>
CSS
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
#navbar li
{
display: inline;
border-right: 2px solid black;
padding-left: 20px;
padding-right: 20px;
font-weight: bold;
font-size: 16pt;
}
#navbar li:last-child
{
border-right: 0;
padding-right: 0;
}
</style>
In bootstrap, if you place elements inside a <container> block, they will be automatically centered and resized to fit in the grid layout. Perhaps that is what you are looking for.

Resources