- This topic has 13 replies, 3 voices, and was last updated 3 years, 3 months ago by
Fernando.
-
AuthorPosts
-
January 16, 2023 at 4:04 am #2497254
Lewis
Hey guys,
I’m trying to place some creative icons to a header section but I’m struggling to position them in the same way as the example below.
Specifically, the icons should move relative to the content container but they don’t seem to have any “anchor” at all. It’s clear my understanding of CSS and absolute positioning is lacking here and any assistance would be greatly appreciated.
Happy to elaborate if my question isn’t clear. Thanks.
January 16, 2023 at 5:08 am #2497325David
StaffCustomer SupportHi there,
if you select the parent Container Block that contains the container with your icons inside. And give it an Advanced > Additional CSS Class(es) of:
relativeThen you can add this CSS:
.relative { position: relative; }This will make that container relatively positioned. Then those absolutely positioned icons will be positioned relative to that container.
January 16, 2023 at 10:03 pm #2498380Lewis
Hi David, thanks for your reply.
I’ve done as you instructed but it didn’t work, unfortunately.
Am I missing something?
Thank you again for your help and patience.
P.S. Changing the icons from
absolutetorelativegets me closer to what I need, but the icons on the right still aren’t anchored to the content container. Of course, the example website usesabsoluteso I’m probably way off here.January 16, 2023 at 10:40 pm #2498407Fernando Customer Support
Hi Lewis,
Can you try altering their top and left values?
Specifically, these ones:
.header-svg-1 { top: 20px; left: -15px; } .header-svg-2 { top: 0px; left: 990px; } .header-svg-3 { top: 0px; left: -15px; } .header-svg-4 { top: 0px; left: 1160px; }Let us know how it goes.
January 16, 2023 at 10:48 pm #2498410Lewis
Hi Fernando,
Changing those values does indeed change the icon positions, but I want them anchored to the content container like the example website provided.
If you open the example website and adjust the window width, you will see what I mean; the icons never move from their relative position.
January 16, 2023 at 10:58 pm #2498414Fernando Customer Support
It’s the same thing I believe.
The main difference is that the other two SVG icons are positioned from the right.
For instance, to see what I mean, try replacing this:
.header-svg-4 { top: 0px; left: 1160px; }with this:
.header-svg-4 { top: 0px; right: 30px; }Afterward, try decreasing the screen size.
January 16, 2023 at 11:17 pm #2498420Lewis
Thanks Fernando,
After making the changes you suggested, the icon still doesn’t move with the content container.
That particular icon (svg-4), for example, should always be positioned in the top right corner of the sidebar, but it currently slides across the entire header depending on the window size.
Forgive me if it’s not clear what I’m trying to achieve. Please let me know if further clarification is needed.
January 16, 2023 at 11:25 pm #2498432Fernando Customer Support
The only remaining this is to set a
max-width.Replace this:
.relative { position: relative; }with this:
.relative > .gb-inside-container{ position: relative; }This allows the SVGs to anchor to the inner container which already has a
max-width.January 16, 2023 at 11:58 pm #2498446Lewis
It works! Thank you so much.
The only remaining issue I’m seeing is one of the icons (top right) still moves when making the window very narrow. I assume this is related to breakpoints.
Any idea why it’s only affecting this one icon?
January 17, 2023 at 12:17 am #2498454Fernando Customer Support
Yes, it will still move as it’s anchored to the right.
You can prevent this with an
@mediaquery.Example:
@media (max-width: 768px) { .header-svg-1 { top: 20px; left: -15px; } .header-svg-2 { top: 0px; left: 990px; } .header-svg-3 { top: 0px; right: 0px; } .header-svg-4 { top: 0px; right: 0; } }Set a small right value for this media query.
January 18, 2023 at 6:47 am #2500168Lewis
Hey Fernando,
Sorry for the late reply.
I have added your suggestion and it works on a very narrow window, however, there is still some icon movement before we get to
max-width: 768px. Perhaps this isn’t strictly a breakpoint issue?Thank you again for your patience with this.
January 18, 2023 at 9:51 am #2500559David
StaffCustomer SupportFor this icon try using a % value on desktop:
.header-svg-3 { top: -10px; right: 25%; }That way it will respond responsively when the screen reduces in width.
January 18, 2023 at 9:15 pm #2500976Lewis
That’s pretty close to perfect, thank you!
I’ll mark this as resolved.
You guys are the best.
January 19, 2023 at 5:00 pm #2502191Fernando Customer Support
You’re welcome, Lewis! Feel free to reach out anytime you’ll need assistance with anything else.
-
AuthorPosts
- You must be logged in to reply to this topic.