Design featuring a combination of vertical columns and a fixed image placed in

I'm currently in the process of creating a website and I have a specific page layout in mind that I would like to implement:

------------------------------------------
|    A catchy title        |            |
|    Here                  |   An unconventional  |
|                          |----------- image     |
|    Detailed description  |       present here |
|                By this person   |              |
|                                   | Some text displayed |
|                                   | over the image     |
|                                   |                   |
------------------------------------------

I am utilizing vuejs along with vuetify, and my initial attempt at achieving this layout looks something like this:

<div style="position:absolute; top:0px; right:0px; width="60%"; background-image: url('/Background1.png');> </div>
<v-row>
  <v-col cols=5>Title goes here </v-col>
  <v-col cols=7><v-col>
<v-row>
<v-row>
  <v-col cols=8>A lengthy description by someone there</v-col>
  <v-col cols=4>Text overlaying the image </v-col>
<v-row>

This setup works well on my screen with resolution 1920*1080, but as soon as I resize the window, the alignment of the second row becomes problematic as it no longer corresponds correctly with the edge of the image.

I am aware that the issue stems from my use of 'position:absolute', but I am unsure how to tackle this problem using a different approach.

Any guidance or assistance you can provide would be greatly appreciated. Thank you!

Answer №1

Why is CSS grid not being utilized?

HTML:

<div class="container">
  <div class="title">Title</div>
  <div class="longDescription">Long description</div>
  <div class="img">Non-square image</div>
  <div class="textOverImg">Text over image</div>
</div>

CSS:

/* STYLING */

.container > div {
  display: flex;
  justify-content: center;
  align-items: center;
}

.title {
  background-color: blue;
  color: white;
}

.longDescription {
  background-color: red;
  color: white;
}

.img {
  background-color: yellow;
}

.textOverImg {
  background-color: green;
  color: white;
}

/* CSS GRID */

.container {
  display: grid;
  grid-template-columns: 40vw 10vw 40vw;
  grid-template-rows: repeat(10, 20px);
}

.title {
  grid-column: 1;
  grid-row: 1 / span 3;
}

.longDescription {
  grid-column: 1 / span 2;
  grid-row: 4 / span 7;
  z-index: 10;
}

.img {
  grid-column: 2 / span 2;
  grid-row: 1 / span 5;
}

.textOverImg {
  grid-column: 3;
  grid-row: 5 / span 6;
}

Experience the visual outcome here: https://codepen.io/Sa1m0n/pen/jOqZPOy.

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

Looking to eliminate the vertical spacing of the <hr> tag?

Summary: For a quick solution, just click on the image at the bottom. Greetings to everyone! I am facing an issue with two <div> elements that I need to separate using a <hr class="separator"> element. Below is the CSS code for the ...

What is a method to position an <img> on top of text without obscuring the text or resorting to CSS background or text-indent

To view the related code snippet, click on this link: http://jsfiddle.net/Ws8ux/ Is there a way to position the text under the logo without hiding it through display:none or text-indent? I am aiming to bring the image up while keeping the logo in the back ...

Tips on updating the default checkbox dynamically based on the current checkbox using JavaScript

Seeking to enhance the design of a Perl-generated form with custom CSS effects, rather than relying on the default Perl form. Despite successful functionality, encountering an issue where radio button focus reverts to default selection (Date) after submitt ...

JavaScript drag functionality is jerky on iPads, not seamless

