Ok, so here we go:
http://judao.com.br/direto-do-epicentro-de-terremoto-a-falha-de-san-andreas/
The content images are huge, 100% width, with a caption. BUT on a 1080p resolution. Anything below that cuts the images, the caption AND the video.
The divs are inside another one, that says max-width: 960px. Here's what I did to make it huge.
#tamanhao {
display: inline-block;
left: -50%;
outline: 0;
overflow: hidden;
position: relative;
text-align: center;
height: auto !important;
width: 200%;
}
#tamanhao img {
max-width: 100% !important;
padding-top: 32px !important;
height: auto !important;
}
.caption {
float: left;
display: inline;
margin-top: -16px;
font-size: 14px;
color: #888;
padding-left: 32px !important;
max-width: 470px;
font-style: italic;
font-family: exo;
text-align: left !important;
line-height: 14px !important;
}
#videozao {
display: block;
left: -50%;
outline: 0;
overflow: hidden;
position: relative;
text-align: center;
width: 200%;
max-height: 744px !important;
}
#videozao iframe {
margin: 0 auto;
display: block;
width: 1280px !important;
height: 720px !important;
position: relative;
}
What am I doing wrong? How can I make it right?
This is because you are using static widths for your content, meaning you're using px instead of percentage. Percentage will make your content to be responsive in smaller screens fiting the screen while resizing the window, while for example 500px will always maintain that same value, unless you use media queries. Here's a example, Resize the window where the images are on this link to see it work.
Code Explanation
<div class="responsiveWidth">
...Conteúdo Responsivo...
<img src="http://i1.wp.com/www.24x7photography.com/wp-content/uploads/2010/08/random2.jpg?w=720" width="500">
</div>
<div class="staticWidth">
...Conteúdo Estático...
<img src="http://i1.wp.com/www.24x7photography.com/wp-content/uploads/2010/08/random2.jpg?w=720" width="500">
</div>
This 2 div's look exaclty the same, but here's where the magic happens
CSS
.staticWidth {
width:500px;
margin:10px;
border:1px solid #000;
}
.responsiveWidth {
width:100%; /* This says the div to stay always 100% of it's parent, in this case it's `body` because we don't have any div container */
margin:10px;
border:1px solid #000;
}
.responsiveWidth img{
width:100%; /* This will make the width of the image 100% as well, the height it's automattic because we didn't set one nor on HTML or CSS */
}
Ok, guys, I solved it. I never heard about the VW thing... And when I did, it worked. Here's the final solution. :)
#tamanhao {
position: relative;
left: 50%;
height: auto !important;
margin: 0px 0 0 -50vw;
width: 100vw;
}
#tamanhao img {
max-width: 100vw !important;
padding-top: 32px !important;
height: auto !important;
}
#videozao {
position: relative;
left: 50%;
max-height: 720px !important;
margin: 0px 0 0 -50vw;
width: 100vw;
}
#videozao .fve-video-wrapper {
margin-left: auto;
margin-right: auto;
max-width: 1280px !important;
max-height: 720px !important;
}
#videozao iframe {
max-width: 1280px !important;
max-height: 720px !important;
}
Thank you / Obrigado! :))))
Related
I am trying to make a div fill the possible place after its margins taking effect.
For example if the screen width is 200 and the class is declared as below:
.mini_video {
width: 100%;
margin-left: 20px;
margin-right: 20px;
}
Can the mini_video have 160px width and be in the middle?
I am also using Bootstrap if it can help me in any way.
I'd be using padding for this use case. You could use an outside container and add padding to it for the video. Object-fit on the video allows it to scale progressively.
.mini_video-container {
width: 100%;
padding: 0 20px;
max-width: 1000px;
background-color: orange;
}
video {
width: 100%;
height: 100%;
max-width: 100%;
object-fit: fill;
}
https://codepen.io/jeffteachestheweb/pen/abJVNjg
You can add max-width: 100%; instead of width: 100%;
.mini_video {
max-width: 100%;
margin-left: 20px;
margin-right: 20px;
}
Take a look at that example
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.mini_video {
max-width: 100%;
margin-left: 20px;
margin-right: 20px;
border: 1px solid #000;
text-align: center;
}
<div class="mini_video">Hello World</div>
Here's an image of what I'm trying to achieve first: https://i.imgur.com/bTsL2wS.png
Note that this is only supposed to be one section of the full page. The background should not span the entire website. However each section has full-screen dimensions.
I had two ideas regarding doing this:
Have a container object with viewport dimensions and add an relative-positioned image with z-index: -1 and inside of that an absolute-positioned img with right: 0 and ~60% width, then rotate it.
Same as above but put the img inside of a 60% width right-aligned sub-container and skew the container.
Both approaches work on a desktop-screen but this happens when scaling the window down too much.
Basically I need it to work until the viewport reaches tablet/mobile size.
Wrap the part you want to have with that background in a div, then add the background-image property to the div.
*{ box-sizing: border-box}
#blue{ background: #269;}
#red{ background: #a22;}
#green{ background: #6a6; }
section{ display: block; height: 100vh; margin: 2% auto; color: #fff; font: normal 16px verdana, sans-serif; text-align: center; }
div{ height: 100%; width: 70%; overflow: hidden; float: right;}
img{ transform: rotate(70deg); height: 920px; margin: -120px 0 auto; }
h1, p{ margin: 5% auto 0 0; width: 40%;}
#media only screen and (min-height: 500px){ h1, p{ margin: 30% auto 0 0 }}
span{ position: absolute; left: 2%; z-index: 2; background: rgba(0,0,0,0); height: 100vh; width: 96%; padding: 20px }
css for tests only
span::before{ content: 'this is span'}
p::after{ content: 'this is pafagraph'; display: block; padding: 20px 0 0}
h1::after{ content: 'this is h1'}
section:hover h1, section:hover p{ background: grey}
span:hover{ background: rgba(0,0,0,0.5); }
<section id="blue"><div><img src="img.jpg" alt="blue"></div><span><h1></h1><p></p></span></section>
<section id="red"><div><img src="red.jpg" alt="red"></div><span><p></p></span></section>
<section id="green"><div><img src="green.jpg" alt="green"></div></section>
Responsiveness is an old story, mobile-first is up to date. Of course with responsive solutions, but #media only for larger devices.
You better not use flex, it leaks badly.
Been going round & round in circles. I've got a Bootstrap 3 panel and within the panel-body I'm adding divs dynamically (MVC razor) which are stacked:
.test-result {
float: right;
width: 150px !important;
height: 100% !important;
border: solid 1px;
min-height: 100% !important;
background-color: lightgray;
margin-left: auto;
margin-right: auto;
padding-left: 15px;
padding-right: 15px;
display: inline-block;
white-space: normal;
}
Once these exceed the width of the panel-body they obviously start stacking etc.
I want the panel-body content to stay side by side and to have a horizontal scrollbar. I've added overflow-x: scroll etc and nowrap but had no joy. Please help :)
You can do this with a div like this:
<div class="scroll">
</div>
Then you need to apply the following styles:
.scroll {
overflow: auto;
white-space: nowrap;
}
Once the width inside the div exceeds either the screen width or the div width (you can define), it will apply the horizontal scroll bar.
Update your CSS like below
You can define the with of resultContainer based on the number of child containers you want to scroll through. So if each test-result is 150px in width and you want to accommodate 100 such containers then make the width of resultContainer to be 150 x 100 i.e 15000px.
<style>
.tab-pane{
width:100%;
overflow: auto;
}
.resultContainer{
width:600px; //4 containers x 150px
}
.test-result {
float: left;
width: 150px !important;
height: 100% !important;
border: solid 1px;
min-height: 100% !important;
background-color: lightgray;
margin-left: auto;
margin-right: auto;
padding-left: 15px;
padding-right: 15px;
display: inline-block;
white-space: normal;
}
.new-test-group {
float: left;
width: 150px !important;
height: 100% !important;
border: solid 1px;
min-height: 100% !important;
background-color: lightgreen;
margin-left: auto;
margin-right: auto;
padding-left: 15px;
padding-right: 15px;
display: inline-block;
white-space: normal;
}
.eachNewTest {
border: solid 1px;
cursor: pointer;
}
</style>
UPDATE - Adding with width of .resultContainer dynamically
<script>
$(document).ready(() => {
let resultContainerWidth = 150;
let resultContainerCount = $('.test-result').length;
$('.resultContainer').width(resultContainerWidth * resultContainerCount);
});
</script>
I am creating a table inside a tab. I want to set the width of tab to the width of media screen but keep the width of table fixed to 630px. The max-width of div should be 400px. When the table does not fit into the div, it should display a horizontal scrollbar.
The div is successfully showing a horizontal scrollbar. But, when I resize the window, the scrollbar along with table is hiding inside the div. I want to display the scrollbar according to media width.
The example will become clear:JsFiddle
Please use tab and tab-content class width 100% may be it will work for you. I am sharing your complete code below with my changes i have done some width changes px to %, and what is the purpose for #model margin-right:1000px it will work find without margin.
#tabs-container {
height: auto;
overflow: hidden;
margin-bottom: 40px;
position: relative;
top: 60px;
border: 1px solid #ddd;
padding-top: 10px;
max-width: 400px;
}
.tab {
border: 1px solid #d4d4d1;
background: linear-gradient(#f8fbea, #fff);
margin: -20px 10px 10px 10px;
float: left;
position: relative;
top: 0;
z-index: 3;
width:100%;
height: auto;
overflow-x: auto;
overflow-y: hidden;
}
.tab-content {
padding: 10px;
width:100%
}
#model {
font-size: 12px;
margin: -10px -10px -10px -320px;
position: relative;
margin: 0 auto;
font-family: tahoma;
}
#model {
margin-right: 1000px;
width: 630px;
}
#model td {
vertical-align: middle;
}
#model tr:first-child td {
font-weight: 600;
text-align: center;
background-color: #ebebeb;
}
#model tr:nth-child(even) {
background-color: #f6f6f6;
}
#model tr:nth-child(odd) {
background-color: #fff;
}
So I have this code here: http://jsfiddle.net/nUwgX/ which has a little arrow at the bottom. What I'd like to happen is when the window get's resized is to keep the arrow about 15% from the bottom of the screen but I'm not sure how I'd do that. Any help would be appreciated.
HTML:
<div class = "container">
<div class = "top-wrapper">
<a id = "name" href = "#">Bigfoot Games</a>
</div>
<div class = "bottom-wrapper">
<p>Content</p>
</div>
</div>
CSS:
.container {
width: 100%;
height: 100%;
margin: 0 auto;
position: relative;
padding: 0;
text-align: center;
}
.top-wrapper {
position: relative;
background: #0f0f0f;
height: auto;
height: 100%;
max-height: 900px;
width: 100%;
margin: 0 auto;
padding: 0;
display: table;
}
.top-wrapper:after {
top: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(15, 15, 15, 0);
border-top-color: #0f0f0f;
border-width: 30px;
margin-left: -30px;
}
#name {
display: table-cell;
text-align: center;
vertical-align: middle;
padding: 20px;
color: white;
font-size: 80px;
text-decoration: none;
margin: auto 0;
}
.bottom-wrapper {
background: white;
margin: 0 auto;
padding: 20px;
}
Edit: Okay, so saying that I wanted the arrow about 15% above is not what I meant! Ha! What I mean is, I want the .top-wrapper to be 100% so that it covers the whole window, and you scroll down to see the .bottom-wrapper - however when the screen is resized (other than my 1920 x 1080 resolution) the arrow get's hidden just out of sight, what I'd like is the arrow to be visible regardless of resolution and have the look (in terms of padding/distance) as a 1920 x 1080 resolution.
Change the css of .top-wrapper to only take up 85%, that leaves 15% for the "arrow" on the bottom to take up.
.top-wrapper {
...
height: 85%;
...
}
see the jsfiddle:
http://jsfiddle.net/nUwgX/1/
Change your .top-wrapper height to 85%
I changed just that in the jsfiddle and it maintains when the screen is resized. If that isn't what you are looking for, please elaborate on the question.
Good Luck!
If you want to keep your bottom-wrapper at the bottom fixed position ...
Replace your .bottom-wrapper class with below
.bottom-wrapper {
position:fixed;
bottom: 0px;
height: 15%;
width: 100%;
background-color: white;
margin: 0 auto;
}
.bottom-wrapper p{
padding-top: 20px;
}
Then change .top-wrapper:after to .bottom-wrapper:before