The div "tags" cannot be positioned beneath the photo as it is automatically located alongside the image inside the div

Is there a way to place the "Tags" div beneath an image, creating a bar of tags below it? I've been struggling to position it properly without disrupting the flow of the page. Using absolute positioning is not an option as it would break the layout. Additionally, when I try to use Display:block; for the image, it doesn't occupy the whole top area of the div "pab".

html, body{
  margin:0px;
  padding:0px;
}

.text{
  font-family: "Bangers";
  font-size: 5vh;
  color:white;
}

body{
  background:#a89ed2;
}

#topbar{
  background:#483467;
  display:block;
  height:calc(10vh - 1vh);
  border-bottom: 1vh solid #ea5773;
}

#media{
  display:flex;
  flex-direction: row;
  height:9vh;
  padding: 0px 1vw
}

#cord img{
  width:8vh;
  height:auto;
  margin-top:.5vh;
  filter: invert(1);
}

#cord span{
  position:relative; 
  bottom:2vh;
}

#pab{
  display:inline-flex;
  height:50vh;
  width:40vw
}

#pab img{
  height:30vh;
  border:2px solid white;
}

#tags{
  width:40vw;
  height:20vw;
  margin-top:100%;
  margin-left:100%;
  
}
<!doctype html>
<html>
  <head>
    <link rel="stylesheet"
  href="https://fonts.googleapis.com/css?family=Bangers">
  </head>
  <body>
    <div id=topbar>
      <div id=media>
        <div id=cord><img src="https://cdn1.iconfinder.com/data/icons/logos-and-brands-3/512/91_Discord_logo_logos-512.png"><span class=text>Salt#7283</span></div>
      </div>
    </div>
    <div id=pab><img src="https://cdn.discordapp.com/attachments/741394397064855749/742603618481471539/Webp.net-resizeimage_39.png">
      <div id=tags></div>
    </div> 
  </body>
</html>

Answer №1

Do I need to mark all my CSS edits?

html, body{
  margin:0px;
  padding:0px;
}

.text{
  font-family: "Bangers";
  font-size: 5vh;
  color:white;
}

body{
  background:#a89ed2;
}

#topbar{
  background:#483467;
  display:block;
  height:calc(10vh - 1vh);
  border-bottom: 1vh solid #ea5773;
}

#media{
  display:flex;
  flex-direction: row;
  height:9vh;
  padding: 0px 1vw
}

#cord img{
  width:8vh;
  height:auto;
  margin-top:.5vh;
  filter: invert(1);
}

#cord span{
  position:relative; 
  bottom:2vh;
}

#pab{
  display: inline-flex; /*add*/
  flex-direction: column; /*add*/
  align-items: flex-start; /*add*/
  
  height:50vh;
  width:40vw
}

#pab img{
  height:30vh;
  border:2px solid white;
}

#tags{
  width:40vw;
  height:20vw;
  /*margin-top:100%;*/ /*remove*/
  /*margin-left:100%;*/ /*remove*/
  background-color: aquamarine; /*add*/
  
}
<!doctype html>
<html>
  <head>
    <link rel="stylesheet"
  href="https://fonts.googleapis.com/css?family=Bangers">
  </head>
  <body>
    <div id=topbar>
      <div id=media>
        <div id=cord><img src="https://cdn1.iconfinder.com/data/icons/logos-and-brands-3/512/91_Discord_logo_logos-512.png"><span class=text>Salt#7283</span></div>
      </div>
    </div>
    <div id=pab><img src="https://cdn.discordapp.com/attachments/741394397064855749/742603618481471539/Webp.net-resizeimage_39.png">
      <div id=tags></div>
    </div> 
  </body>
</html>

Answer №2

If you're looking for something similar to this design...

html, body{
  margin:0px;
  padding:0px;
}

.text{
  font-family: "Bangers";
  font-size: 5vh;
  color:white;
}

body{
  background:#a89ed2;
}

#topbar{
  background:#483467;
  display:block;
  height:calc(10vh - 1vh);
  border-bottom: 1vh solid #ea5773;
}

#media{
  display:flex;
  flex-direction: row;
  height:9vh;
  padding: 0px 1vw
}

#cord img{
  width:8vh;
  height:auto;
  margin-top:.5vh;
  filter: invert(1);
}

#cord span{
  position:relative; 
  bottom:2vh;
}

#pab{
  height:50vh;
}

#pab img{
  height:30vh;
  border:2px solid white;
}

#tags{

  
}
#wrapper{
 display: flex;
}
  <div id=topbar>
    <div id=media>
      <div id=cord><img src="https://cdn1.iconfinder.com/data/icons/logos-and-brands-3/512/91_Discord_logo_logos-512.png"><span class=text>Salt#7283</span></div>
    </div>
  </div>
  <div id="wrapper">
    <div id=pab>
      <img src="https://cdn.discordapp.com/attachments/741394397064855749/742603618481471539/Webp.net-resizeimage_39.png">
      <div id=tags>Tag Here</div>
    </div> 
    <div>
      Other Contents here
    </div>
  </div> 

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