I am currently attempting to implement a feature where I can drag a div (#drag) within its parent container (#container) using only pure JavaScript. This functionality is specifically required to work on iPad devices only. After writing a script that func ...

updating the HTML DOM elements using JavaScript is not yielding any response

One way that I am trying to change the background of a div is by using a function. Below is an example of the html code I am working with: $scope.Background = 'img/seg5en.png'; document.getElementById("Bstyle").style.background = "url("+$scope.B ...

The col-md-4 class in Bootstrap does not consistently maintain a width of 33%

Currently, I am utilizing bootstrap cards in my project. The number of cards within a card-deck varies dynamically. However, I have encountered an issue where each card should occupy a width of col-md-4 (33%). Everything works fine when there are more than ...

Choosing CSS/JS selector: Pick the final element with a class that does not match

My goal is to extract the most recent td element from the latest tr within an HTML table, ensuring that the latest td does not belong to the disabled class. I am attempting to achieve this using pure JavaScript with CSS selectors (without relying on jQuer ...

Is OpenLayers + Ajax causing issues or errors?

Utilizing the code provided below to showcase an OpenLayers map within a DIV container presents a peculiar issue. Upon initial load of the webpage, the map does not display consistently - requiring multiple page refreshes in order for it to become visible. ...

Make sure PTable maintains a horizontal layout on any device with PrimeNG

When I view my Ptable on desktop or iPad, it looks like this: https://i.stack.imgur.com/ONqZV.png However, when I switch to a device like an iPhone X, it changes to this layout: https://i.stack.imgur.com/H2q7j.png I want the horizontal layout to displa ...

Switching hover behavior on dropdown menu for mobile and desktop devices

I have implemented a basic JavaScript function that dynamically changes HTML content based on the width of the browser window. When in mobile view, it removes the attribute data-hover, and when in desktop view, it adds the attribute back. The functionalit ...

Is there a way to locate and delete an image element with a broken hyperlink?

My website is currently hosted on Wordpress, and I've noticed that there is an issue with a broken image link on my site. I'm not sure when this occurred, but it seems to only be affecting the post section of my site. https://i.sstatic.net/iarDU ...

Showing a placeholder image in the absence of any image

I need help with displaying a default image when there is no uploaded image in the CMS. Here is the code I have so far: <li><img alt="" class="img-responsive" src=" <? if($artikel[0]['images'] == '' ...

How do you transfer drop-down values from an HTML template to views in Django?

I am trying to figure out how to pass the selected option value in a drop down menu to the views. The HTML code of my template is as follows: <select name="version" id="version" onchange="location = this.value;"> &l ...

Tips for avoiding overflow while utilizing animations

In my current project, I am facing an issue with a container div that has the CSS property overflow: auto which cannot be removed. Inside this container, there is another div that toggles between showing and hiding using an animation triggered by a button ...

Changing the height of a table row using CSS transitions

I need help with a CSS table that has rows of the same height. I want to make it so that when a user clicks on one row, that row expands to fill the entire table height while the other rows fade away. I originally had this working by setting display:none o ...

Error message stating that there is no property 'collection' in Firestore when using Firebase v9 modular syntax in Firebase Firestore

Working on a React application that makes use of Firebase Firestore for handling database operations, I recently upgraded to Firebase version 9 and adopted the modular syntax for importing Firebase services. Nevertheless, when attempting to utilize the co ...

Is there a way for me to create a sidebar that is scrollable, like the one on www.youtube

Hey there! I'm looking to incorporate a feature on my website that resembles the layout of https://www.youtube.com/. More precisely, I want to have a sidebar on the left side displaying playlists, subscriptions, and other options. However, I don' ...

Creating an 8-bit grayscale JPEG image using HTML5 and encoding it from a canvas source

Is there a simple method to convert an 8-bit grayscale JPEG from Canvas using client side technologies in a web browser (such as HTML5, canvas, WebGL, and JavaScript)? Are there any pre-made JavaScript libraries available for use, without requiring extens ...

"Having trouble with a single line conditional statement not functioning properly within data in a Vue

I am facing an issue with setting the data named isVendorOrAgent in a component. It should be either false or true> based on a property that the component receives. I noticed that when I tried setting this condition within the data section of the compon ...

Resizing a webpage to fit within an IFRAME

Having just started learning HTML, CSS, and JavaScript, I am attempting to incorporate a page as a submenu item on my website. Below is the code that I have so far: <!DOCTYPE html> <html> <meta name="viewport" content="width=1024"> ...