In Squarespace How to change position of banner image - html

I want the position of the banner image to change on smaller screens - max-width 414px. I want to show the product (a building) which is on the far right of the image. On wider screens the building appears.
I've made it work in the developer tool by changing the position in the style : left:-1077.383px; .
Here is the code where the banner is located (with the adjusted left position). I'm having a difficult time display the code block, so I hope these will suffice:
Screenshot of code
view-source:http://digitalponddesign.com/utestua/utestua.html
In my media query, how do I target this element so I can adjust the left position on screens smaller than 414px.
I have targeted the image-container content-fill and first classes, to no avail :(
How can I target this element in my media query to make this work)
I have created a media query:
<style>
#media only screen and(max-width:414px) {
/* not working */
.image-container {
left: -1077.383px;
}
}
</style>
The website is https://utestua.no/
Thanks in advance :)

Squarespace allows you to set the focal point of an image so that, as screen and containing-element sizes change, a specific part of the image can remain in view.
In the place where you add the image, you will see a small circle that defaults to the middle of the image. That circle can be dragged around. In your case, drag it to the area with the building (though you'll probably want to keep it vertically centered, you can play with it a bit until you get it where you want it).
If, however, you are sure you want to leave the focal point in the middle but override the position values via CSS, then you could use the following, which will keep the image positioned so that the right side is always visible:
.image-container[data-url-id='top'] img {
position: absolute !important;
right: 0 !important;
left: auto !important;
}

Related

How to stop url() images from being cropped when resizing window?

I'm testing out the following game (repo here) which has been set to the following css properties:
.game {
min-width:400px;
max-width: 660px;
margin: auto;
}
The game app has 16 divs with class=container, and inside each of these there is a div class=card that has 2 figures (one with a class = "front" and one with class = "back") - see screenshot from Chrome Inspector tools below
The class=front parts of the cards have been given an image each, defined by the following url() code example in the css file
[data-card-type="B2"] .front {
background: #f5f5f5 url('../img/img4.jpg');
}
When resizing the whole window where my game is, I can see that the div containers also get resized, affecting the content inside them. This causes the images to get cropped so that only a portion of them shows:
Only when the div containers are at their full size, the images inside them are able to show fully.
I've tried to modify lots of different css variables (eg. setting a min width for the div containers, or for the front class) to stop the images from being "cropped", see below example for the class:
.front {
background-color: #ffb3b3;
min-width:100%
}
but none of these changes have worked.
Where exactly do I need to modify the code so the images stop cropping, and always show a responsive resizing (eg. get smaller or bigger but always show the whole image content)?
If the aspect ratio is right, I think you could use background-size: contain; in the figure css

Why are my social media footer icons offscreen when viewed on a width of 1440px screen?

I am using developer tools in Chrome and choosing the Laptop L option which is 1440px width.
The issue is seen in the image below:
So, the twitter and instagram icons are cut off to the right of the screen.
Further, when I try to move the icons to the left for a media query of 1440px width, the icons get cut off completely. You can see in the above image that the facebook icon is slightly cut off on the left.
The code surrounding the footer icons is:
#media screen and (max-width:1440px) {
#footer-icons{
position:relative;
left:10%;
}
}
The whole of my code can be seen here:
https://codepen.io/JoyFulCoding/pen/EzXowL
I am struggling to pinpoint where the issue is so any help is appreciated. How do I position the three icons such that they can be seen in the bottom right hand corner when viewed on a screen of width 1440px?
Relative positioning is best used for only small adjustments in position. If you want to right align that element, simply give it margin-left:auto.
To explain further, that rule isn't even taking affect, due to its specificity being lower than the "footer #footer-icons" rule. More info on CSS selector specificity.

How to draw a responsive 'T' shape in HTML

