First, I want to state that I am not a web designer, but I am trying to search for solutions.
At the moment I am at loss, as I cannot figure out why a logo I am trying to add on a footer does not scale with resolution.
In fact, it is displaying it in full resulation only.
There is another logo in the footer that is scaling when resolution changes.
When I paste the code in TryIt, it is working, but once I put it on server, the image is in full resolution always.
Here is the TryIt link - https://www.w3schools.com/code/tryit.asp?filename=GRDOYEDNJX5K
As tyou can see, here the code would work.
What I have done is defined the image in footer.php
<div class="logo5">
<img src='https://i.ibb.co/42Lgdw7/8a2403c4b0d344d5ae7c3762c74fddb4-0001.jpg' class="logo5">
</div>
And added to CSS these lines
.logo5 {
width: 100%;
height: auto;
}
This is the rest of _footer.scss file
.footer-wrapp {
background-image: url("../../images/footer_back.jpg");
background-position: top;
background-size: cover;
background-repeat: no-repeat;
.container {
width: 100% !important;
max-width: unset !important;
}
.additional-info {
padding: 30px 0;
#media screen and (max-width: 992px) {
padding: 30px 0 15px;
}
h4 {
color: #fff;
}
p {
color: #7d7d7d;
}
}
#myFootNavWrapp {
margin: 60px 15% 0;
#media screen and (max-width: 1600px){
margin: 60px 5% 0;
}
#media screen and (max-width: 992px) {
margin: 0;
padding-left: 0;
padding-right: 0;
justify-content: space-between;
}
#media screen and (max-width: 520px) {
align-items: flex-start;
padding-top: 25px;
}
a {
color: #6377a4;
margin-right: 20px;
&:hover {
text-decoration: none;
border-bottom: 2px solid $main__red;
}
}
.mobile-logo-wrapp {
display: none;
margin-left: 20px;
#media screen and (max-width: 992px) {
display: inline-block;
}
a {
display: inline-block;
width: 45px;
height: 45px;
background-image: url("../../images/logo.jpg");
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
}
#navFoot {
border-radius: 10px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
#media screen and (max-width: 992px) {
display: flex;
justify-content: center;
align-items: center;
}
.customFootNav {
flex-grow: 1;
margin: 0;
padding: 0;
display: flex;
flex-direction: row;
list-style-type: none;
flex-wrap: wrap;
width: 100%;
#media screen and (max-width: 520px) {
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
}
li {
flex-grow: 1;
min-width: 5%;
a {
color: $main__dark_blue;
border-bottom: 2px solid transparent;
transition: all 0.2s linear;
font-weight: 600;
}
&:hover {
a {
text-decoration: none;
border-bottom: 2px solid $main__red;
}
}
}
}
.privacyFootNav {
flex-grow: 1;
margin: 0;
padding: 0;
display: flex;
flex-direction: row;
list-style-type: none;
flex-wrap: wrap;
width: 100%;
#media screen and (max-width: 520px) {
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
}
#media screen and (min-width: 520px) and (max-width: 788px) {
margin-left: 92px;
}
li {
flex-grow: 1;
min-width: 5%;
a {
color: #6377a4;
border-bottom: 2px solid transparent;
transition: all 0.2s linear;
font-weight: 400;
}
&:hover {
a {
text-decoration: none;
border-bottom: 2px solid $main__red;
}
}
&.current-menu-item {
a {
text-decoration: none;
border-bottom: 2px solid $main__red;
}
}
}
}
.additional-wrapp {
flex-grow: 1;
}
.custom-menu-logo {
position: relative;
height: 95px;
min-width: 200px;
#media screen and (max-width: 1500px) {
min-width: 175px;
}
#media screen and (max-width: 1200px) {
min-width: 150px;
}
#media screen and (max-width: 992px) {
min-width: unset;
width:90px;
margin-right: 20px;
}
#media screen and (max-width: 520px){
display: none;
}
&:before {
content: '';
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
margin: 0 auto;
background-image: url("../../images/Logo_Red.jpeg");
background-position: center;
background-size: contain;
background-repeat: no-repeat;
transition: all 0.2s linear;
}
a{
outline: none;
display: block;
z-index: 9999;
position: absolute;
width: 100%;
height: 100%;
}
&:hover {
border: none;
a {
border: none;
}
}
}
}
}
}
Is there anything that would interfere with the logo I am trying to add to not scale?
Thank you.
I noticed that you're using wordpress, I already had problems while customizing themes and files this way, because wordpress theme sometimes overwrite your style and that's is bad.
To avoid it, I needed to put the css !important property, this way you force your style over any other that not have this property.
Maybe it's not the best appraoch, but worked for me, you should give a try.
.logo5 {
width: 100% !important;
height: auto !important;
}
Related
I created a _mobile.scss to add responsive design to my website but some of my media queries are not overriding the default styles. I checked other posts on this topic which talked about 'specificity' but I made sure that the _mobile.scss is imported in the style.scss after the _home.scss (where I'm currently styling)
this is the content of styles.scss:
#import 'utilities/config';
#import 'layout/sidebar';
#import 'pages/home';
#import 'layout/mobile';
this is the _mobile.scss :
/
* Large screens */
#media screen and (min-width: 600px) {
.navbar {
top: 0;
left:0;
width: 8rem;
height: 100vh;
}
.navbar:hover {
width: 20rem;
}
.navbar:hover .link-text {
display: inline;
}
}
/* Small screens */
#media screen and (max-width: 800px) {
.banner-wrapper{
img{
width:50%;
}
}
.intro-text{
h1{
font-size: 2rem;
}
.typing::after{
height:50%;
}
}
.about-content{
flex-direction: column;
img{
width:100%;
}
p{
font-size: 1.5rem;
}
}
}
#media screen and (max-width: 600px) {
.navbar {
bottom: 0;
left:0;
width: 100%;
height: 5rem;
z-index:1;
}
.logo {
display: none;
}
.navbar-nav {
flex-direction: row;
width: 100%;
}
.nav-link {
justify-content: center;
height: 5rem;
i{
font-size: 2rem;
}
}
main {
margin: 0;
}
}
And this is a portion of the _home.scss(the part that isn't working):
#banner{
position: relative;
top: -5rem;
width: 100%;
height: 100vh;
}
.banner-wrapper{
display:flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 1rem;
img{
margin-left: auto;
margin-right: auto;
display: block;
width: 30%;
margin-bottom: 3rem;
}
.intro-text{
text-align: center;
h1{
font-size: 5rem;
text-transform: uppercase;
margin-bottom: 0;
margin-top: 0;
}
.typing{
position: relative;
margin-left:10px;
}
.typing::after{
content: "";
position: absolute;
right: -2px;
width:1px;
height: 100%;
border-right: 2px solid black;
animation: blink 0.5s infinite ease;
}
}
}
Where I'm confused is that I am able to change the img width of the .banner-wrapper on small screens (less than 800px) but changing the font-size of the h1 and height of .typing::after in .intro-text has no effect. So how can I fix this? Thank you in advance
After checking your code i found that in your _home.scss the .intro-text is wrapped inside .banner-wrapper whereas in your media query you're defining the .intro-text outside the .banner-wrapper double check it by defining the .intro-text inside the brackets of .banner-wrapper in the _mobile.scss and it might be the problem.
there ho here's a CSS code, I want to hide it on PC view but visible on Phone view, I'm able to achieve my results on PC, but not on Phone, because display: none; is interfering with the code's work. Can anyone please check it?
/* --------- Game-section-mobile---------*/
* {
transition: all .155s ease-in-out;
}
.event-link {
margin: 300px 0 0 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
text-decoration: none;
}
.event-h3 {
margin-top: 30px;
}
.events {
display: flex;
flex-wrap: wrap;
display: none;
}
.events .shadowbox {
height: 100vh;
padding-top: 0;
background: rgba(0, 0, 0, 0.5);
}
.event {
text-align: center;
margin-top: 0;
min-width: 100px;
background-repeat: no-repeat;
}
.event .event-h3 {
padding-top: 50px;
}
.event {
background-size: cover;
background-position: center;
height: 100vh;
flex-grow: 1;
flex-basis: 0;
text-align: center;
min-width: 100px;
background-repeat: no-repeat;
}
.event:hover {
flex-grow: 2;
}
.events .shadowbox:hover {
background: rgba(0, 0, 0, 0.76);
}
.event .event-h3,
.event p {
color: white;
width: 90%;
margin: auto;
}
.event:not(:first-of-type) {
border-left: 1px solid white;
}
.shadowbox img{
margin-top: 50%;
height: 200px;
}
#media only screen and (max-width: 775px) {
.event:last-of-type {
margin-bottom: 10px;
}
.event:hover {
flex-grow: 1;
}
.event:nth-of-type(1) {
max-width: 100%;
}
.event {
min-width: 300px;
margin-bottom: 3px;
}
.shadowbox img{
margin-top: 50%;
height: 150px;
}
}
#media only screen and (max-width: 775px){
.events{
display: block;
}
}
You have a second media query for .events. So when your screen width is smaller than 775px, your .events will get displayed again. Which is the case on a mobile view. Delete or comment it out, and it should work.
#media only screen and (max-width: 775px){
.events{
display: block;
}
}
I'm having some issues implementing media queries. I just made all the media queries I need. But it seems that now when I'm testing it my normal view (desktop has also changed for some reason) and when I go to the first media queries size. I can see that some elements like #taglineand #login-form are not adopted from the media queries but from a smaller size media queries same goes for normal view. They both adopted changes from this size #media only screen and (min-height: 768px) and (min-width: 1024px) instead of the things I specified for it. I don't understand what is going wrong here
regular scss:
#login-container {
height: 100%;
width: 100%;
display: flex;
flex-direction: row;
#side {
width: 30%;
background-color: $plain-white;
display: flex;
flex-direction: column;
padding: 20px;
border-right: 1px solid #ECECEC;
#side-caption {
width: 80%;
margin: 100px auto;
#appoint-full-logo {
width: 80%;
}
#tagline {
margin-top: -30px;
color: rgba(2, 159, 157, 1);
font-weight: 500;
font-size: 1.73em;
}
}
}
#login {
width: 70%;
height: 100%;
background-color: rgba(2, 159, 157, 1);
#login-form {
height:80% ;
width:80% ;
background-color: $plain-white;
margin: 130px auto;
border-radius: 5px;
display: flex;
flex-direction: column;
div {
height: 20%;
#welcome {
text-align: center;
font-weight: 550;
font-size: 2.5em;
margin-top: 50px !important;
color: #E8A87C;
}
}
#apply-text {
height: 15%;
font-size: 0.9em;
width: 70%;
margin: auto;
font-weight: 500;
// text-align: center;
}
#apply-form-fields,
#login-form-fields {
height: 45%;
display: flex;
flex-direction: column;
margin-left: 16%;
:first-child {
margin-top: 10px;
}
.form-group {
margin: 10px 0px;
width: 80%;
label {
font-weight: 500;
}
}
}
#apply-submited {
height: 10%;
width: 70%;
margin: auto;
p {
background-color: rgba(85, 255, 214, 0.50);
padding: 10px;
text-align: center;
font-weight: 600;
border-radius: 5px;
;
}
}
.button-field {
height: 20%;
.button {
cursor: pointer;
width: 70%;
height: 40%;
color: $white;
font-size: 1.1em;
margin: 10px auto;
background-color: #E8A87C;
border: none;
padding: 10px;
font-weight: 600;
border: solid 5px #E8A87C;
border-radius: 5px;
text-align: center;
&:hover {
color: #E27D60;
}
}
.change-form {
cursor: pointer;
text-align: center;
span {
font-weight: 600;
}
&:hover span {
color: #E8A87C;
}
}
}
}
}
}
Media queries located at bottom of style cheat
set media queries:
#media only screen and (min-width: 1366px) and (min-height: 1024px) {
#tagline {
margin-top: -17px !important;
font-size: 1.52em !important;
}
}
#media only screen and (min-width: 1024px)and (min-height: 1366px) {
#tagline {
margin-top: -17px !important;
font-size: 1.05em !important;
}
#appoint-full-logo {
width: 100% !important;
}
}
#media only screen and (min-width: 1024px)and (min-height: 768px) {
#tagline {
margin-top: -15px !important;
font-size: 1.05em !important;
}
#appoint-full-logo {
width: 100% !important;
}
#login-form {
width: 60% !important;
height: 80% !important;
margin-top: 110px !important;
}
#welcome {
font-size: 2em !important;
}
}
#media only screen and (min-width: 768px)and (min-height:1024px) {
#tagline {
margin-top: -10px !important;
font-size: 0.76em !important;
}
#appoint-full-logo {
width: 105% !important;
}
#login-form {
width: 80% !important;
height: 60% !important;
margin-top: 110px !important;
}
#welcome {
font-size: 1.9em !important;
}
}
1.
#media only screen and (min-height: 768px) and (min-width: 1024px) --- perhaps your window/browser height is Below 768px
2.
The ! IMPORTANT -flag often causes problems in code
3.
Your code in media-queries.scss should be nested in the same way
regular.scss is nested too
You might be overusing the !important keyword. When you’re using it, it states any other rule is overridden. Since the smaller media queries are what are looked at/executed first when the media query is set to min-width or min-height, you are probably instructing css to say “I see there are larger media queries, but I’ve been instructed by a smaller media query to honor its rules first and for most.
The CSS inside you media queries needs to be nested exactly like in your regular style rules.
Otherwise they get assigned more importance.
You might check this Codepen out.
#container {
#color {
height: 50vh;
background-color: red;
}
}
#container2 {
#color2 {
height: 50vh;
background-color: blue;
}
}
#media (min-width: 768px) {
/* not affected by querie */
#color {
height: 50vh;
background-color: blue;
}
/* affected by querie */
#container2 {
#color2 {
background-color: green;
}
}
}
<div id="container">
<div id="color"></div>
</div>
<div id="container2">
<div id="color2"></div>
</div>
I'm making a navbar for my site following a tutorial. While working on my mobile menu responsiveness I made a ".burger" class with three "bars" to represent the menu. For some reason the menu icon doesn't show at all.
Code: https://gist.github.com/VlatkoStojkoski/290234f49a6f4e51019ca4b014c03f37
You have wrong css selector in media query.
add this to #media screen and (max-width: 775px).
nav .burger {
display: block;
}
It's because you set display: none to the menu. Even though you added a media query with display: block on the bottom, the first one will always rule.
You should add a media query to the first rule and you can remove the display: block on the bottom.
.burger {
#media screen and (min-width: 775px) {
display: none;
}
}
So this is your complete code:
#import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap");
$text-color: whitesmoke;
$font-stack: "Source Sans Pro", sans-serif;
$nav-color: rgba(79, 91, 102, 0.8);
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
nav {
display: flex;
justify-content: space-around;
align-items: center;
min-height: 12vh;
font-family: $font-stack;
background-color: $nav-color;
h1 {
letter-spacing: 5px;
font-size: 30px;
color: $text-color;
}
img {
width: 64px;
}
ul {
display: flex;
width: 35%;
justify-content: space-around;
a {
font-size: 21px;
color: $text-color;
text-decoration: none;
}
li {
list-style: none;
}
}
.burger {
#media screen and (min-width: 775px) {
display: none;
}
div {
width: 30px;
height: 4px;
background-color: $text-color;
margin: 5px;
}
}
}
#media screen and (max-width: 1024px) {
nav ul {
width: 50%;
}
}
#media screen and (max-width: 775px) {
body {
overflow-x: hidden;
}
nav ul {
position: absolute;
right: 0px;
height: 88vh;
top: 12vh;
background-color: $nav-color;
display: flex;
flex-direction: column;
align-items: center;
width: 50%;
transform: translateX(100%);
li {
opacity: 0;
}
}
}
Given the following HTML and CSS, the myLinks div is hidden on screens below 1025px and displays as a flexbox on screens above 1025px. The div remains hidden in Safari.
#myLinks {
display: none;
}
.menu-link {
padding-top: 0.5em;
}
#media only screen and (min-width: 1025px) {
#myLinks {
background-color: transparent;
display: -webkit-flex;
display: flex;
flex-direction: column;
position: fixed;
width: 300px;
top: 10%;
right: 0;
height: 85vh;
max-height: 85%;
border-radius: 10px;
}
}
<div id="myLinks" class="menu-link"></div>
What's really strange is I just noticed the elements are on the page, but aren't being rendered. I'm able to click on them, but I can't see them. Changing z-index to 999 doesn't resolve the issue
Edit: here's a fully built example, I don't think any of the children are causing #myLinks to be hidden because a .menu-card element removed from #myLinks is displayed and works normally, but maybe something in here doesn't play well with something in myLinks...
Run in full page
#myLinks {
display: none;
}
.menu-link {
padding-top: 0.5em;
}
.menu-card {
display: block;
text-align: center;
padding-bottom: 0;
margin-left: 5%;
margin-right: 5%;
margin-bottom: 4%;
}
.card-text {
text-align: center;
font-size: 0.75em;
padding: 0;
margin: 0;
line-height: 1;
}
/*Style navigation menu images*/
.menu-icon {
display: block;
max-width: 15%;
vertical-align: middle;
margin: auto;
}
/* Style navigation menu links */
#myLinks a {
display: block;
color: white;
font-size: 1.4rem;
text-shadow: 2px 2px black;
text-decoration: none;
text-align: center;
margin-top: 0;
padding: 14px 16px;
padding-top: 0;
}
#media only screen and (min-width: 1025px) {
#myLinks {
background-color: transparent;
display: -webkit-flex;
display: flex;
flex-direction: column;
position: fixed;
width: 300px;
top: 10%;
right: 0;
height: 85vh;
max-height: 85%;
border-radius: 10px;
}
.menu-card a {
position: relative;
width: 100%;
}
.menu-icon {
position: absolute;
z-index: 1;
right: 20%;
max-height: 55%;
border-radius: 50%;
background-color: rgb(148, 181, 201);
background-color: rgba(148, 181, 201, 0.9);
transition: all 0.8s;
max-width: 100%;
}
.card-text {
display: -webkit-flex;
display: flex;
align-items: center;
width: 0;
top: 6%;
height: 100%;
max-height: 0;
text-align: left;
font-size: 125%;
opacity: 0;
color: #5DCA31;
background-color: transparent;
text-shadow: 2px 2px black;
margin: 0;
border-color: rgb(148, 181, 201);
border-color: rgba(148, 181, 201, 0.9);
border-style: solid;
border-radius: 90px;
transition: all 0.8s;
padding-right: 0;
}
.menu-card:hover {
background-color: transparent;
opacity: 1;
transition: all 0.8s;
}
.menu-card:hover .menu-icon {
right: 5%;
}
.menu-card:hover .card-text {
opacity: 1;
padding-left: 10%;
max-height: 65%;
width: 100%;
border-width: 8px;
box-sizing: border-box;
background-color: rgb(148, 181, 201);
background-color: rgba(148, 181, 201, 0.9);
padding-right: 100px;
padding-top: 10px;
padding-bottom: 10px;
transition: background-color 0.8s, border-width 0.8s, max-width 0.8s;
}
}
<div id="myLinks" class="menu-link">
<div class="menu-card">
<a href="#">
<img class="menu-icon" src="https://nuclearterrortoday.org/img/home.jpg">
<p class="card-text" id="home">Home</p>
</a>
</div>
</div>
Try using
#media screen and (min-width: 1025px) {
#myLinks {
/* all the styles */
}
}
Or just
#media (min-width: 1025px) {
#myLinks {
/* all the styles */
}
}
The keyword ‘only’ hides style sheets from older user agents.
Hope this helps!