this is how it looks on desktop
I have an image that has the full width of the screen width: 100%;
Specifically this image is a map, in the whole center of the map there is a "path", with the points that when clicking, some manners appear,
The problem is that I don't know how to make that huge sensitive map so that it can be seen well on different devices, what I was thinking is what an overflow is but I really don't know how to do it so only the left part of the image is shown
This is the code:
.map-container {
padding: 3.2rem .8rem;
position: relative;
display: inline-block;
margin: 0 auto;
background-color: $blue;
}
.img-map {
width: 100%;
}
<div class="container-fluid">
<div class="row">
<div class="map-container">
<img class="img-map" src="public/images/mapa.svg">
<div id="step1" class="point argentina"></div>
<div id="step2" class="point brasil"></div>
<div id="step3" class="point venezuela"></div>
<div id="step4" class="point colombia"></div>
<div id="step5" class="point panama"></div>
<div id="step6" class="point mexico"></div>
<div class="mod-paso-1">
<div class="mod-info">
<p><b>XXXXXXXXXX</b></p>
<p><b>XXXXXXXXX</b></p>
<p><b>XXXXXXXX</b></p>
<P>XXXXX</P>
</div>
</div>
</div>
</div>
</div>
You who recommend me to make this map responsive?
"-Cut the image for each resolution?"
If you need more details, I am attentive
Thanks in advance.
Add 100% width to your map container so the image width can take 100% of the screen whether on desktop or mobile:
.map-container {
width: 100%;
padding: 3.2rem .8rem;
position: relative;
display: inline-block;
margin: 0 auto;
background-color: blue;
}
May be this would help you
.img-map {
width: 100%;
height: 100%;
object-fit: contain;
}
I've also tried to fiddle around a bit with this issue.
you will have to open on mobile view because I only focused on that for now.
Here is the codepen
https://codepen.io/Spoochy/pen/LYYQzPv
I combined object-fit:cover and viewport heights
However, object-fit is quite new (as far as I know) and might not be fully compatible for all browsers. so I would suggest to always check the Can I use Tables before using unknown properties.
https://caniuse.com/#search=object-fit
Related
Context:
I am trying to create 3 charts on 1 row (each has a minimum width) such that on window resize, the charts should also resize and may go to next row depending on the browser total width.
Problem:
Currently, I am missing something in the css because the chart is overflowing within the demo container below. The tooltip looks fine, but only half of the chart is seen in the container and both the axes are also hidden.
Has someone implemented something similar before? I want to understand how to load the charts in the div.
P.S. In the code below, highcharts-container is the inbuilt div which contains the charts. I am using the latest version of Highcharts and Angular 7.
My current html code -->
<div class="container-fluid">
<div class="row">
<div class="col-lg-4 col-md4 demo>
<div class="demo-container">
<highcharts-chart [Highcharts]="Highcharts" [options]="options1" [callbackFunction]="cb1">
</highcharts-chart>
</div>
</div>
<div class="col-lg-4 col-md4 demo>
<div class="demo-container">
<highcharts-chart [Highcharts]="Highcharts" [options]="options2" [callbackFunction]="cb2">
</highcharts-chart>
</div>
</div>
<div class="col-lg-4 col-md4 demo>
<div class="demo-container">
<highcharts-chart [Highcharts]="Highcharts" [options]="options3" [callbackFunction]="cb3">
</highcharts-chart>
</div>
</div>
</div>
</div>
My css code (The main part) -->
.container-fluid{
width:100%
}
.demo{
margin: 20px 0;
min-width: 448px;
}
.demo-container{
position: relative;
border: 1px solid transparent;
box-shadow: 0 0 20px #1793f5;
width: 100%;
height: 100%;
}
.highcharts-container{
height: 100% !important;
width: 100% !important;
display: inline-block;
vertical-align: middle;
}
You could try to include the following CSS as a part of demo-container or container-fluid... one of it should do the deal for you.
height: 100% !important;
width: 100% !important;
Update
one of the harder challenges i have encountered, but add this to the style.css
and you have your contents dynamic inside its container.
.highcharts-background, .highcharts-root, .highcharts-container {
max-height: 100%;
max-width: 100%;
}
is this what you are looking for?
This was made using images of the graphs in the links you posted. I also used flexboxes which seems to be what you are looking for.
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
.container-fluid div {
width: auto;
border: 2px solid red;
min-width: 33%;
}
.container-fluid{
display: flex;
flex-wrap: wrap;
border: 2px solid blue;
justify-content: center;
}
<div class="container-fluid">
<div class="chartOne">
<img src="https://i.gyazo.com/161954d0841b7a398d5f0d63e1b2bcc4.png" alt="">
</div>
<div class="chartOne">
<img src="https://i.gyazo.com/161954d0841b7a398d5f0d63e1b2bcc4.png" alt="">
</div>
<div class="chartOne">
<img src="https://i.gyazo.com/161954d0841b7a398d5f0d63e1b2bcc4.png" alt="">
</div>
</div>
I am trying to build an image-focussed page, where all images resize flexibly within fixed-sized containers. The containers are set up in two rows; the first are three 4-spaced columns each with an image (following bootstrap), and the second row is a 12-spaced column, filled with one image.
Ideally, I want them to show this behavior:
- If they are wider than the container, I want the image to be resized and centered, until the image border meets the container either heightwise or widthwise. Any corresponding spillover will be cut-off.
Overflow already cuts them off; align-self should center them; object-fit covers the image; but I don't know how to make it behave the way as I described above.
Thanks very much for having read this far, and thank you even more if you are willing to help me out ^^
The website
Code:
.img-responsive {
width: auto;
margin-left: auto;
margin-right: auto;
display: block;
position: relative;
align-self: center;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
object-fit: cover;
}
.col-4 {
min-height: 20px;
max-height: 300px;
padding: 0;
overflow: hidden;
}
.col-12 {
min-height: 150px;
max-height: 300px;
padding: 0;
overflow: hidden;
}
<section>
<div class="container-fluid">
<div class="row">
<div class="col-4 hoveropacity">
<img class="img-responsive" src="https://vietnamtravel.guide/wp-content/uploads/2015/04/Banh-Mi-Vietnam.jpg" );>
</div>
<div class="col-4 hoveropacity">
<img class="img-responsive" src="https://s.iha.com/00125194526/Hanoi-municipality-Street-market-in-hanoi.jpeg" );>
</div>
<div class="col-4 hoveropacity">
<img class="img-responsive" src="https://i.pinimg.com/736x/da/86/35/da863581a7524e3260b6ba75a8b08cdb--vietnamese-iced-coffee-coffee-latte.jpg" );>
</div>
</div>
</div>
</section>
<section>
<div class="container-fluid">
<div class="row">
<div class="col-12 hoveropacity">
<img class="img-responsive" src="https://www.vietnamtravelblog.info/wp-content/uploads/2011/05/Vietnam.jpg" );>
</div>
</div>
</div>
</section>
NB: I did look around for answers already given, but I couldn't quite find an answer that worked for me. Please forgive any oversight on my part.
Solved! Thanks to #Kangouroops
Added
object-fit: contain;
width: 100%;
height: 100%;
Going mental about that thing: I have a following structure of divs:
<div class="main">
<div class="container">
<div class="column">
<div class="content">
<div class="block"></div> (repeat 4 times)
</div>
</div>
<div class="column">
<div class="content">
<div class="block"></div> (repeat 4 times)
</div>
</div>
<div class="column">
<div class="content">
<div class="block"></div> (repeat 4 times)
</div>
</div>
</div>
</div>
CSS:
.main {
overflow-x: scroll;
width: 400px;
}
.block {
display: block;
width: 300px;
height: 80px;
background-color: blue;
margin: 5px;
}
.container {
width: 1000px;
}
.column {
float: left;
height: 300px;
}
.content {
height: 300px;
overflow: scroll;
}
The idea of this layout it to have one big container, scrolling horizontally, that contains smaller containers that scroll vertically.
Issue: while it works perfectly on android and desktops, can't get it to work on iphone with safari (can't test on chrome for iOS though, don't have access to device). Instead of scrolling the container, iphone scrolls entire page (please try to scroll left-right while keeping finger on blue rectangles). Please see this jsfiddle on iphone.
I do figured out reading stackoverflow and testing by myself that it has something to do with css overflow property, but still can't figure out the solution.
Any ideas please?
So once again the solution was to add -webkit-overflow-scrolling:touch; in the right place of the code. In this case it was the very top main container and get rid of unnecessary overflow properties:
.main {
overflow-x: scroll;
width: 300px;
-webkit-overflow-scrolling:touch;
}
Tested on the emulator, but looks like working now. JSFiddle
first time user of Foundation framework, I've developed all my previous websites with Bootstrap but now I'm forced to built one website with foundation. I noticed they are pretty similar but somehow different frameworks.
I've encountered a problem and hope you can help me with this.
I need to add a banner to a website which is full width and text which is within the grid and has a bg which is also full width, see what I mean here:
Here is my html:
<div class="fullWidth">
<div class="banner">
<div class="logo">
<img src="images/logo.svg"/>
</div>
<div class="row">
<div class="bg-tagline">
<h1 class="tagline">some text here</h1>
</div>
</div>
</div>
</div>
and the css:
.fullWidth {
width: 100%;
margin-left: auto;
margin-right: auto;
max-width: initial;
}
.banner {
background: white url("images/baner.jpg") no-repeat center;
height: 590px;
background-size: cover;
position: relative;
}
.logo {
position: relative;
padding: 1%;
height: 5em;
width: 5em;
}
.bg-tagline {
color: #fff !important;
background-color: white;
width: 100%;
margin: 0px auto;
}
.bg-tagline h1 {
color: #fff !important;
font-size: 1.2em;
text-align: center;
}
As far as I know, there's no a "full width" class in foundation framework; Normally, in those layout types, I'd just use the elements off the framework, for instance:
<header id="banner">
<div class="slogan">Your text banner here</div>
</div>
And of course some CSS like you have already. If you need something elaborated (like a layout using foundation's classes), I'd put inside div.slogan a div.row, and start building layout from there, of course that row would be restricted to the max width from the framework.
BTW, if you need to have the entire framework having a wider width for the rows, you can change the framework settings and re-compile.
Personally, I like to make utility class for rows:
.row.fullwidth {
max-width:100em; // set your override width here
margin: 0 auto;
}
That way whenever I need a full width section I just do:
<div class="row fullwidth">
<!--- content --->
</div>
I'm learning CSS at the moment and I am using it on a website to control the layout of the site.
I Have a number of containers, 5 of them, all on top of each other, I have a background for the page but I also want to use a background for one of the containers. So I used the 'background-image:url("");' tag to use a background, the I also used the attachment, repeat. The problem I was the image wasn't setting itself to the container, it was pushing out way past the dimensions that I had set in my CSS code which were height:312px; and width: 1000px;
Here is the CSS
html, body
{
margin-top: 25px;
padding: 0;
background-image:url("../../images/background.png");
background-repeat: none;
background-attachment: fixed;
}
.hidden
{
display: none;
}
#page-container
{
width: 1000px;
margin: auto;
background: transparent;
}
#header
{
height: 130px;
}
#content-top
{
background: #D9D9D9;
background-image:url("../images/pic.png");
background-repeat: no-repeat;
background-attachment: fixed;
background-position:right top;
height: 312px;
width: 1000px;
}
Here is the HTML:
<div id="page-container">
<div id="header">
<div id="flashContent">
</div>
</div>
<div id="content-top"><!--<img src="images/pic.png">--></div>
<div id="portfolio-container">
<div id="portfolio1"><p>1</p></div>
<div id="portfolio2">2</div>
<div id="portfolio3">3</div>
<div id="portfolio1"><p>4/p></div>
<div id="portfolio2">5</div>
<div id="portfolio3">5</div>
</div>
<div id="main-content">
main-content
</div>
<div id="footer">Footer</div>
</div>
I haven't pasted all of the CSS but its needed let me know.
Its as if the background is filling a space that is a lot bigger than the space specified.
Last time I needed to do something like this, I did the following:
#background{position:absolute; top:0; left:0; width:100%; max-width:1024; max-height:768; height:auto; z-index:-1; }
And then on my page I included the following:
<img id="background" src="whatever.jpg" alt="" title="" />
And that was it. This actually works quite nicely, with the background image magically resizing itself until one of the dimensions (width or height) reaches the maximum specified.
It doesn't need CSS3 support. Try it and see.
Obviously tweak the positioning stuff if you don't want it to fill the screen (I did).
You will have to set background-size to 100%
It only works in browsers supporting CSS3
Try float:left in #contentTop
Hope that helps!
In css you also have background-size:contain/cover