DIV shows behind Google Maps Div rather than under it - html

I have a react component that renders a google map as follows:
<div style={{ textAlign: "center" }}>
<h3>This is header text.</h3>
<div>
<LocationHeatMap
center={{ lat: 43.589, lng: -79.644 }}
zoom={11}
positions={data}
/>
</div>
<div style={{ textAlign: "center" }}>
This is some more text. PROBLEM IS WITH THIS.
</div>
</div>
The LocationHeatMap container returns the following
<div className="map-container">
<Map
google={this.props.google}
style={{width: '100%', height: '80%', position: 'relative'}}
className={"map"}
zoom={this.props.zoom}
initialCenter={this.props.center}
onReady={this.handleMapReady}
>
<HeatMap
gradient={gradient}
positions={this.props.positions}
opacity={1}
radius={10}
maxIntensity={50}
/>
</Map>
</div>
But when it renders the problem text appears behind the map div, rather than under it. I have tried position: relative on both the map div, the text div, tried virtually every display and block settings in the browser, but none of them do it. The only thing that works is if I add a top class in css for the text div, but that has its own problems in responsive design. And I am also pretty sure that the top is being applied relative to the header text and not the google map. What can I do to make the problem text appear relatively under the google map.

I know from past experience you can run into issues with a maps div by not using an explicit height. I have included an adjustment below. Hope it helps :)
<div style={{ textAlign: "center" }}>
<h3>This is header text.</h3>
<div class="row">
<div className="map-container row">
<div class="map" google={this.props.google} style={{width: '100%', height: '80%', position: 'relative'}} className={"map"} zoom={this.props.zoom} initialCenter={this.props.center} onReady={this.handleMapReady}>
<HeatMap gradient={gradient} positions={this.props.positions} opacity={1} radius={10} maxIntensity={50} />
</div>
</div>
</div>
<div class="row" style={{ textAlign: "center" }}>
This is some more text. PROBLEM IS WITH TH IS.
</div>
</div>
<style>
.row {
width: 100%;
background-color: lightblue;
}
.map {
width: 100%;
min-height: 200px;
background-color: yellow;
}
</style>
The other thing is making sure the divs are full width:
You can check out an example here:
CodePen Example

Related

React Bootstrap container different sizing to regular HTML Bootstrap

Why does the Bootstrap container component size differently than a regular HTML Bootstrap, not sure if I am missing a prop or not?
This is what I get the output I get for both:
(the white space in the sides are from the container margin)
React code:
<Container>
<Row className="row">
<Col className="col-lg-3 col-md-4">
<div
style={{ width: "100%", height: "100vh", backgroundColor: "blue" }}
></div>
</Col>
<div className="col-lg-9 col-md-8 tab-container">
<div
style={{ width: "100%", height: "100vh", backgroundColor: "red" }}
></div>
</div>
</Row>
</Container>
Regular HTML code:
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-4">
<div style="width: 100%; height: 100vh; background-color: blue"></div>
</div>
<div class="col-lg-9 col-md-8">
<div style="width: 100%; height: 100vh; background-color: red"></div>
</div>
</div>
</div>
Can someone help with the correct styling/fix for the React version to match the regular one please?

div alignment is not coming properly

I want - box to come exactly below + box as shown in the attached image
I have tried this code given below but does not work. Can someone tell me what changes I need to make in the css. This is part of reactjs application.
<div style={{width:"20%",float:"left"}}>
<input type="text" style={{width:"50px",height:"60px",marginLeft:"20px",marginTop:"20px",float:"left"}}/>
<div style={{fontSize:"25px",fontWeight:"bold", width:"30px",float:"left",border:"1px solid #eee", marginTop:"20px",marginLeft:"5px",textAlign:"center"}}><a href="#" style={{textDecoration:"none"}}>+</a></div>
<div style={{fontSize:"25px",fontWeight:"bold", width:"30px",float:"left",border:"1px solid #eee", marginTop:"20px",marginLeft:"5px",textAlign:"center"}}><a href="#" style={{textDecoration:"none"}}>-</a></div>
</div>
Wrap your +/- boxes in a div and use display: flex with flex-direction: column styles on the wrapper div like
<div style={{width:"20%",float:"left"}}>
<input type="text" style={{width:"50px",height:"60px",marginLeft:"20px",marginTop:"20px",float:"left"}}/>
<div style={{display: 'flex', flexDirection: 'column' }}>
<div style={{fontSize:"25px",fontWeight:"bold", width:"30px",float:"left",border:"1px solid #eee", marginTop:"20px",marginLeft:"5px",textAlign:"center"}}><a href="#" style={{textDecoration:"none"}}>+</a></div>
<div style={{fontSize:"25px",fontWeight:"bold", width:"30px",float:"left",border:"1px solid #eee", marginTop:"20px",marginLeft:"5px",textAlign:"center"}}><a href="#" style={{textDecoration:"none"}}>-</a></div>
</div>
</div>
Wrapp em in div with flex
<div style={{ display: 'flex', flexDirection: 'column' }}>
</div>

