Having issues with Inline-Block functionality?

I am facing alignment issues with an image and a container placed next to each other. The rest of my website uses inline-block without any problems.

If someone could provide guidance on how to resolve this, it would be greatly appreciated.

Below is the snippet of my code:

.talentcontainer {
  width: 960px;
  height: auto;
  margin: 0 auto;
  background-color: #fff;
}
.talentimg {
  width: 250px;
  height: 280px;
  max-width: 80%;
  text-align: center;
  display: inline-block;
  -moz-border-radius: 10px;
  -webkit-border-radius: 10px;
  border-radius: 10px;
  /* future proofing */
  -khtml-border-radius: 10px;
  /* for old Konqueror browsers */
  overflow: hidden;
  margin: 0 auto;
}
.talentcontent {
  width: 450px;
  height: auto;
  max-width: 80%;
  text-align: center;
  display: inline-block;
  background-color: #000;
  margin: 0 auto;
  min-height: 280px;
  margin: 0 auto;
}
<div class="talentcontainer">
  <div class="talentimg">
    <img src="http://i.gyazo.com/1d998394554d8c58d5b504ff959c3528.png">
  </div>
  <div class="talentcontent">
    <h8>NAME HERE</h8>
  </div>
</div>

Additionally, I have attached an image depicting the issue at hand:

Answer №1

For achieving the desired layout, use the CSS properties vertical-align: top in conjunction with display: inline-block.

.talentcontainer {
  width: 960px;
  height: auto;
  margin: 0 auto;
  background-color: #fff;
}
.talentimg {
  width: 250px;
  height: 280px;
  max-width: 80%;
  text-align: center;
  display: inline-block;
  vertical-align: top;
  -moz-border-radius: 10px;
  -webkit-border-radius: 10px;
  border-radius: 10px;
  /* future proofing */
  -khtml-border-radius: 10px;
  /* for old Konqueror browsers */
  overflow: hidden;
  margin: 0 auto;
}
.talentcontent {
  width: 450px;
  height: auto;
  max-width: 80%;
  text-align: center;
  display: inline-block;
  vertical-align: top;
  background-color: #000;
  margin: 0 auto;
  min-height: 280px;
  margin: 0 auto;
}
<div class="talentcontainer">
  <div class="talentimg">
    <img src="http://i.gyazo.com/1d998394554d8c58d5b504ff959c3528.png">
  </div>
  <div class="talentcontent">
    <h8>INSERT NAME HERE</h8>
  </div>
</div>

Answer №2

To achieve this, you can utilize the floating property on the elements. Specify "float: left" for both elements.

.talentimg{
    float:left;
}

.talentcontent{
    float:left;
}

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

Having trouble with the scrolling feature on a read-only text area within a form

My form allows users to input their data, but once submitted, the form becomes read-only. However, I'm facing an issue where the data in the text area is not scrollable even though it should be. I need assistance in figuring out why the content in th ...

PHP Unable to Locate the header.html File Within the Specified Directory

Currently, I am facing an issue while trying to use PHP to incorporate the same header, navigation, and footer elements on all my website pages. The problem arises when the .php file fails to recognize the header.html file for an include("/header.html") op ...

Develop a circular carousel using React JS from scratch, without relying on any third-party library

I am looking to replicate the carousel feature seen on this website. I want to mimic the same functionality without relying on any external libraries. I have found several resources explaining how to achieve this. Most suggest creating duplicate copies o ...

Problem with overlapping numbers in the Vis network

I am currently working on a project using Angular 8 and Visnetwork. Everything is going well, but I am facing an issue with overlapping numbers on lines. Is there a way to adjust the position of the numbers on one line without separating the lines? Can s ...

Centering the logo using Material-UI's alignment feature

Need help centering a logo in my login form using Material-UI. Everything else is centered except for the logo, which is stuck to the left side of the card. I've tried adding align="center" and justify="center" under the img tag, but it's still ...

The touchstart event is activated when you touch an item within

