How to align Google Maps Iframe and a box? - html

I want to align the Google Maps box and the text bow in the same line, but I can't.
I've already tried with position: relative and changed the top and left sizes, but despite they were aligned, a huge blank space took place on the bottom.
.ind-mapa {
position: relative;
overflow: hidden;
padding-top: 56.25%;
z-index: 1;
}
.resp-iframe {
position: absolute;
top: 0;
left: 0;
border: 0;
z-index: 1;
}
.ind-media {
float: left;
border: 0.5px #f6e8d5 solid;
overflow: auto;
margin-left: 50vw;
border-radius: 10px;
box-shadow: 3px 3px 5px 3px #cccccc;
z-index: 1;
}
<div class="ind-contato">
<div class="ind-mapa" style="display: inline-block;">
<iframe class="resp-iframe" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6150.579385265073!2d-46.595158112257735!3d-23.56282631464785!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x94ce5eb2bb2e0fd7%3A0x598f639056140b1f!2sR.+do+Orat%C3%B3rio%2C+1036+-+Mooca%2C+S%C3%A3o+Paulo+-+SP%2C+03118-030!5e0!3m2!1spt-BR!2sbr!4v1548656882243"
frameborder="0" style="border-radius: 10px; border: 0.5px #f6e8d5 solid; box-shadow: 3px 3px 5px 3px #cccccc;" align="left" allowfullscreen></iframe>
<div class="ind-media" style="display: inline-block;">
</div>
</div>

Flex layout does the trick:
.ind-mapa {
position: relative;
display: flex;
}
.ind-mapa>* {
flex: 0 1 auto;
border-radius: 10px;
box-shadow: 3px 3px 5px 3px #ccc;
z-index: 1;
}
.resp-iframe {
flex: 0 0 auto;
margin-right: 20px;
}
<div class="ind-mapa">
<iframe class="resp-iframe" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6150.579385265073!2d-46.595158112257735!3d-23.56282631464785!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x94ce5eb2bb2e0fd7%3A0x598f639056140b1f!2sR.+do+Orat%C3%B3rio%2C+1036+-+Mooca%2C+S%C3%A3o+Paulo+-+SP%2C+03118-030!5e0!3m2!1spt-BR!2sbr!4v1548656882243"
frameborder="0" allowfullscreen></iframe>
<div class="ind-media">
I want to align the Google Maps box and the text bow in the same line, but I can't. I've already tried with position: relative and changed the top and left sizes, but despite they were aligned, a huge blank space took place on the bottom.
</div>
</div>

CSS Flexbox will do the job, see: https://www.w3schools.com/css/css3_flexbox.asp and https://css-tricks.com/snippets/css/a-guide-to-flexbox/
See snippet with a minimal working sample.
Also you did not close the div's properly.
I've already tried with position: relative and changed the top and
left sizes, but despite they were aligned, a huge blank space took
place on the bottom.
On your code, the MAP is not getting the full height because you positioned the iframe as position: absolute; and did not set the height, so if you set .resp-iframe with height: 100%; the iframe will be at the same height as it's parent.
Viva Mooca bella!
.ind-contato {
display: flex;
}
.ind-contato > div,
.ind-contato > iframe {
flex: 0 0 50%;
box-shadow: 3px 3px 5px 3px #ccc;
border-radius: 10px;
box-shadow: 3px 3px 5px 3px #ccc;
}
<div class="ind-contato">
<iframe class="resp-iframe" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6150.579385265073!2d-46.595158112257735!3d-23.56282631464785!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x94ce5eb2bb2e0fd7%3A0x598f639056140b1f!2sR.+do+Orat%C3%B3rio%2C+1036+-+Mooca%2C+S%C3%A3o+Paulo+-+SP%2C+03118-030!5e0!3m2!1spt-BR!2sbr!4v1548656882243"
frameborder="0" allowfullscreen></iframe>
<div class="ind-media">
Box on the side.
</div>
</div>

Related

How to create a preview of another html page that is always 16:9 [duplicate]

