Issue with image alignment and menu placement causing hero section to shift downwards in Foundation 6

I am currently working on coding my portfolio and have designed the layout in Photoshop. Please note that this image is a reduced preview.

While trying to align the images and content, I encountered some challenges. I suspect there might be an issue with the overall structure?

The specific problems I faced are:

1- My main challenge is to align the text and the initial case UI screenshot within the div so that they appear on the bottom right initially. Then, when viewed on mobile, they should stack as one column below the text. I experimented with various techniques such as encapsulating the image with a div, setting positions to relative and absolute, using margins, floats, and alignments, but none of them worked as expected.

This was how the alignment problem looked like:

[![Trouble with image alignment][2]][2]

Below is a snippet of the HTML code:

<!-- start of case 1 -->
<div id="case1" class="row fullWidth">
 <div class="small-6 medium-6 large-6 columns">
  <div class="case1text">
    <h2>A new class of real-time software<h2>
  </div>
 </div>
 <div class="small-6 medium-6 large-6 columns">
   <div class=case_image_container>
    <img class="case_image" alt-check_content_below src="https://danielvianna.github.io/images/blacktrax_gui.png">
   </div>
 </div>
</div>
<!-- End of case 1-->

And here is a snippet of the CSS code related to this section:

#case1 {
    /* Gradient background styles */
 ...
}

.case1text {
 ...
}

.case_image_container {
 ...
}

.case_image {
 ...
}

2- Another issue I faced was with the menu behavior. When opened on mobile devices, the menu pushes down the hero image instead of appearing on top as a separate layer, even after assigning z-index values to both elements.

Here is a preview of the problem:

Snippet of the HTML code for the menu section:

<!-- Start Top Menu Bar -->
 ...
<!-- end of Top Menu Bar -->

And here is a snippet of the CSS code relevant to the navigation bar:

.title-bar {
 ...
}

.top-bar-right {
 ...
}

...

Answer №1

  1. To position it in the bottom right corner, you will need to create a custom class for the following div:

    <div class="small-6 medium-6 large-6 my-custom-class column">
    

This custom class should only apply styles on larger screens, so use a breakpoint accordingly.

Now, let's style our custom class:

.my-custom-class{
position: absolute;
bottom: 0;
right: 0;
padding-right:0;
}

Next, navigate to the .case_image_container in your CSS and add this property:

float:right;

Make sure to remove this property:

margin-bottom: 1em;

Your image will now be positioned at the bottom as shown on the screen:

https://i.sstatic.net/6Xp43.png

  1. Add the following code snippet to #main-menu, but remember to apply it only to mobile devices by using a media query or applying it to a specific mobile menu class if available.

    position: fixed;
    width: 100%;
    

Don't forget to include z-index if needed.

Answer №2

To make the image fill the entire width, set its width to 100%:

