I know this question has been asked a number of times but for my problem the proposed solutions are not working.
I am presenting a PDF to a user in a modal along side a form. Image below.
The problem I am having is that the iframe is set at 100% for the maximum size it will go to at 100% is as per the image.
If I give is a fixed size of 435px; it sizes to the right aspect for my screen. As I need this to be screen agnostic I want it to size its self according to the modal that it appears in.
I have tried using the working example from here http://www.bootply.com/92230 and this example is the same as I have seen all over the web this morning.
The HTML for this is
<div class="row">
<div id="equalheight">
<div id="loa" class="col-md-6 demo NotShown">
<iframe src="\\sqlmuldvwsk06.ukskpre.santanderuk.pre.corp\Public\CMCFileUpload\LOAFiles\SRA557034_321043.004.pdf" class="mh100Percent mw100" frameborder="0" scrolling="no">
<p>It appears your web browser doesn't support iframes.</p>
</iframe>
</div>
<div id="custDetails" class="col-md-12 demo">
...
</div>
</div>
</div>
The reason I am having to use an iFrame is because I am working on an application that is for internal use on a corporate LAN and when I try and embed the pdf as an object I get an Access Denied error.
Also, when an event if fired, the div custDetails is resized to a col-md-6 and when the modal is finished with the divs are resized \ reclassed.
Any and all help on how to show the iFrame the same size as the form next to it would be great.
thanks
Simon
<style>
.row-eq-height {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
iframe {
height: 100%;
position: absolute;
}
</style>
<div class="row row-eq-height">
<div id="loa" class="col-md-6 demo NotShown">
<iframe
src="\\sqlmuldvwsk06.ukskpre.santanderuk.pre.corp\Public\CMCFileUpload\LOAFiles\SRA557034_321043.004.pdf"
class="mh100Percent mw100" frameborder="0" scrolling="no">
<p>It appears your web browser doesn't support iframes.</p>
</iframe>
</div>
<div id="custDetails" class="col-md-6 demo">
...
</div>
</div>
Hope this will work
Here we go...
<div style="display:flex; flex-wrap:wrap; align-items: stretch;">
<div style="background-color:red; border: 2px solid black;">DIV 1<br/>DIV 1<br/>DIV 1<br/>DIV 1<br/></div>
<div style="background-color:green; border: 2px solid black;">DIV 2DIV 1<br/>DIV 2<br/>DIV 2<br/>DIV 2<br/>DIV 2<br/>DIV 2<br/>DIV 2<br/></div>
<div style="background-color:blue; border: 2px solid black;">DIV 3</div>
<div style="background-color:gray; border: 2px solid black;">DIV 4</div>
<div style="background-color:yellow; border: 2px solid black;;">DIV 5</div>
</div>
Hoping it helps...
Related
I have this code:
<div align="center">
<iframe scrolling="no" src="//blockadz.com/ads/show/show.php? a=6NJWBKLSGP8CY&b=OYEPEGYYZ996L" style="overflow:hidden;width:468px;height:60px;" frameborder="0"; padding- bottom: 20px; display:inline-block;></iframe>
</div>
<div style="text-align:center;">
Advertise in this spot
</div>
<div align="center">
<iframe scrolling="no" src="//blockadz.com/ads/show/show.php? a=6NJWBKLSGP8CY&b=OYEPEGYYZ996L" style="overflow:hidden;width:468px;height:60px;" frameborder="0"; padding- bottom: 20px; display:inline-block;></iframe>
</div>
<div style="text-align:center;">
Advertise in this spot
</div>
I want to show in the same row, but don't know how?
I tried adding: display:inline-block; and white-space: nowrap; but nothing changed.
Any help?
Try adding CSS float to your main divs
<div style="float:left;">
<div align="center">
<iframe bottom:="" frameborder="0" padding-="" scrolling="no" src="//blockadz.com/ads/show/show.php?%20a=6NJWBKLSGP8CY&b=OYEPEGYYZ996L" style="overflow:hidden;width:468px;height:60px;"></iframe>
</div>
<div style="text-align:center;">
Advertise in this spot
</div>
</div>
<div style="float:right;">
<div align="center">
<iframe bottom:="" frameborder="0" padding-="" scrolling="no" src="//blockadz.com/ads/show/show.php?%20a=6NJWBKLSGP8CY&b=OYEPEGYYZ996L" style="overflow:hidden;width:468px;height:60px;"></iframe>
</div>
<div style="text-align:center;">
Advertise in this spot
</div>
</div>
See in jsfiddle
Two divs with width 50%:
HTML
<div id="first_column">
<div align="center">
<iframe width="560" height="315" src="https://www.youtube.com/embed/CevxZvSJLk8" frameborder="0" allowfullscreen></iframe>
</div>
<div style="text-align:center;">
Advertise in this spot
</div>
</div>
<div id="second_column">
<div align="center">
<iframe width="560" height="315" src="https://www.youtube.com/embed/CevxZvSJLk8" frameborder="0" allowfullscreen></iframe>
</div>
<div style="text-align:center;">
Advertise in this spot
</div>
</div>
CSS
#first_column,
#second_column {
width: 50%;
}
#first_column {
float:left;
}
#first_column {
float:right;
}
Example:
http://codepen.io/anon/pen/vyWrbX
You have a couple of different issues going on here:
You have invalid markup on the iframes (some of your CSS is outside the "style" attribute so won't have any effect.)
Your "advertise in this spot" divs are full page width, which will interfere with the side-by-side layout you're attempting to apply to the iframes.
The simplest solution is to add parent containers to each set of iframe-plus-link, and apply the layout to those containers. For clarity here I've pulled your inline CSS out into class declarations, and changed the sizes to fit within the SO layout, but you can adjust this to whatever sizes and styles you like:
.container {
width: 200px;
display:inline-block;
}
iframe {
height: 100px;
width: 200px;
}
.ad {
text-align:center
}
<div class="container">
<iframe src="//example.com"></iframe>
<div class="ad">Advertise in this spot</div>
</div>
<div class="container">
<iframe src="//example.com"></iframe>
<div class="ad">Advertise in this spot</div>
</div>
Just add css to the siblings elements (in this case the parent <div> element) to make them show in the same line, like
div[align] { display: inline-block; }
or
div[align] { float: left; }
and define a width for them (if they are adapting to content width they can get on new line if too big)
div[align] { width: 50%; }
iframe { width: 100%; } /* or max-width */
I am trying to override two images on top of other using Bootstrap, as the code below:
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-12 col-md-offset-2 col-lg-offset-2" style="border:solid 1px black">
<div style='position: relative; width:100%; height:100%; background:center; border:solid 1px red'>
<img src="Images/banner-transparente.jpg" class="img-responsive" />
<div style='position: absolute; width: 100%; height: 100%; top: 20%; border:solid 1px black'>
<img src="Images/logo-trt-home.png" class="img-responsive" />
</div>
</div>
</div>
</div>
The result is OK when the screen is in a large scale:
but when on small screens, the image is cropped.
How can I do that using Bootstrap's grid system, using the responsiveness needed for the image?
code on http://jsfiddle.net/s116Ld99/5/
I've tried the code below:
<div class="row">
<div class="col-lg-8 col-md-8 col-md-offset-2 col-lg-offset-2" style="border:solid 1px black">
<div style="background-image:url('Images/banner-transparente.jpg'); border: solid 1px green">
<img src="Images/logo-trt-home.png" class="img-responsive" />
</div>
</div>
</div>
It works perfectly!
[1] https://jsfiddle.net/bwth52ft/
I would make the first image a background image. Putting position: absolute on the logo is going to make it ignore its container.
Not completely done, but closer: http://jsfiddle.net/s116Ld99/7/
<div style="background-image:url('http://files.intersu.webnode.pt/200000002-a2450a33fe/bannerB[1].jpg'); background-repeat: no-repeat; background-size: 100% auto; border:solid 1px green">
<img src="https://eloconcursos.com.br/imagem/59954926655ae736857b696.73701051.jpg/167/200/4:3" class="img-responsive" />
</div>
Problem: The width of image's parent is fixed which gets from the image. When you resize the window, it does not changed so the image is big in small screen.
You can add width(percent) to the image container. It's better to do this by css media query in certain width.
Jsfiddle
<div style=" width:20%;position: absolute; top: 20%; border:solid 1px yellow">
<img src="https://eloconcursos.com.br/imagem/59954926655ae736857b696.73701051.jpg/167/200/4:3" class="img-responsive" />
</div>
I'm trying to achieve the following layout for a search result box. Specifically a 100% width and height image that on the right has two stacked containers that equals the height of the image, each with differing background colours that are butted up right against the image.
All attempts to achieve this simple layout are failing miserably. The issue I keep hitting is the when using something like:
<div class="search-result-box">
<div class="row">
<div class="col-md-3">
<img src="" class="img-responsive" style="height: 196px;" height="196">
</div>
<div class="col-md-9">
...
</div>
</div>
</div>
The image doesn't quite fill the col-md-3 column completely and thus you see the column's background.
What's the best way to do this?
Bootstrap columns have a padding of 15px by default. Also the image width has to be 100%. You can do something like this:
<div class="search-result-box">
<div class="row">
<div class="col-md-3" style="padding: 0;">
<img src="" class="img-responsive" style="width: 100%;">
</div>
<div class="col-md-9">
...
</div>
</div>
</div>
Jsfiddle: http://jsfiddle.net/HM4gE/1/
I wouldn't use Bootstrap columns though to achieve this since you seem to have some fixed heights and widths for columns. Instead I would do it like this (given that the height and the width of the image is always 196px): http://jsfiddle.net/HM4gE/2/
Check browser support for calc() before using it: http://caniuse.com/calc
Here a possible answer:
<div class="search-result-box">
<div class="row">
<div class="col-md-3">
<img src="" class="img-responsive" style="height: 196px;" height="196" />
</div>
<div class="col-md-9">
<div class="title">Title</div>
<div>Link1</div>
</div>
</div>
</div>
.search-result-box {
display: table;
width: 100%;
}
.row {
display: table-row;
}
.row > * {
display: table-cell;
}
.col-md-3 {
background: orange;
width: 260px;
height: 196px;
}
.col-md-9 {
vertical-align:top;
background: grey;
}
.title {
background: #ccc;
width: 100%;
height: 150px;
}
http://jsfiddle.net/junkie/fAPQ6/2/
I'm struggling with getting identical behaviour for a flexbox layout in different browsers (nevermind browsers that don't support flexbox).
Here's the markup:
<!-- nested version -->
<div class="flex-container"> <!-- display: flex -->
<div>
<div class="flex-container inner"> <!-- display: flex -->
<div class="auto-width">
auto take up needed space
</div>
<div class="flex-width"> <!-- flex: 1 -->
flex take up remaining space
</div>
</div>
</div>
</div>
My problem is that IE11 behaves differently to Firefox and Chrome. I would expect that the width of the nested flexbox flex-container.inner will be unrestricted, since nowwhere do I set any width.
Here is a JSBin to illustrate the problem: http://jsbin.com/pabesaci/5. Example 3 is the problematic one which renders differently in IE.
Rendering in IE
Rendering in Chrome (FF is similar)
Is this a bug in IE?
Can you suggest other ways to achieve this layout?
<p>My example:</p>
<div style="float:left; display:block; width: auto; border: solid 2px red; padding: 2px;">
<div>
<div style="float:left; display: block; border: solid 2px yellow; padding:2px;">
<div style="float:left; display: block; border: solid 2px green;">
auto take up needed space
</div>
<div class="" style="float:left; position:relative; display:block; border: solid 2px blue;">
flex take up remaining space
</div>
</div>
</div>
</div>
We have HTML with CSS:
<div style="width: 80%"><!--This width can be different or expressed in % -->
<div>
<div style="width: 50%; background-color: blue; display: inline-block;">
<br/>A<br/>B<br/>C<br/>D<br/>E<br/>F<br/>G<br/>H<br/>I<br/>
</div><!--
--><div style="width: 50%; background-color: brown; display: inline-block;">
<br/>A<br/>B<br/>C<br/>D<br/>E<br/>F<br/>G<br/>H<br/>I<br/>
</div>
</div>
<div style="height: 110px; overflow-y: scroll;">
<div style="width: 50%; background-color: yellow; display: inline-block;">
<br/>A<br/>B<br/>C<br/>D<br/>E<br/>F<br/>G<br/>H<br/>I<br/>
</div><!--
--><div style="width: 50%; background-color: green; display: inline-block;">
<br/>A<br/>B<br/>C<br/>D<br/>E<br/>F<br/>G<br/>H<br/>I<br/>
</div>
</div>
</div>
And a result:
All divs have 50% width, but bottom ones are narrower, because of scroll bar. I know I could calculate scroll bar width and make top ones narrower, but is there better solution? Solution using HTML/CSS only is preferred.
Fiddle here: http://jsfiddle.net/s6rhs/6/
You can use custom jquery scroll bars for your page with the help of some jquery plugins like these
https://github.com/inuyaksa/jquery.nicescroll
So that you won't have trouble with default scrollbars of the browsers.
You could use flex layout, introduced in CSS3. Maybe there are too many browsers out there, you want to support, but they could use your current "solution".
Support: http://caniuse.com/#search=flex
If there's a scrollbar, your right container is a little smaller depending on the width of the scrollbar, but that shouldn't be noticed by users.
At the moment, the background scrolls out, but I think you'll find a solution for that.
Now, my answer isn't only text, there's also some code and a jsfiddle for you:
CSS
.flex {
display: flex;
flex-direction: row;
width: 100%;
}
.flex > div {
flex-grow: 1;
}
.flex > div:first-of-type {
width: 250px;
flex-grow: 0;
}
HTML
<div style="width: 500px">
<div class="flex">
<div style="background: green">
<br/>A
<br/>B
<br/>C
<br/>D
<br/>E
<br/>F
<br/>G
<br/>H
<br/>I
<br/>
</div>
<div style="background: yellow">
<br/>A
<br/>B
<br/>C
<br/>D
<br/>E
<br/>F
<br/>G
<br/>H
<br/>I
<br/>
</div>
</div>
<div class="flex" style="height: 110px; overflow-y: scroll;">
<div style="background: blue">
<br/>A
<br/>B
<br/>C
<br/>D
<br/>E
<br/>F
<br/>G
<br/>H
<br/>I
<br/>
</div>
<div style="background: red">
<br/>A
<br/>B
<br/>C
<br/>D
<br/>E
<br/>F
<br/>G
<br/>H
<br/>I
<br/>
</div>
</div>
</div>