This question already has answers here:
Maintain the aspect ratio of a div with CSS
(37 answers)
Closed 3 years ago.
I'm creating a really basic webpage editor where you can create "slides" which then can later be displayed somewhere else.
So in order to do that i've created the following page:
The left side is the preview and the right side is the editor where you can set certain properties of a paragraph. Basically both are
float: left;
height: 100%;
width: 50%;
padding: 2%;
Now i want the preview to always be in the ratio of 16:9 so it gives an accurate preview
This is my current code
<div class="leftItem">
<div class="leftArrow"></div>
<div class="preview">
<!-- Here is the text that gets edited -->
</div>
<div class="rightArrow"></div>
</div>
.leftItem {
height: 95%;
width: 50%;
float: left;
display: flex;
align-items: center;
justify-content: center;
}
.preview {
display: block;
width: 90%;
height: 40vh;
border-style: solid;
border-width: 1px;
-webkit-box-shadow: 2px 2px 5px 1px rgba(0,0,0,0.2);
-moz-box-shadow: 2px 2px 5px 1px rgba(0,0,0,0.2);
box-shadow: 2px 2px 5px 1px rgba(0,0,0,0.2);
}
You can do this by adding a padding bottom to a box inside the box you want to size. After that you will have to add content in a seperate child and position it absolute, as the new sized box will otherwise push all contents out. The important bit is this:
.preview:after {
display: block;
content: '';
padding-bottom: calc(100% / 16 * 9);
width: 100%;
}
It looks like this:
.preview:after {
display: block;
content: '';
padding-bottom: calc(100% / 16 * 9);
width: 100%;
}
.preview .content {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.leftItem {
height: 95%;
width: 50%;
float: left;
display: flex;
align-items: center;
justify-content: center;
}
.preview {
position: relative;
display: block;
width: 90%;
border-style: solid;
border-width: 1px;
-webkit-box-shadow: 2px 2px 5px 1px rgba(0,0,0,0.2);
-moz-box-shadow: 2px 2px 5px 1px rgba(0,0,0,0.2);
box-shadow: 2px 2px 5px 1px rgba(0,0,0,0.2);
}
<div class="leftItem">
<div class="leftArrow"></div>
<div class="preview">
<div class="content">
<!-- Here is the text that gets edited -->
</div>
</div>
<div class="rightArrow"></div>
</div>

Hover Overlap Issue With a List of boxes

I am dynamically creating a bunch of cards. These cards will have an image and some text. When hovering over the image within the card, a bigger image is displayed in the middle of the page.
There are a total of 16 cards on the page. There are four rows with 4 cards in each row. The issue is: when hovering over the 1st card, all the text or images of the next 15 cards overlap the large image that appears when hovering over the small image on the 1st card. When hovering over let’s say the 3rd card, the image is only overlapped by the text/images of cards that appear after that 3rd card. If I hover over the image of the last card on the page, this issue does not occur. Therefore, all the div’s after the card that is being hovered over cause this issue of overlapping.
Things I have tried: z-index which does not work because each card is being generated dynamically. I have also tried to change the position: static or inherit to see if that would help.
Not sure what the problem is and how to fix it?
<div class="biz-card center-block">
<div class="biz-container">
<div class="biz-row">
<div class="col-sm-6">
<div class="biz-photo">
<div class="rounded biz-wrapper"></div>
</div>
</div>
<div class="col-sm-6" style="display: flex;">
<div class="biz-content">
<h6 href="#home">John Doe</h6>
<p class="left-align">Name</p>
</div>
</div>
</div>
</div>
</div>
.biz-card {
min-width: 350px;
max-width: 350px;
min-height: 250px;
max-height: 250px;
border: thin;
border-color: lightgrey;
box-shadow: 3px 6px 6px -2px rgba(0,0,0,0.58);
z-index: 1;
}
.biz-container {
padding-right: 0;
padding-left: 0;
margin-right: auto;
margin-left: auto;
height: 250px;
}
.biz-row {
display: flex;
align-items: center;
margin-left: auto;
margin-right: auto;
margin-bottom: 20px;
height: 250px;
}
.biz-photo {
position: relative;
display: block;
width: 145px;
height: 64px;
}
.biz-photodetailed {
display: none;
background: #424242;
opacity: 1;
filter: alpha(opacity=100); /* For IE8 and earlier */
z-index: 1000;
bottom: 0;
height: 848px;
width: 605px;
/*margin: auto;*/
position: fixed;
top: 50%;
left: 50%;
margin-top: -424px; /* Half the height */
margin-left: -302px; /* Half the width */
border: 2px solid #fff;
box-shadow: 10px 10px 5px #ccc;
-moz-box-shadow: 10px 10px 5px #ccc;
-webkit-box-shadow: 10px 10px 5px #ccc;
/*-khtml-box-shadow: 10px 10px 5px #ccc;*/
}
.biz-photo:hover .biz-photodetailed {
display:block;
}
Would anyone be able to help out?

Displaying a div inside an another one

I have a parent div which has overflow:hidden. Inside a parent div, there is a dynamic div which height is more than the height of the parent div. How can I make the child div to be displayed as it is? Now it will be clipped because of the height of the parent div. I do not want to allow scrollbars to be displayed.
<div style="width: 10000em; margin-left: -5000em; position: relative; left: 50%; text-align: center; margin-left: auto; margin-right: auto; margin-top: 0; margin-bottom: 0; background-color: transparent; overflow:hidden;">
<div style="width:100%;top:5px;left:150px;position:absolute;z-index:5000;background-color:#323B5A;-webkit-box-shadow: 0px 0px 5px 5px rgba(255,255,255,0.85);-moz-box-shadow: 0px 0px 5px 5px rgba(255,255,255,0.85);box-shadow: 0px 0px 5px 5px rgba(255,255,255,0.85);">
sgssgsgsgsdgsdgsgsg<br>aafafafafa<br>sgggdgdsgsgsdgdg
</div>
</div>
Update
It seems to me that this would work just fine. But I do not want to use position:relative with the child div.
<div style="width: 10000em; margin-left: -5000em; position: relative; left: 50%; text-align: center; margin-left: auto; margin-right: auto; margin-top: 0; margin-bottom: 0; background-color: transparent; overflow:hidden;">
<div style="width:100%;top:5px;left:150px;position:relative;z-index:5000;background-color:#323B5A;-webkit-box-shadow: 0px 0px 5px 5px rgba(255,255,255,0.85);-moz-box-shadow: 0px 0px 5px 5px rgba(255,255,255,0.85);box-shadow: 0px 0px 5px 5px rgba(255,255,255,0.85);">
sgssgsgsgsdgsdgsgsg<br>aafafafafa<br>sgggdgdsgsgsdgdg
</div>
</div>
You could add a position:absolute to take the inner div out of the flow.
If you take the child div out of flow, using position fixed or absolute, than it would be visible. But please note: the parent div must remain static:
.holder {
position: relative;
}
.parent {
overflow: hidden;
height: 100px;
border: 1px solid blue;
}
.child {
position: absolute;
left: 10px;
top: 10px;
right: 10px;
height: 200px;
border: 1px solid red;
}
<div class="holder">
<div class="parent">
<div class="child">Visible?</div>
</div>
</div>
Also on JSFiddle.

Create inset window boxshadow border with space between actual window and border

I want to create the white border seen in the image below with CSS. White border that is set 25px inside the window. Iv'e tried to use box-shadow inset however was not able to create the space between the edge of the window.
I used this css:
border: 3px solid white; //took this out but still no luck
box-shadow: inset 0 0 0 5px #FFFFFF;
I also tried without the normal border as well.
I think I can create an overlay div that has a padding or margin and give it a border, but the problem is the content needs to be scrollable and clickable below it.
The goal:
The white box just above the icons.
Use a pseudo element
.parent {
position: relative;
height: 200px;
}
.wrapper {
height: 100%;
overflow-y: auto;
}
.content {
height: 600px;
background: url(http://lorempixel.com/600/600/abstract/1) no-repeat center center / cover;
}
.parent:after {
content: '';
position: absolute;
left: 25px;
top: 25px;
right: 40px;
bottom: 25px;
border: 2px solid white;
}
<div class="parent">
<div class="wrapper">
<div class="content">
</div>
</div>
</div>
Use a transparent border to set the shadow where you want it.
The remaining problem is to extend the image to the borders. Use background-origin for this.
.test {
height: 250px;
width: 400px;
background-image: url(http://lorempixel.com/600/400);
background-origin: border-box;
background-size: cover;
border: 50px transparent solid;
box-shadow: inset 0px 0px 5px 5px cyan;
}
<div class="test">
</div>
hope this help.
body{
background: #000;
}
.wrapper{
width: 500px;
padding: 25px;
border: 3px solid #CCC;
}
.content{
border: 1px solid #fff;
padding: 15px;
color: #fff;
height: 400px;
}
<div class="wrapper">
<div class="content">
this is your content div with white border
</div>
</div>

top space issue with CSS relative position

Can't get the form to be INSIDE the frame for the life of me when using relative position. In absolute it works, but changes spots depending on window size.
Help!
Here's the outcome
http://orange-restoration.com/water-damage-24-hour-help/
Set
<div id="main">
to position:relative, then set your
<div id="main-form">
to position:absolute
<div id="main-form">
<H3>Let us call YOU back </H3>
<script type="text/javascript" src="http://form.jotform.com/jsform/92640718225"></script>
</div>
CSS:
#main-form
{
position: relative;
top: 300px;
left: 600px;
width: 300px;
height: 220px;
margin: 1px;
background-color: white;
padding: 10px 30px 30px 30px;
border-radius: 15px;
z-index: 1000;
box-shadow: 5px 5px 3px #888888;
border-style:solid;
border-width:1px;
border-color:#888888:
}