I am working on a project which requires drawing something akin to a letter 'T' in HTML and making it responsive.
--------IMG-------------------------------------
|
|
|
I have an image right at the junction point.
I would like the whole thing to be responsive.
Unfortunately, I cannot share the code because the diagram details are proprietary.
But the issue that I face is the following:
When I resize the window, the vertical line moves at a different speed than the horizontal line and hence the vertical line is no longer under image.
What kind of strategy should I follow in my CSS and HTML to ensure that this is responsive?
I am very new to HTML and having basic knowledge of making images responsive and so on.
Thanks!
If you use this code on your img it will make it responsive
img {
max-width:100%;
height:auto;
display:block;
}
That will ensure your image scales as your browser shrinks.
To get the line to stay in the same position make sure it's within the same container as the image. You could then just adjust the margin of the line.
Below is a fiddle of this.
https://jsfiddle.net/15fmcs5e/
As you will notice as your resize the browser the line stays in place as the image shrinks. When the display starts getting to small the line stops moving over. At this point you would need to use a media query to adjust how far over you want the margin on the line.
That could look something like this
https://jsfiddle.net/L1bbfxdq/1/
#media only screen and (max-width: 836px) {
.line {
margin-left:60px;
}
}
You could also just make the .line class have a percentage based margin from the get go and save yourself doing the media query. Whatever works best for you.

Responsive button images

this is my first post here. I am beginning my journey with css and html. I'm struggling with putting two responsive images next two each other that would act as buttons. What I am trying to get at is that all content is displayed on single page (without scrolling) and that the no matter the size of the screen it is always filled. Then with portrait mode on mobile screens it would display after each other.
This is how far I got already: http://test.fulfeal.co.uk/shop-intro/
I can't figure out whether it is to do with image size (the actual image is going to be a picture) or maybe with corresponding div sizes.
Thank you in advance for any help!
In order for the images to take up the full page height, first make sure that you have the following:
html, body {
height: 100%;
}
This will make sure your content can actually take up the full height of the page. Then, your images should also have their height set to 100%.
For the images to show up on top of each other for mobile, you'll need to use css media queries and then set the images to display: block; width: 100%.

Overlay form elements <fieldset> on to an image; where the full image is shown and scales with device-width

I want to overlay a form with fields on to an image. Essentially I have created a picture that resembles and artist's desk. I have uploaded the image here:
(source: saeedalkhirbash.com)
I want the "Personal Details" section to be on top of one part of the image (post-its on a desk) and the remaining "Information section" on top of the graph paper on the desk. I have all the fonts etc already.
I have tried two methods:
method1: Coding my image as a background-image. This is easy to get form elements on top. The problem is that I cannot work out how to make the image do both of the following:
retain its proportions, with the width equal to the device width (and height scaled to retain the image's proportions);
and always show the full height and width.
I have tried adjusting the background size in %s, auto, and using cover, contain - no combination seems to work.
method2: I can make my image fit nicely with very simple code:
<img src="*.png" style="width:device-width">
and this works great. Unfortunately I cannot work out how to overlay the form elements. I have tried using z-index:1 as below, but this achieves nothing... (I have tried for both the form and fieldset attributes.
<form style="z-index:1"><fieldset> input blah blah </fieldset><form>
How can i do this ?
using a background image will be the easiest way to go. I think you will have issues with scale when viewing on a mobile device depending on how many fields you are planning on using and where.
By setting the form position to relative, and then any fieldsets to absolute, will allow you to posistion them accurately.
Your css for the background, so that it scales correctly, would look something like:
background: url('http://www.saeedalkhirbash.com/backgroundfinally.png') top left / 100% 100% no-repeat;
By setting the width of your form to be relative to its container, it will resize as the screen size changes. Using media queries is an easy way to resize based on device/screen width.
#media only screen and (max-width : 480px) {
div{width:300px;height:300px;}
}
Here is an example code pen for you - http://codepen.io/lukeocom/pen/bfeGC/
Resize the window so that it is less than 480px wide and see what happens...
For a version of the above demo that uses a relative width - http://codepen.io/lukeocom/pen/jBxzI/
Hope this helps