I have a web page with questions on it. I want the user to be able to use a 7" Android tablet (with Chrome) to answer the questions. Some people will want to zoom. Some will not.
How can I get the div container to resize (wrapping the text inside the borders of the screen) when the user zooms in or out? I tried this:
.resizcontainer {
width: 90%;
background: #CEE;
margin: 0 auto; /* the auto value on the sides, */
}
with the top of the code as this:
<body>
<div class="resizcontainer" style="border: thin black solid">
<div class="header">
<h2>Risk Assessment Test</h2>
</div>
<div class="content">
I'm not sure if it matters, but Chrome on the desktop does the job just fine. The container resizes just fine. Or is it because this is a form???
Related
Couldn't find anything about this so I ask this here:
I got a really simple page and wanted an element to be full width (width: 100vw). I noticed that at a smaller screen than around 300px it got smaller and wasn't actual full width.
No inserted a complete new div on top of all my html, gave it a background: black; with height: 100vh; and width: 100vw; and it's actually not the full screen size.
As you can see in my screenshot, the set "display size" is 352px x 778 and the element should be 352x778 (so exact the screensize), but as you can see it's smaller.
What causes this and how do I fix it? What is correct now? What I see or what the value says? It's pretty annoying.
If needed: I use chrome 89.0.4389.114 on macOS Big Sur Version 11.2.3 (20D91)
Added while inserting code: As I reduced the code to post it here, I see that the wrapper is the problem. But this question is still valid I believe. Why is the wrapper thats not connected with the <header> a problem for the viewport?
html,
body {
margin: 0;
}
.wrapper {
width: 380px;
margin: 0 auto;
}
.header {
background: black;
width: 100vw;
height: 100vh;
}
<html>
<head>
<meta name="viewport" content="width=device-width">
</head>
<body>
<div class="header">
</div>
<div class="wrapper">
<div class="user">
<h2>
Lorem Ipsum,
<br> Lorem Ipsum Dolor sit amet!
</h2>
</div>
</div>
</body>
</html>
Has been stucked for 2 days, and I found that it is actually the zoom rate of chrome is affecting the element size under devTool's responsive model.
<img src="https://i.stack.imgur.com/dEdFF.png" style="width: 80vw;">
1
The zoom rate of your current brower is affecting the element size:
<img src="https://i.stack.imgur.com/MpAdd.png" style="width: 80vw;">
2
read more about scales in webpage with desktop browser or mobile browser
https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag
I have a website that works fine normally but when in mobile mode, all the links (with exception of the navigation) are no longer clickable. Does anybody know how to change this? I'm not too familiar with Bootstrap though I've tried to troubleshoot as much as I can.
Here's the website: http://dominiquehall.com/dom/
Thank you in advance if anybody can help.
Remove the following code from your theme css file (agency.min.css) at line 477:
div {
height: 100%;
}
Or you can override that property by adding the following code in your custom css file:
div{
height: auto !important;
}
The problem in your code is with the property of div having height 100%, thus overlaying all the links. The div containing the image of a person playing guitar is covering the links in mobile mode. The images are hidden but the div still exist.
Another hack is hiding that particular div in mobile mode.
#media screen and (max-width:991px)
{
.target_div{
display: none:
}
}
In your case the target div is:
<div class="col-lg-4 col-md-5">
<div class="fixed">
<img src="./img/dom1.jpg" id="photo" class="hidden-sm hidden-xs" alt="">
View Resume
Equipment List
</div>
</div>
Just add a class name to the above div and a display as none for mobile devices and your site is good to go.
Here's my code:
<div class="swd-layout-cell layout-item-2" style="width: 100%">
<p>
<img width="450" height="400" alt="" src="images/new.jpg" style="float: left;margin-right:20px" class="">
</p>
<h5>CloudMoV</h5>
<h6>Mobile users can import a live or on-demand video to watch from any video streaming site. </h6>
<h6>Invite your friends to watch the video concurrently. </h6>
<h6>Chat with your friends while enjoying the video.</h6>
<br>
</div>
The image appears on the left with the text on right of it. But on different sized monitors the text placement is varying.On one monitor the placement was correct and on another the text was appearing below the image.
How can I fix this?
This is being caused by width: 100%;.
HTML:
<div class="swd-layout-cell layout-item-2" style="width: 100%;">
So you have this as your container, it will strech 100% of the screen. In the demo mess around with the size of the window and you will see the text move around.
This is because when the window is lets say 500px, the image is taking up 400px. So your text is trying to get into 100px worth of space.
DEMO HERE
You can set a min-width that will stop the cotainer from getting to small so it will not squash the text.
HTML:
<div class="swd-layout-cell layout-item-2" style="width: 100%; min-width: 700px;">
So here you can see we set a min-width, this works fine as it will just stop the container from getting to small.
DEMO HERE
Another option is to use media tags. Now these are used to help design sites for all kind of resolutions.
CSS:
div {
width: 100px;
height: 100px;
}
#media screen and (min-width: 1080px) {
div {
background: blue;
}
}
#media screen and (min-width: 487px) and (max-width: 1079px) {
div {
background: green;
}
}
#media screen and (max-width: 487px) {
div {
background: red;
}
}
So this is a quick demo to show you what they do. It uses the different CSS based from the size of the screen. So using this with your code can allow you to customise the layout depending on the size of the screen.
DEMO HERE
<div class="swd-layout-cell layout-item-2" style="width: 100%;">
<p style="clear:both;">
<img alt="" src="images/new.jpg" style="float: left;margin-right:20px; width:50%; max-width:450px;" class="">
</p>
<h5>CloudMoV</h5>
<h6>Mobile users can import a live or on-demand video to watch from any video streaming site. </h6>
<h6>Invite your friends to watch the video concurrently. </h6>
<h6>Chat with your friends while enjoying the video.</h6>
<br>
</div>
I've got a logo on top of a page which has to be centered relative to the text and fixed to the top of the viewport like in this example: http://dev.markbrouwers.nl/test.html
<h1 style="width: 200px; height: 100px; margin: 0 auto;">
<img src="images/logoforeground.png" style="position: fixed; display: block;" alt="Page title">
</h1>
<div style="width: 800px; margin: 0 auto;">
<p>content</p>
</div>
It works perfectly on pc's. Yet on mobile browsers when zooming the logo starts drifting away from the center.
I've read quite some things (e.g. this) about position fixed on iOS and apparently as of iOS 5 and Android 2.2 it should work, thought it doesn't... it still drifts... Does anyone know how to make mobile webkit behave like the pc browsers?
[edit]
I edited the html a bit, h1 is now outside the container
I also made a screenshot on an iPhone and Windows. As you can see the logo drifts off the viewport when you zoom in on iOS. In chrome browser it stays in the top middle of the viewport.
Safari/iOS5 screenshot:
Chrome/Win7 screenshot:
The Reason this happens, is mobile devices need to know the width of the page, even if the width of your page is 340px for e.g you will still run into this issue, it is because your ZOOMING, not resizing.
If you want text to be larger of the user, the best solution is have something like the following:
Two buttons Small / Large
then link those buttons to some javascript that then changes the text size based on what you want.
for e.g. when click large you might want it to go to 24px
and when they click small it goes to 14px.
It is simple javascript
I want to construct a timeline that has horizontal scrolling.
I have a wrapper DIV, inside it has months. Each month is a DIV inline-block. This works:
<div class="wrap">
<div class="month">Jan 2013</div>
<div class="month">Feb 2013</div>
...
</div>
This almost works, but because my clients site uses tables for layout the scroll bars don't work. This fails:
<table><tr><td>
<div class="wrap">
<div class="month">Jan 2013</div>
<div class="month">Feb 2013</div>
...
</div>
</td></tr></table>
Here is a jsfiddle to show what I mean: http://jsfiddle.net/fhL9u/2/
NOTE: The top timeline example works as you resize the browser. It is 100% width of the page (or containing element.)
How do i make the second timeline overflow correctly? It must take up the remaining width of the screen (no with: 100px hacks), and if possible only show scroll bars when the months overflow.
This is an internal application so I can tell people to use Firefox or Chrome if I need to. This means I can use advanced CSS3 stuff or browser specific ( -webkit or -moz ) stuff. I'd prefer that it was IE8 compatable (just for my own curiosity)
If you can fix the width of that text (in pixels or percents) use this solution:
table {
table-layout: fixed;
width: 100%;
}
td:first-child {
width: 100px; /* or width: 15%; */
}
Note that you can use a different selector for the text (like a class)
Possible solution....
The main issue may be that the "Site Navigation" cell is part of the scroll area.
table { display: block; }
Then assign the .wrap class to the table and remove the div encompassing the months.
Fiddle here
only tested in Chrome.
You could just put a width on the div.wrap, say 400px- that works and is just one line of code:-)