I am trying to activate a background image in my custom CSS in Wordpress.
I have pasted it in, but when I inspect the element in Chrome. Back slashes have been added in front and on the end of the url. Meaning the image will not display.
Why are these being added? here is the patch and shown below what is added:
background-image: url(\"wp-content/uploads/2016/01/my-logo-backgroundurl.png\");
Also does the same when I put the full url path in
background-image: url("http://example.com/wp-content/uploads/2016/01/my-logo-backgroundurl.png");
#media (max-width: 768px) and (min-width: 475px)
#header-logo-image {
position: relative;
top: -10px;
left: 0;
background-image: url("wp-content/uploads/2016/01/my-logo-backgroundurl.png");
width: 250px;
height: 100px;
background-repeat: no-repeat;
margin: 0 auto;
}
I know its over a year and a half later, but I had this same problem and when I did a google search this was the page was the first entry. I fixed this by removing the quotes. This should work:
background-image: url(wp-content/uploads/2016/01/my-logo-backgroundurl.png)
I don't have enough reputation to comment directry, so I write to here. As #Paulie_D says, it can be fixed like this:
#media (max-width: 768px) and (min-width: 475px) {
#header-logo-image {
position: relative;
top: -10px;
left: 0;
background-image: url("wp-content/uploads/2016/01/my-logo-backgroundurl.png");
width: 250px;
height: 100px;
background-repeat: no-repeat;
margin: 0 auto;
}
}
If you want to use #media Rule, I guess this might be helpful. CSS3 #media Rule
Related
I'm having trouble making the header video (on the homepage) and the header image on the other pages responsive to mobile phone when held in portrait. What I'm aiming for is similar to when you watch a YouTube video in portrait on your mobile phone. When holding your phone in portrait, the video takes up the top third of the screen. And when you hold the phone in landscape, the video takes up the whole screen. I would like to have the same effect for the header video (on the homepage) and the header image on the other pages of the site.
What I have attempted to do is use Media Queries so that when the screen reaches a max-width: 480px, the screen adjusts. But I keep running into different road-blocks. All of these road-blocks revolve around the pages not syncing up the way I want them to.
Here is where I am at with the code:
/* portrait mobile phone display */
#media only screen and (max-width: 480px), (orientation: portrait) {
/* header */
.header {
height: auto;
margin-top: auto;
}
/* header video */
.header-video {
position: absolute;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
bottom: 0;
right: 0;
min-width: 100%;
min-height: 100%;
width: 100%;
height: auto;
z-index: -1;
}
#media(min-aspect-ratio: 16/9) {
.header-video {
width: 100%;
height: auto;
}
}
#media(max-aspect-ratio: 16/9) {
.header-video {
width: auto;
height: 100%;
}
}
/* header image */
.header-image {
position: absolute;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
bottom: 0;
right: 0;
min-width: 100%;
min-height: 100%;
width: 100%;
height: auto;
z-index: -1;
}
#media(min-aspect-ratio: 16/9) {
.header-image {
width: 100%;
height: auto;
}
}
#media(max-aspect-ratio: 16/9) {
.header-image {
width: auto;
height: 100%;
}
}
}
Also, I am happy with how the site is displayed on my laptop and when viewed in landscape on my mobile, and I don't want to lose this.
I feel that I am on the right track, but I just don't have the syntax quite right at this stage. Just seeking a bit of guidance on this.
Thanks in advance.
The website url is: http://www.georjart.com/paintings-new
The password is: M6NYey7f
I've added a background image to the header of a specific page on this Squarespace website above using the following code:
#collection-6058d724f45e96664a810213 header#header {
background-image: url(https://www.emergentcreative.co.uk/wp-content/uploads/2021/04/Gart-BG-Header-Example-1-2.jpg);
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
position: absolute;
top: 0;
right: 0;
margin-bottom: 9px;
padding: 40px
}
However when I go to mobile view it looks like this:
I can see that the issue is with the "position" and "background-image" code and by going into Dev Tools in Chrome I can edit the following media query:
#media only screen and (max-width: 750px)
#header {
background-image: none !important;
position: inherit !important;
}
I can get it too look normal:
However I'm not certain how to add this code into the CSS editor in Squarespace, let alone on a specific page which is what I'd like to do since the changes aren't live yet.
Does anyone have a solution?
Cheers,
M.
Using your approach of an absolutely-positioned header as a starting point (and without reworking that approach), I would do the following in place of what you have now.
#collection-6058d724f45e96664a810213 #header {
background-image: url("https://www.emergentcreative.co.uk/wp-content/uploads/2021/04/Gart-BG-Header-Example-1-2.jpg");
background-size: cover;
background-position: center right;
background-repeat: no-repeat;
position: absolute;
top: 0;
left: 0;
}
#media only screen and (min-width: 750.1px) {
#collection-6058d724f45e96664a810213 #header {
margin-bottom: 9px;
padding: 40px
}
}
#media only screen and (max-width: 750px) {
#collection-6058d724f45e96664a810213 #header {
margin-left: -20px;
margin-right: -20px;
padding-top: 35px;
padding-bottom: 35px;
padding-right: 20px;
padding-left: 20px;
}
}
Okay so ill explain this as best i can.
I have a booking page widget on my website from simplybooking.
It works great on desktop but does not scale on mobile
This is the page in question : https://www.meetaroundthecampfire.com/bookings-checkout/
So this is the code ive tried to use in the page, to make it responsive
<div class="embed-container"><script src='//simplybook.me/v2/widget/widget.js'></script> <script>var widget = new SimplybookWidget({'widget_type':'iframe','url':'https:\/\/meetaroundthecampfire.simplybook.me','theme':'concise','theme_settings':{'timeline_show_end_time':'0','light_font_color':'#ffffff','sb_base_color':'#5a3afd','booking_nav_bg_color':'#ffffff','dark_font_color':'#333333','hide_img_mode':'0','sb_busy':'#dad2ce','sb_available':'#d3e0f1'},'timeline':'modern','datepicker':'top_calendar','is_rtl':false,'app_config':{'predefined':[]}});</script></div>
With the following css in the stylesheet
.embed-container { padding-bottom: 20%; padding-top: 20%; overflow: scroll; max-width: 100%; position: absolute; top: 0; left: 0; width: 100%; height: 90%; }
But it still doesnt come up right?
Any ideas or help from you legends? because im confused!
Cheers
Ez
You have width 1800px at:
#main2 {
margin: 0 auto 30px;
width: 1800px;
}
You should edit this with media queries. Put it by default with 100%, and then with queries change it correspondingly. Example:
//default
#main2 {
margin: 0 auto 30px;
width: 100%;
}
For devices > 768px:
#media (min-width: 768px){
#main2 {
width: 750px;
}
}
etc. etc...
I am making a profile page and have turned a square image into a circle using the CSS code below:
.circular {
width: 250px;
height: 250px;
background-image: url('./images/profile.jpg');
background-size: cover;
display: block;
border-radius: 125px;
-webkit-border-radius: 125px;
-moz-border-radius: 125px;
margin-left: auto;
margin-right: auto;
margin-top: -150px;
}
However I am struggling to make this responsive within the header portion of my page, any ideas how I could have rounded corners and make the image scale at the same time?
Thanks!
I would suggest like already mentioned to avoid fixed px values and instead use percentages.
Another approach (if applicable in your case) could be the use of screenbased responsive styling like:
#media screen and (min-width:960px) {
.circular {
/* ... */
}
}
#media screen and (min-width:1440px) {
.circular {
/* ... */
}
}
With that you can ensure that you have fixed transition points when you resize your design/image.
You could try something like the following.
Just ensure that the parent container is of reasonable width, because .circular will take all of its width.
.wrap {
width: 400px; /* for example... */
}
.circular {
width: 100%;
padding-bottom: 100%;
border-radius: 50%;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
margin-left: auto;
margin-right: auto;
margin-top: -150px;
background-image: url(http://placehold.it/200x200);
background-size: cover;
}
<div class="wrap">
<div class="circular"></div>
</div>
I am using the following css code. What I want to do is if the user is on a iPad I want the background-image to be headerold.jpg or some way to make the current headernew.jpg to display properly on the iPad. Currently part of each end is cut off. I have tried #media query but I am not able to get the code to work. Any help would be appreciated.
Thanks Roger
div.art-header-jpeg
{
position: absolute;
top: 0;
left:-50%;
width: 1344px;
height: 150px;
background-image: url('../img/headernew.jpg');
#media all and (max-width: 1000px) {background-image: url('../img/headerold.jpg');}
background-repeat: no-repeat;
background-position: center center;
}
You could do something like this.
CSS:
img.bg {
/* Set rules to fill background */
min-height: 100%;
min-width: 1024px;
/* Set up proportionate scaling */
width: 100%;
height: auto;
/* Set up positioning */
position: fixed;
top: 0;
left: 0;
}
#media screen and (max-width: 1024px) { /* Specific to a particular image (change accordingly*/
img.bg {
left: 50%;
margin-left: -512px; /* 50% */
}
}
However there are different methods including a JQuery Method. You should check out some discussion about it here.
I am trying to get the headernew.jpg to display on an iPad properly as well as other computer screens but first just the iPad. If I remove the position: absolute then the complete header moves to the right and only shows about 50% of the header. Is there something I need to add like suggested in another post like this ..
<meta name="viewport" content="width=device-width, initial-scale=1">
if so where should it be placed?
My code now looks like this;
div.art-header-jpeg
{
position: absolute;
top: 0;
left:-50%;
width: 1344px;
height: 150px;
#media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {
div.art-header-jpeg
background-image: url('../img/headernew.jpg');
}
background-repeat: no-repeat;
background-position: center center;
}