Changing Bootstrap's responsiveness

First of all, I am really new to Bootstrap so please excuse my newbiness.
The problem is that I am trying to create some sort of a thread list and when I shrink the width of the page all the contents keep moving down one another.
This is what I want:
http://img04.imgland.net/CmWzwDR.png
Things just becoming smaller and nothing going out of place
This is what happens:
http://img04.imgland.net/hNKc_Ok.png
Ya its pretty bad
Do you guys know of any way to fix this problem? I don't have to use bootstrap, but I thought it would be easiest.
Thanks
<div style={{marginTop: "80px", marginLeft: "20px", marginRight: "20px"}}>
<div style = {{height: "80px", marginBottom: "10px", padding: "1px 1px 1px 1px", border: "2px solid #000000"}} class="row-fluid" >
<div class = "col-xs-2" style= {{width: "20px", float: "left"}}>
<div class = "row" >
<img src="img/upvote.png" />
<img src="img/downvote.png" />
</div>
</div>
<div class = "col-xs-2" style={{width: "100px", marginLeft: "0px", padding: "0px 0px 0px 0px", float: "left"}}>
<img src={thumbnail} style={{height: "80px", width: "100px"}}/>
</div>
<div class = "col-xs-8" style= {{marginLeft: "10px"}}>
<div class = "row">
<h3 style = {{height: "50px", textAlign: "left", marginTop: "0px", marginBottom: "0px", padding: "0px 0px 0px 0px"}}> {title} </h3>
<p style = {{height: "30px", textAlign: "left", marginBottom: "0px", padding: "0px 0px 0px 0px", overflow: "hidden"}}> {desc} </p>
</div>
</div>
</div>
</div>
Currently this is my site on desktop screen:
img.imgland.net/5VBEme.png
And then this is what it would look like on mobile: img02.imgland.net/cr-MUQd.png
Without explicit samples of your code, I assume it has something to do with the grid prefix you are using. Take a look at http://getbootstrap.com/css/#grid-options which shows the 4x different prefixes:
.col-xs-*
.col-sm-*
.col-md-*
.col-lg-*
To control the behaviour of your layout on mobile resolutions use the .col-xs-* class. Bootstrap documentation gives a great example: http://getbootstrap.com/css/#grid-example-mixed
The above exmaple shows how to mix classes to have different behaviour on different resolutions:
<div class="row">
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
</div>
Using this code will have your columns start at 50% wide on mobile and bump up to 33.3% wide on desktop. Using these combinations allows you to have quite a fine control over layout across all container resolutions.
EDIT BASED ON CODE SUPPLIED:
<div class="container-fluid">
<div class="row">
<div class="col-xs-2">
<img src="img/upvote.png" />
<img src="img/downvote.png" />
</div>
<div class="col-xs-2">
<img src="#" />
</div>
<div class="col-xs-8">
<h3>{title}</h3>
<p>{desc}</p>
</div>
</div>
</div>
Pay close attention to the Bootstrap docs which show how to use containers and the grid system. I would also take note of the Column nesting as this is a great way to show columns contained within columns: http://getbootstrap.com/css/#grid-nesting
EDIT BASED ON SECONDARY QUESTION
Use the element inspector function in your browser to have a detailed look at your CSS classes and what is creating the padding between columns. You can then call your own custom.css file (or re-compile if you are competent with Less) which overrides the default Bootstrap styling. This will remove the left and right padding in the example code I have supplied:
.col-xs-2, .col-xs-8 {
padding-right: 0px;
padding-left: 0px;
}

Carousel behind transparent cutout in PNG image