Solving alignment issues by utilizing a clever negative margin-left technique for compact windows

I've managed to center-align a div using the following method: <div id="container" style="position:absolute; top:0px; left:50%; margin-left:-500px; width:1000px;"></div> After referring to this solution Trying to center div horizontally ...

Is it possible to create a single button that, upon clicking, fades in one image while simultaneously fading out another?

My goal is to have the blue square fade in on the first button click, then fade out while the red square fades in on the second click. Unfortunately, it seems that my current code is not achieving this effect. I'm open to any suggestions or help on h ...

IE8 not displaying background-image in Zen Subtheme of Drupal 7

I've been struggling to get my website to display properly across all browsers. Everything looks great except for IE8 and below. I'm not sure if it's a problem with Drupal, Zen, IE, or CSS (although the CSS code seems correct). Here is the C ...

Hover over the image to trigger animation effects

Looking for a way to enhance my current jQuery script that creates an orange transparent hover effect over images. How can I add animations, specifically a fade in and out effect? $(document).ready(function() { $('#gallery a').bind('mo ...

What is the best way to continuously loop an image from left to right and right to left indefinitely using JavaScript?

As part of the challenge, I am tasked with creating a Pacman game using HTML, CSS, and JavaScript. One key aspect is to control the movement of the ghosts throughout the game. However, I am facing an issue with the current function that controls the ghost& ...

Developing a custom styling class using JavaScript

Looking to create a custom style class within JavaScript tags. The class would look something like this: #file-ok { background-image: url(<?php echo json.get('filename'); ?>); } Essentially, the value returned from the PHP file (json ...

Unable to use the ordered tag correctly in typing

Please review the HTML and CSS Code provided below: HTML : <ol> <li>Test</li> <li> <ol> <li>Sub-Chapter</li> <li>Sub-Chapter</li> </ol> < ...

Customize your form fields with Bootstrap 3 input groups

Currently, I am working on implementing a bootstrap 3 input group, but unfortunately, the outcome is not meeting my expectations. My goal is to create a select [input]-[input text]-[button] structure all in one line. However, in my scenario, the button has ...

What could be causing the unexpected gap between the first two elements and the third in my flexbox layout?

I am facing an issue with the layout of my third child element. Instead of appearing below the first two children, it is wrapping around to the bottom of the container. Can anyone explain why this is happening and suggest a solution? Even though I have se ...

Utilizing the overflow feature in conjunction with a specified height

Take a look at this image, the overflow:hidden property is not working as expected and some text is still visible that I want to hide without adjusting the height. How can I achieve this? Focusing on the highlighted area in Red, it is causing irritation. ...

Clear all CSS styles applied to a targeted division

My website built on Wordpress links to several CSS files. One specific div has its own unique style that is separate from the main Wordpress styles. Unfortunately, the Wordpress CSS ends up interfering with my custom div's layout. Is there a way in HT ...

Is there a way for me to manage the appearance of the printed document's layout?

I have successfully added 3 print buttons to my website, each one designed to print a specific portion (div) of the webpage. Here is the code snippet for this functionality: function printPage(id) { var html="<html>"; //html+="<link rel="st ...

The alignment of h2 headings becomes disordered beyond a specific viewport width

Can someone help me with an issue I'm facing regarding the placement of my "rightside" navigation? The problem arises when the viewport width drops below 767px, causing the h2 elements in the rightnav to align themselves directly next to the #leftnav. ...

What is the best way to close a popup window?

Is there a way to close my popup? function hidePopup(){ document.getElementById("popup-1").classList.remove("active"); } @import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap'); .popup .overlay{ positio ...

Switch up the color of the following-mouse-div in real-time to perfectly complement the color that lies underneath it

I am trying to create a div that changes color based on the complementary color of whatever is underneath the mouse pointer. I want it to follow the mouse and dynamically adjust its color. This functionality is similar to what Gpick does: https://www.you ...

JavaScript: Selecting parent elements using getElementsByClassName

I am dealing with the following HTML code: <div class="item"> <img class="item-image" src="${item.getImage()}"/> <p>${item.getName()}</p> </div> and JavaScript: var classname = document.getElementsByClassName("item" ...

The form yields no response and fails to send any data

Ensuring that the form on this site successfully sends the name and phone number is crucial. However, upon clicking the send button, I encounter an empty modal window instead of a response indicating whether the data was sent or not. The contents of the fi ...

Explanation for aligning anchors within an HTML <div>

I'm faced with this HTML snippet: <div class="row"> <div class="col-md-10 social-icons"> <a href="https://www.youtube.com/" target="_blank"><img src="/images/youtube-i.png"></a> <a href="https://gi ...

What is the best way to switch the visibility of a div on click from another div?

My goal is to make a div toggle visible or hidden when another div is clicked. The only connection between the two divs is that they are both nested within the same parent div. There's a DIV element with the class of "comment" which contains a DIV ele ...

Div element remains fixed in width while zooming in

I'm encountering an issue with a centered div, where the width is set to 50% and the max-width is set to 100%. When I zoom in, the width remains constant but the height increases. Despite setting the max-width to 100%, why does this occur? And most im ...