The same width setting worked in iOS. However, in macOS, the width setting is ignore.
:root {
color-scheme: light dark;
}
body {
width: 400px;
padding: 10px;
font-family: system-ui;
text-align: center;
}
#media (prefers-color-scheme: dark) {
/* Dark Mode styles go here. */
}
I want the whole sentence showed in one line. Any idea?
Related
Here is an about me page and here is the GitHub
I've been making the website responsive and even tools like protoFluid to view it as if it was on an iPhone. However, I used my iPhone and there are numerous problems. The buttons does not seem to want to change their widths even though they are based on percentages. They are overflowing to the right and leaving a black space to the right.
.container .name .social div{
width: 80px;
display: inline-block;
}
.container .name .social img{
width: 100px;
}
.social {
position: absolute;
display: inline;
width: 425px;
left: 0;
margin-left: 10px;
}
#media only screen and (max-width: 600px) {
.social {
padding: 0;
width: 424px;
position: relative;
display: block;
margin: 0 auto
}
.name .social div {
width: 16.6666667%;
}
.social img {
width: 125%;
/*width: 100px*/
}
}
#media only screen and (max-width: 450px) {
.container .name .social div {
width: 13.6667%;
}
.container .name .social img {
width: 125%;
}
}
there are many ways to solve it, include using bootstrap framework... I always use a "resize window" chrome plugin(found in appstore here) , and the error is showed. And you can work it in your dev enviroment.
The buttons stay the same because the percentage width is decided on the size of parent controller. On line 271 of stylesheet.css .social class has width 425px (the same width it has on each screen size) so the buttons stay the same. Try changing width of .social class or simply use pixels for button dimensions for that media-query - #media only screen and (max-width: 600px)
I'd appreciate a bit of advice from someone skilled with CSS. For a reason I can't pinpoint, only the right side of my website shows up in iPhone / iPad browser, and the left 1/3rd of it can't even be seen.
If someone could explain what causes the issue and how it can be fixed, I'd be grateful.
Here's the part of css that sets the layout:
body {
position:absolute;
width: 960px;
top: 0px;
left: 50%;
margin-left: -480px;
}
First: Try to remove this (position: absolute; width: 960px; top: 0px; left: 50%; margin-left: -480px;) from your body.
Second: here's how to center a page width: 960px; margin: auto, put that on #page
So with the some css on body removed and the css below on #page it may work better
#page {
width: 960px;
margin: auto;
overflow: hidden; /* to compensate for some element overflowing and messing up your layout */
}
you need to modify the width of your body on every device.
You can use #media query to do it by css
/* Ipad Landscape */
#media screen and (max-width: 1100px) {
body {
width: 80%;
left: 0%;
margin-left: 10%;
}
}
/* iphone 5 landscape ipad portrait */
#media screen and (max-width: 800px)
{
}
/* iphone 4 lanscape */
#media screen and (max-width: 500px)
{
}
/* iphone 4- 5 portrait */
#media screen and (max-width: 400px)
{
}
I use this meta-tag
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
And I have a text that has no width limit.
The text is breaking up into two lines in portrait orientation, and when I rotate the device the text is scaled up: instead of keeping the same size and using the available space and placing the text in one line, like it should, it zooms the text and the text is still taking the two lines.
Why is that?
the CSS (compiled from SASS):
.text {color: #dee3d5; font-size: 16px; font-family: Helvetica; font-weight: bold; }
#media screen and (orientation:portrait) {
.text { margin-top: 10px; margin-bottom: 10px; line-height: 20px; } }
#media screen and (orientation:landscape) {
.text { margin-top: 5px; margin-bottom: 5px; line-height: 16px; } }
#thanx { border-bottom: solid 2px #dee3d5; padding: 10px; margin: 0 10px 12px 10px; }
You can disable this behavior by using -webkit-text-size-adjust: none;.
body {
-webkit-text-size-adjust: none; /* Prevent font scaling in landscape */
}
I have already tried tweaking the fancybox stylesheet but can't seem to move the hover area of the previous and next button so that it does not interfere with the play button of a vimeo video. I don't know if the problem can be solved by modifying the javascript file but I really don't have the knowledge to do so. Here is the css code of the fancybox stylesheet:
#fancybox-left, #fancybox-right {
position: absolute;
bottom: 0px;
height: 100%;
width: 35%;
cursor: pointer;
outline: none;
background: transparent url('blank.gif');
z-index: 1102;
display: none;
}
#fancybox-left {
left: 0px;
}
#fancybox-right {
right: 0px;
}
#fancybox-left-ico, #fancybox-right-ico {
position: absolute;
top: 50%;
left: -9999px;
width: 30px;
height: 30px;
margin-top: 0px;
cursor: pointer;
z-index: 1102;
display: block;
}
#fancybox-left-ico {
background-image: url('fancybox.png');
background-position: -40px -30px;
}
#fancybox-right-ico {
background-image: url('fancybox.png');
background-position: -40px -60px;
}
#fancybox-left:hover, #fancybox-right:hover {
visibility: visible; /* IE6 */
}
#fancybox-left:hover span {
left: 20px;
}
#fancybox-right:hover span {
left: auto;
right: 20px;
}
I would appreciate if someone could help me figure out how to modify the hover areas for the previous and next buttons when using fancybox.
You could also make the containing divs shorter as I have just done, so the prev/next arrow hover areas finish just above the Vimeo controls
#fancybox-left, #fancybox-right {
height: 86%;
}
I accomplished this with:
#fancybox-left, #fancybox-right {
width: 0%;
}
I put this selector in my own stylesheet which I loaded after Fancybox's.
You don't actually need to mess with original fancybox css file.
What you can do is to crop the navigation arrows to their size so the next/prev area don't cover a whole area on both sides of the box.
AFTER you linked the fancybox css file, add this inline css declaration:
<style type="text/css">
#fancybox-left,
#fancybox-right {
width: 30px; height: 30px; top: 45%
}
#fancybox-left:hover span,
#fancybox-left-ico{
left: -10px;
}
#fancybox-right:hover span,
#fancybox-right-ico {
right: -10px;
left: auto;
}
</style>
This is for fancybox v1.3.x
I have a mobile website, which currently displays a timetable. The non-mobile site however also has a iFrame with google maps inside it, to display multiple vehicles being tracked.
For the mobile site, I want only the timetable to display in portrait and only the iframe to display in landscape.
I've seen this Can I trigger a CSS event in mobile safari upon iphone orientation change? , but I struggle to see how I can apply this to my query.
This is the CSS for the iFrame:
.map {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
background-color: #fff;
color: #000;
width: 600px;
height: 500px;
margin-left: 20px;
margin-right: auto;
overflow: hidden;
-moz-box-shadow: inset 0 0 5px #888;
-webkit-box-shadow: inset 0 0 5px #888;
box-shadow: inner 0 0 5px #888;
float: left;
}
use #media
#media all and (orientation:portrait) { … }
#media all and (orientation:landscape) { … }
Don't abuse javascript when CSS can do it.
orientation
First you will need to assign ID to your timetable container and iFrame. Then, use the javascript below to hide or display it. I will assume that your iFrame id is 'map' and your timetable container is 'timetable'
<script type="text/javascript">
var timetable = document.getElementById('timetable');
var map = document.getElementById('map').
window.onorientationchange = function() {
switch(window.orientation) {
case 0: // Portrait
case 180: // Upside-down Portrait
// Javascript to setup Portrait view
timetable.style.display = 'none';
map.style.display = 'block';
break;
case -90: // Landscape: turned 90 degrees counter-clockwise
case 90: // Landscape: turned 90 degrees clockwise
// Javascript to steup Landscape view
timetable.style.display = 'none';
map.style.display = 'block';
break;
}
}
</script>