Having issues with what I assumed would be a simple task, maybe just need another set of eyes.
We have a banner image and on the right side is a computer monitor. the "screen" has been cut out so that portion of the banner is transparent (.PNG).
I need to place a carousel behind the cutout image, so that it gives the impression that the carousel is "playing" on the screen.
Right now I am trying to do this with Slick Carousel but if anyone else has a recommendation for a better carousel that is also responsive I'm open.
http://codepen.io/tconroy/pen/ZYRaRd
Above is a codepen of what I have so far -- The main issue I am encountering is that the slides are in front of the image content (overlapping the image), when it should be behind the image content (playing behind the banner, and just visible through the transparent "gap" in the screen).
I've used placeholder images for the slides, however those are the actual dimensions of each image we will be using. The images should be "centered" in their slide, with the background color visible. (basically the images are being overlaid onto the colored slides).
HTML
<div class="inner-wrap">
<header>
<div class="contain-to-grid">
<div class="inner-carousel-wrapper">
<div class="inner-carousel">
<div class="slide yellow">
<img class="" src="http://lorempixel.com/350/347/sports" alt="">
</div>
<div class="slide purple">
<img class="" src="http://lorempixel.com/416/347/abstract" alt="">
</div>
<div class="slide red">
<img class="" src="http://lorempixel.com/381/346/city" alt="">
</div>
<div class="slide blue">
<img class="" src="http://lorempixel.com/338/346/transport" alt="">
</div>
<div class="slide green">
<img class="" src="http://lorempixel.com/343/347/nature" alt="">
</div>
<div class="slide orange">
<img class="" src="http://lorempixel.com/361/347/cats" alt="">
</div>
</div> <!-- .inner-carousel -->
<img src="http://i.imgur.com/HodKXD4.png">
</div> <!-- .inner-carousel-wrapper -->
</div>
</header>
</div>
<section class="container">
Notice how the "slides" above are overlapping the ipad square (bottom right of monitor)? The slides should appear "behind" the ipad.
</section>
SCSS
$lesson-blue: #33B2E6;
$lesson-green: #26B789;
$lesson-orange: #F58231;
$lesson-yellow: #FFD648;
$lesson-red: #E43533;
$lesson-purple: #616373;
.inner-carousel-wrapper {
background: black;
}
.inner-carousel {
position: absolute;
float: right;
margin-left: 54.3%;
margin-top: 6.0%;
width: 45.7%;
height: 76%;
}
.inner-carousel .slide {
&.blue {background: $lesson-blue; }
&.green {background: $lesson-green;}
&.orange {background: $lesson-orange;}
&.yellow {background: $lesson-yellow;}
&.red {background: $lesson-red;}
&.purple {background: $lesson-purple;}
img {
margin: 0 auto;
padding: 6%;
width: 60%;
}
}
JS
$('.inner-carousel').slick({
accessibility: false,
autoplay: true,
autoplaySpeed: 2500,
arrows: false,
draggable: false,
slide: '.slide'
});
I'm not sure if this is an option for you or not, but you can assign an id to your background image, give it absolute positioning and then alter its z-index. Something like this should work:
HTML
<img id="bg" src="http://i.imgur.com/HodKXD4.png">
CSS
#bg {position:absolute;z-index:2;}
http://codepen.io/anon/pen/ZYRaNE
A couple things together fix this:
.contain-to-grid {
/* background: #333; */
}
.inner-carousel-wrapper {
/* background: black; */
}
.inner-carousel {
z-index: -1;
}
Demo
You'll need to adjust sizing/position a bit, but it should work otherwise.

ContentPane doesn't scroll when nested inside other ContentPanes

I am using a Dojo Dialog that contains a TabContainer which has a ContentPane that contains both an image and a nested ContentPane with text. I would like the nested ContentPane to scroll, but I don't want its parent container with the image to scroll.
<div data-dojo-type="dijit/Dialog" data-dojo-id="dialogWelcome" data-dojo-props="title: 'About'" style="width: 650px; align-content: center;">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'center'">
<div data-dojo-type="dijit/layout/TabContainer" data-dojo-props="style: {width: '100%', height: '600px'}">
<div data-dojo-type="dijit/layout/ContentPane" id="divContainer" data-dojo-props="title: 'Project Introduction', style: {overflow: 'hidden'}">
<img id="projectImage" src="../images/island.png" />
<div data-dojo-type="dijit/layout/ContentPane" id="divDialogMessage" data-dojo-props="style: {overflow: 'auto', padding: 0}">
about this project
</div>
</div>
The content of "divDialogMessage" is added dynamically. This gives me the following dialog
If I change the style of divContainer to
<div data-dojo-type="dijit/layout/ContentPane" id="divContainer" data-dojo-props="title: 'Project Introduction', style: {overflow: 'auto'}">
then I get what I don't want, which has the parent ContentPane with both image and text scrolling.
What's the correct syntax to only have the text ContentPane scroll?
You would need to explicitly give your inner ContentPane a height via CSS too, otherwise there's nothing constraining it to need to handle overflow in the first place.
Example with minimal modification to your code:
<div data-dojo-type="dijit/Dialog" data-dojo-id="dialogWelcome" data-dojo-props="title: 'About'" style="width: 650px; align-content: center;">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'center'">
<div data-dojo-type="dijit/layout/TabContainer" data-dojo-props="style: {width: '100%', height: '600px'}">
<div data-dojo-type="dijit/layout/ContentPane" id="divContainer" data-dojo-props="title: 'Project Introduction'">
<img id="projectImage" src="../images/island.png" />
<div data-dojo-type="dijit/layout/ContentPane" id="divDialogMessage" data-dojo-props="style: {overflow: 'auto', padding: 0, height: '500px'}">
about this project
</div>
</div>
</div>
</div>
</div>
Unrelated:
Avoid using data-dojo-id since it creates global variables. Assign an id then use dijit/registry.byId to retrieve widgets when necessary.
Whenever possible, prefer actual stylesheets to inline styles.
You need to set the height of the ContentPane equal to the size you would like the text to occupy.
<div data-dojo-type="dijit/layout/ContentPane" id="divDialogMessage" data-dojo-props="style: {overflow: 'auto', padding: 0, height: '150px'}">
lots of text goes here to make overflow...
</div>
Here is a working example: http://jsfiddle.net/kagant15/0s21v90g/