.case_image {
    height: auto;
    width: 100%;
    position: sticky;
    margin-left: 5;
    border: 0;
    font-size: 1.4em;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to bring the global stylesheet into a Vue component?

Embarking on my first VueJS project, I decided to create a global stylesheet to maintain consistent styles across different components. After installing the SCSS loader and setting up my stylesheets, I encountered an issue. $mainFont: 'PoppinsRegular, ...

What are some methods for decelerating typewriter text animation?

I'm currently updating my portfolio and have incorporated a typewriter effect into the second line of text. However, I'm finding that the speed of the effect is a bit too fast for my liking. I've attempted to adjust the animation seconds, de ...

Storing information in the concealed and interactive tabs within a tabview system

In my program, users are able to access groups through a left column list, similar to how Google Groups are displayed (seen in the image below). I would like the front-end to cache visited groups as users switch between them, so that when they revisit a g ...

Is it possible to operate a mobile site automatically alongside a desktop site?

I'm currently working on a website that looks fantastic on desktop, but doesn't quite function properly when viewed on mobile devices. I'm curious if there is a method or system I could implement to automatically load the mobile version of t ...

The issue with the flex property in IE9 causing it to malfunction

Here is my CSS: .flex_web, .flex_tablet, .flex { display: -webkit-box; display: -ms-flexbox; display: flex; } This code functions properly in Chrome, Safari, and Firefox, but unfortunately does not work in IE9. I attempted using the display: table prope ...

Menu options moved to the right of the screen

I am encountering a small issue with my dropdown menu that I can't seem to solve. The first item in the dropdown menu appears correctly, but the second item is slightly shifted to the right. It seems like the margin-right applied to the link may be c ...

What is the best way to apply a 2px padding to text-decoration: underline?

As a dedicated frontend developer, I believe in creating underlines with a 2px padding instead of the default 1px. Is there an easy solution for achieving this? PS: Yes, I am aware of using a div with a black background color and 1px * Npx with position: ...

How to properly store response text in JavaScript variable?

Utilizing Ajax to execute a PHP script on my website, I aim to assign the response from the PHP script to a JS variable. The objective is for this script to set the variable "stopAt" to 42. This is where I encountered an issue: Below is the code snippet ...

Denied running the inline script in Redocly

Experimenting with redoc-cli (https://github.com/Redocly/redoc/) in order to generate static documentation. Unfortunately, encountered some stumbling blocks due to errors related to the Content-Security-Policy, which seems to be blocking JavaScript code ex ...

The session becomes obsolete when redirecting back to the previous page

When attempting to redirect using the http referrer after storing a value in Session in php, I noticed that the Session becomes null. Is there a method to maintain the session even when utilizing the http referrer? ...

Deactivate the second subradio button when the first option is selected and vice versa

Need some assistance, hoping for your help. I have 2 choices with subcategories. 1 - Option A ---- variant 1 ---- variant 2 ---- variant 3 2 - Option B ---- variant 4 ---- variant 5 ---- variant 6 Check out my code here Users must choose betwe ...

Echo a JS variable into PHP and then insert a PHP file into an HTML element - a step-by-step guide!

Greetings to the wonderful community at stackoverflow, I am currently working on a variable code that allows for easy insertion of code from another file, such as a div. I am curious if it is possible to include a PHP file using JavaScript and JS variable ...

Is there a way for me to use the onclick event to change one image when I click on another image on the same webpage?

Players are required to select one of three images representing rock, paper, or scissors. When a player clicks on one of these choices, it should change an image displayed next to the options to show a hand making that specific shape, resembling a game of ...

Inspecting element value on a website

On a marketplace website, I extracted the attribute (capacity_gold) from a table. Since the values are dynamic and constantly changing, I aim to develop a basic script that will notify me when the attribute value exceeds 100. The current value of the attr ...

How to overlay an image on a div element using Bootstrap styling

My goal is to have an image positioned between two separate div tags similar to a Facebook profile page: https://i.sstatic.net/sBocE.jpg I have tried solutions found here but they didn't work as expected. The image position changes when the screen s ...

When activated multiple times, Element pays no attention to jQuery

As I work on making my website responsive, I have encountered an issue with the jQuery script. When rapidly changing the window size, it seems to ignore the conditions set for elements to be displayed or hidden. The CSS is straightforward: body:after{dis ...

Is it possible to execute the Go compiler within a web browser?

Just discovered that Go can be compiled to WebAssembly. How awesome! According to this Go documentation, the Go toolchain is actually written in Go itself. This got me thinking, is it possible to run the Go compiler in a browser? Can I create a website w ...

The customizing of font color with Fancytree's "extraClasses" feature is not being properly applied

In my web application, I have a tree that utilizes fancytree. Everything is functioning properly, except for the fact that I need to set the font color to red for certain nodes. I have implemented the use of extraClasses in my JSON, which is successfully a ...

Troubleshooting resizing images in React using Material UI's useStyles

When attempting to resize an image using React, I am encountering a problem where adjusting the height and width of the tag with useStyles does not reduce the size of the image but instead moves it around on the page. Here is the code snippet: import { ma ...

Show another div once you've scrolled beyond the first

Instead of following tutorials that make a div appear after scrolling down a set number of pixels, I am looking to achieve something different. I want a div to appear when the user scrolls past another div, and then disappear again when they scroll back up ...