My coding knowledge is next to none but I have been getting by ok with the use of Joomla and preset templates etc. But now I've hit the brick wall head first. While the two banners (right and bottom) are displayed correctly on desktops and tablets, only bottom one is displayed on phones.
Here's the site: http://www.chokladsajten.com
How do I get both to be displayed on smaller screens? (A bonus would of course be if they also were responsive.) Any help or ideas are appreciated!
Custom.css:
#font-face {
font-family: 'DroidSerifBoldItalic';
src: url('../fonts/DroidSerif-BoldItalic-webfont.eot');
src: url('../fonts/DroidSerif-BoldItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/DroidSerif-BoldItalic-webfont.woff') format('woff'),
url('../fonts/DroidSerif-BoldItalic-webfont.ttf') format('truetype'),
url('../fonts/DroidSerif-BoldItalic-webfont.svg#DroidSerifBoldItalic') format('svg');
font-weight: normal;
font-style: normal;
}
/* Logo */
.custom-logo {
width: 104px;
height: 70px;
background-image: url(../../../images/yootheme/logo.png);
background-position: 0 0;
background-repeat: no-repeat;
background-size: contain;
}
/* Only Phones */
#media (max-width: 767px) {
#header-responsive .logo { margin-bottom: 10px; }
}
/* Parallax Effect */
.box-parallax { background-image:
url(../../../images/yootheme/demo/teaser/home_teaser_default.jpg); }
.box-parallax h1 { font-family: "DroidSerifBoldItalic", "TimesNewRoman",
"serif"; }
/* Frontpage Title */
.bigger-title {
margin-top: 0;
margin-bottom: 10px;
font-size: 24px;
line-height: 24px;
}
/* Frontpage List Line */
ul.line.frontpage > li {
margin-top: 30px;
padding-top: 30px;
}
ul.line.frontpage > li:first-child {
margin-top: 0;
padding-top: 0;
}
/* Only Tablets (Portrait) */
#media (min-width: 768px) and (max-width: 959px) {
.frontpage-teaser { height: 280px; }
.frontpage-teaser h2 {
margin-bottom: 0;
line-height: 75px;
font-size: 68px;
}
.frontpage-teaser h4 {
line-height: 28px;
font-size: 23px;
}
}
/* only phones */
#media (max-width: 767px) {
.frontpage-teaser { height: 150px; }
.frontpage-teaser h2 {
margin-top: 10px;
margin-bottom: 0;
line-height: 50px;
font-size: 40px;
}
.frontpage-teaser h4 {
margin-top: 0;
font-size: 12px;
line-height: 16px;
}
}
#banner {
position: absolute;
top: 0;
right: -230px;
}
#footer {
position: center;
bottom: 30px;
}
}
You can specify custom styles for the 1220px breakpoint like this:
#media (max-width: 1220px) {
#banner {
display: block;
position: static;
margin-top: 1.5em;
text-align: center;
}
.bannerItem img {
width: 100%;
height: 150px;
}
}
In your current version, for this breakpoint #banner have a property display: none;, therefore it fades away once the window's width exceeds 1220px
Related
I'm working on a WordPress page with a new layout I added to Flexible Content Template customer field. I found the .scss file where the styles should be placed in, but not sure how to convert my CSS into .scss format. Below is the CSS I want to change to SCSS.
.hero-with-text-cta-hero {
background-color: #ececec;
}
.texts-and-cta {
position: absolute;
top: 2rem;
right: 4rem;
width: 40%;
text-align: right;
}
.texts-and-cta-col {
position:static !important;
}
.texts-and-cta h2 {
margin-left: 1rem;
margin-right: 1rem;
font-size: 1.8rem !important;
font-family: Roboto, sans-serif !important;
text-transform: none !important;
letter-spacing: normal !important;
font-weight: 400 !important;
color: #a6a2a3 !important;
}
#media (max-width: 959px) {
.texts-and-cta {
position: relative;
top: 0;
right: 0;
width: 100%;
text-align: center;
padding-top:1rem;
}
}
.hero-with-text-cta-hero h1 {
color: #666766 !important;
}
#media (min-width: 1280px) {
.hero-with-text-cta-hero h1 {
font-size: 4rem !important;
}
}
Just copy it into .scss file, sass can handle normal css
On my main Mac machine (firefox, safari and chrome) my code tags “box” renders normally:
But, on my Windows (chrome/firefox, with different screen res) it shows this empty horizontal scroll bar:
I want the scroll bar to only show up when needed, like on Mac. I'm using this Hugo theme (live demo). Here’s my slightly modded .css (stripped of all colors and unimportant parts):
/* General Page Layout */
body {
margin: 0;
line-height: 1.5;
font-size: 100%;
font-family: 'Source Code Pro', monospace;
}
.container {
max-width: 52em;
margin-left: auto;
margin-right: auto;
}
div.right {
float:right;
}
div.clearfix {
overflow: auto;
}
#media (max-width: 52em) {
.container {
width: 100%;
}
}
article.single section,
.article-list article {
padding-left: 4rem;
padding-right: 4rem;
padding-top: 1rem;
padding-bottom: 1rem;
}
#media (max-width: 52em) {
article.single section,
.article-list article {
padding-left: 2rem;
padding-right: 2rem;
}
}
header, footer {
padding-top: 1rem;
padding-bottom: 1rem;
}
header {
margin-top: 1rem;
margin-bottom: 2rem;
}
#media (max-width: 52em) {
header {
margin-top: 0;
padding-left: 2rem;
padding-right: 2rem;
}
}
footer {
margin-top: 2rem;
margin-bottom: 1rem;
text-align: center;
font-size: 0.9em;
}
#media (max-width: 52em) {
footer {
margin-top: 0;
margin-bottom: 0;
}
}
/* Typography */
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
line-height: 1.25;
margin-top: 1em;
margin-bottom: .5em;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
h1 { font-size: 2rem }
h2 { font-size: 1.5rem }
h3 { font-size: 1.25rem }
h4 { font-size: 1rem }
h5 { font-size: .875rem }
h6 { font-size: .75rem }
#font-face {
font-family: 'Input';
src: url('/font/Input-Regular.woff2') format('woff2'),
url('/font/Input-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}
pre, code {
font-family: 'Input', monospace;
font-size: inherit;
}
/* Homepage Layout */
#media (max-width: 52em) {
.homepage {
margin-bottom: 2rem;
}
}
.homepage h1.site-title {
text-align: center;
font-size: 5em;
}
#media (max-width: 52em) {
.homepage h1.site-title {
font-size: 3em;
}
}
.homepage h1.headline {
font-size: 3em;
}
#media (max-width: 52em) {
.homepage h1.headline {
padding-left: 2rem;
padding-right: 2rem;
}
}
.homepage .hero-logo img {
width: 100%;
}
.homepage section.categories,
.homepage section.tags {
padding-left: 2rem;
padding-right: 2rem;
}
.homepage .tag {
margin-right: 2em;
}
/* Post List Layout */
.article-list h1.list-title {
font-size: 3em;
}
.article-list article {
padding-top: 4rem;
padding-bottom: 4rem;
margin-bottom: 4rem;
}
.article-list article h2.headline,
.article-list article h2.headline a {
margin-top: 0;
}
.article-list article .meta {
margin-bottom: 1rem;
}
/* Single Post Layout */
article.single .meta {
font-size: 0.9em;
text-align: right;
}
#media (max-width: 52em) {
article.single .meta {
padding-left: 2rem;
padding-right: 2rem;
}
}
article.single h1.headline {
margin-top: 0;
font-size: 3em;
}
#media (max-width: 52em) {
article.single h1.headline {
padding-left: 2rem;
padding-right: 2rem;
}
}
article.single section.body {
padding-top: 4rem;
padding-bottom: 3rem;
}
#media (max-width: 52em) {
article.single section.body {
padding-top: 2rem;
padding-bottom: 1rem;
}
}
/* Article Elements */
article.single * {
max-width: 100%;
}
article.single pre {
margin-top: 0;
margin-bottom: 1rem;
overflow-x: scroll;
border-radius: 3px;
padding: 2rem;
}
article.single ul code, ol code, p code {
padding: 0em 0.1em;
border-radius: 3px;
}
article.single figure, article.single div.highlight {
box-sizing: border-box;
max-width: 46rem;
width: 46rem;
margin-left: -1rem;
margin-right: 0rem;
margin-bottom: 1rem;
padding-left: 1em;
padding-right: 1em;
padding-top: 1em;
padding-bottom: 0.1em;
}
#media (max-width: 52em) {
article.single figure, article.single div.highlight {
width: 100%;
margin-left: 0;
margin-right: 0;
border-radius: 3px;
}
}
You can try :
pre, code {
font-family: 'Input', monospace;
font-size: inherit;
overflow: auto;
}
Solved by changing overflow-x from scroll to auto in article.single pre.
For me, it happened when I set the direction attribute rtl in <body> tag,
although there's no overflow on default mode (ltr), however, I set the dir attribute for the main div tag under the body, like the following:
<body dir="rtl">
<div>
... <!-- few pixels horizontal overflow -->
</div>
</body>
so the worked solution for me was:
<body>
<div dir="rtl">
... <!-- No horizontal overflow -->
</div>
</body>
It could be resolved as followed.
Please set also for all viewport breakpoints the desired width: % of the .container class.
I would like the text to spread all over the webpage top to bottom, left to right.
I did it using vw, vh sizes for text size, placed inside a div.
within the text, there are links (.href) of which size is slightly larger.
It currently works with mac 13inch 2015 but for some reason doesn't with 13 inch of 2017.
It also doesn't work on ipad 11 inch portrait.
I am new to media queries and might be doing it all wrong.
Looking forward to your responses! Many thanks.
body {
margin: 0;
height: 100%;
width: 100%;
}
#media only screen
and (min-width: 200px){
.div {
width: 97vw;
height: 97vh;
margin-right: auto;
margin-left: auto;
position: relative;
margin-bottom: 10vw;
}
.txt {
top: 0;
left: 0;
bottom: 0;
right: 0;
text-align: justify;
text-justify: inter-word;
line-height: 1.5;
font-size: 2.5vh;
}
.href {
color: #0000ff;
font-size: 3vh;
}
}
#media only screen and (min-width: 768px) and (max-width: 1024px) {
.div {
width: 97vw;
height: 97vh;
margin-right: auto;
margin-left: auto;
position: relative; /* text inside of div */
margin-bottom: 10vw;
}
.txt {
top: 0;
left: 0;
bottom: 0;
right: 0;
text-align: justify;
text-justify: inter-word;
line-height: 1.5;
font-size: 3vh;
}
.href {
font-size: 3.5vh;
}
}
#media screen and (min-width: 1025px) {
.div {
width: 97vw;
margin-right: auto;
margin-left: auto;
position: relative; /* text inside of div */
margin-bottom: 10vw;
}
.txt {
top: 0;
left: 0;
bottom: 0;
right: 0;
text-align: justify;
text-justify: inter-word;
line-height: 1.5;
margin-bottom: 1rem;
font-size: 2.5vw;
}
.href {
font-size: 3vw;
}
}```
I have some problem with input text to image, i use swiper slider for the image and i create a class to text like this,
#media screen and (min-width: 970px) {
.swiper-slide .title {
position: absolute;
top: 240px;
left: 10px;
color: white;
font-weight: bold;
font-size:12pt;
font-family: 'Mark Bold' !important;
}
.swiper-slide .medsos {
position: absolute;
top: 265px;
left: 10px;
color: white;
font-size: 10pt;
}
.swiper-slide .role {
position: absolute;
top: 285px;
left: 10px;
color: white;
font-size: 10pt;
}
}
I made the layout adjust to the size of 971px
#media screen and (max-width: 971px)
I tested 971px but when I used the size of the cell phone it disappeared,
did I have to make the layout of each pixel? How do you make the text responsive and the same location from the desktop version to the mobile version?
#media screen and (min-width: 970px) {
.swiper-slide .title {
position: absolute;
top: 240px;
left: 10px;
color: white;
font-weight: bold;
font-size:12pt;
font-family: 'Mark Bold' !important;
}
.swiper-slide .medsos {
position: absolute;
top: 265px;
left: 10px;
color: white;
font-size: 10pt;
}
.swiper-slide .role {
position: absolute;
top: 285px;
left: 10px;
color: white;
font-size: 10pt;
}
}
#media screen and (max-width: 971px) {
// put the style rules that you want to show in moblie devices
}
How we can change background color of google ads info button from css. We have customized the ad but we cannot change background color of google ad info button. I have seen some native ads that have changed the color, even thoug I delete add every part of the code it doesn't go anywhere so how can I change background color of it? I have added the css code and picture
/* Note: 1px = 1dp in this css */
/* == Colors == */
body {
background-color: #ffffff;
}
.title-link {
color: #000000;
}
.button {
background-color: #9D0000;
}
.button-text,
.button-link {
color: #FFFFFF;
}
.price,
.reviews {
color: rgba(0,0,0,0.5);
}
.reviews svg {
fill: rgba(0,0,0,0.7);
}
.url-link {
color: rgba(0,0,0,0.3);
}
.body {
color: rgba(0,0,0,0.7);
}
/* == Fonts == */
body {
font-family: "Lobster";
font-weight: normal;
font-size: 10px;
}
#media (min-height: 300px) {
body {
font-size: 11px;
}
}
#media (min-width: 360px) and (min-height: 300px) {
body {
font-size: 12px;
}
}
#media (min-width: 700px) and (min-height: 300px) {
body {
font-size: 16px;
}
}
.title {
font-size: 1.1em;
line-height: 1.2em;
}
.button {
font-size: 1.1em;
}
.body,
.price,
.reviews,
.url {
font-size: 1em;
line-height: 1.1em;
}
#media (min-width: 360px) and (min-height: 300px) {
.title {
font-size: 1.2em;
line-height: 1.25em;
}
.button {
font-size: 1.2em;
}
}
#media (min-width: 700px) and (min-height: 300px) {
.title {
font-size: 1.3em;
line-height: 1.35em;
}
.button {
font-size: 1.3em;
}
}
/* == Layout == */
.title {
margin-bottom: 5px;
padding: 5px 0 0 8px;
}
.body {
margin: 2px 8px;
}
.button {
position: absolute;
bottom: 8px;
left: 8px;
}
/* == App install and video ad layouts == */
.app-icon {
float: left;
margin: 0 8px 4px 8px;
padding: 0;
}
.image-gallery,
.video {
margin: 0 auto 8px auto;
}
/* == Content ad layout == */
.image {
margin: 0 auto 4px auto;
}
/* == Body == */
.body {
/* add more customizations here */
}
/* == App icon == */
.app-icon img {
height: 50px;
width: 50px;
border-radius: 20%;
}
#media (min-width: 360px) and (min-height: 300px) {
.app-icon img {
height: 70px;
width: 70px;
}
}
/* == Title == */
.title {
display: block;
text-align: left;
}
/* == Button == */
.button {
border: none;
border-radius: 20px;
box-shadow: 0 0 2px rgba(0,0,0,0.12), 0 2px 2px rgba(0,0,0,0.24);
}
.button-link {
display: block;
position: relative;
padding: 0 1em;
}
.button svg {
display: none;
}
.button {
width: 90%;
width: calc(100% - 16px);
height: 2.8em;
}
.button-text {
display: block;
line-height: 2.8em;
text-align: center;
}
#media (min-width: 700px) and (min-height: 300px) {
.button {
height: 2em;
}
.button-text {
line-height: 2em;
}
}
/**
* == Large image and video ==
* App install:
* Use .image-gallery selector
* Content:
* Use .image selector
* Video:
* Use .video selector
*/
.image-link,
.image img {
width: 100%;
height: 100%;
}
.image-gallery a,
.image a {
display: block;
line-height: 0;
}
.image-gallery,
.video,
.image {
width: 90%;
width: calc(100% - 16px);
}
.image-gallery,
.video {
height: 50%;
height: calc(100% - 11em);
}
.image {
height: 50%;
height: calc(100% - 10em);
}
#media (min-width: 700px) and (min-height: 300px) {
.image-gallery,
.video {
height: calc(100% - 8.5em);
}
.image {
height: calc(100% - 8em);
}
}
/* == Attribution == */
.attribution {
background-color: #ffffff;
border-radius: 2px;
color: #aeaeae;
display: table;
font-size: 10px;
line-height: 13px;
margin: 4px 8px;
padding: 0 3px;
position: absolute;
top: 0;
left: 0;
}
.rtl .attribution {
background-color: #ffffff;
left: auto;
right: 0;
}
/* == Other == */
.ads a {
text-decoration: none;
}
.ads, .ad {
/**
* DO NOT TOUCH OR REMOVE
* Will break image rendering
*/
height: 100%;
width: 100%;
padding: 0;
word-wrap: break-word;
}
.ad {
/* Padding for attribution */
padding-top: 23px;
height: calc(100% - 23px);
}
#DanielStorm found how to change it but now Admob does not allow it
I'm not really familiar with CSS but you can inspect the element and see that the id is abgbg and that its color is set to #cdcccc by default. I've changed it to orange(#FFA500) in the screenshot. I'm not sure how to express this in CSS, or if it is even possible, but this should point you in the right direction.
Edit:
After playing around with it for a miniute you can change the background color like so:
.abgbg {
fill: #FFFFFF !important;
}