Is it possible to retrieve the index of ul li elements with touchstart, similar to how it can be done with a click function? <ul id = "list" ontouchstart="touchStart(event,'issues')"> <li> ...

Styling CSS to place an image in between text and background coloring

As I try to replicate a happy accident of mine, which originally occurred during my first attempt at CSS: I was just randomly adding selectors when I stumbled upon this unique layout. However, as I proceeded with rewriting the file, I failed to save the o ...

Choose a single SVG file based on its unique ID

Looking for some guidance - I have a vector file with 40 svgs all combined into one image. Each vector is identified by an id inside the <g> tag. How can I select a specific svg from this single file without choosing the entire image in html? PS: E ...

Connecting CSS and JS files in JSP was a bit of a challenge

Just starting out with jsp and using Glassfish server via netbeans. Struggling to link my jsp file with css and javascripts. Below is the structure of my files: Web Pages --Web-Inf --assets --css --style.css --js --jquery.js ...

Navigating events within the Material Design Light (MDL) mdl-menu component can be

I am utilizing Material Design Light with just PHP, jQuery, and MDL min CSS and JS, no other frameworks involved. Keeping it simple with a basic menu. <button id="lang-switcher" class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect"> ...

Unable to adjust the size of the font within a text field component in Material UI

I'm currently delving into learning Material UI and am faced with the task of enlarging the text field on my webpage. Despite embedding styles along with the field, the height, width, and other properties change except for the size. Here's the sn ...

Issue with Bootstrap4: organizing columns correctly within and outside a container

I've hit a roadblock while working on a project and can't seem to find the right solution. I've already created a design in Photoshop to illustrate what I'm trying to achieve: Photoshop Design. Basically, I want the main content inside ...

Alternative content can be pasted into the webpage

After finding out a peculiar phenomenon related to copy and paste, I decided to share it. If you head over to the Diablo 3 website () and scroll down to the bottom of the page, you will notice: ©2012 Blizzard Entertainment, Inc. All rights reserved A ...

Completely triggering a forced refresh on a single page application, disregarding cache, service workers, and all other

After experimenting with service workers on my Vue-built website, I made a critical error that has left Safari on my iPhone displaying only a blank page. To troubleshoot the issue, I connected my phone to my Mac and utilized Safari's inspector tool t ...

Directly insert an image into your webpage by uploading it from the input field without the need to go through the server

Can an image be uploaded directly from <input type="file" /> into an HTML page, for example through the use of Javascript, without needing to first save the image to the server? I am aware that AJAX can accomplish this, but if there is a way to ...

Creating dynamic animations by shifting the hue of an image on a canvas

Recently, I've been exploring the world of canvas tags and experimenting with drawing images on them. My current project involves creating a fake night/day animation that repeats continuously. After trying various approaches like SVG and CSS3 filters ...

Is it possible for Websockets to receive data from Ajax requests?

I am currently working on creating a PHP and HTML5 websocket chat system. In this setup, one end will be a socket while the other end will be AJAX. Is it possible for PHP's socket_recv() function to receive data from sources like AJAX, MySQL, or any o ...

Angular JS Unveiled: Deciphering HTML Entities

I'm looking for a solution to decode HTML entities in text using AngularJS. Here is the string I have: "&quot;12.10 On-Going Submission of &quot;&quot;Made Up&quot;&quot; Samples.&quot;" I need to find a way to decode this u ...

How can you pinpoint a particular td using both col class and td class?

.col2 .positive { background:green; } .col2.positive { background:green; } .col3 .positive { background:blue; } td{ border:1px solid blue; padding:5px; } <table> <col class="col1" /> <col class="col2" /> <col class="co ...

What is the best way to conceal padding designated for invisible scrollbars?

I am facing a perplexing problem with a nav element that always shows an empty scrollbar area, even when it is not required. Here is how it looks with all content displayed: https://i.stack.imgur.com/PzeiP.png This is how it appears when the window heigh ...