CSS/Jade/HTML: struggling to get boxes to align properly on the same line

I'm currently working with a Jade template that looks like this:

extends layout

block content
  h2 Characters and Portraits
  div(id="portraitsBox")
    - var portraits  = ["Clown-Fox", "Dragon-Bear", "Fish-Bear", "Deer-Wolf", "Salamander-Ant", "Side-Duck"];
    for filename in portraits
        - var url = "/images/portraits/" + filename.toLowerCase() + ".png"
        div(class="characterBox" id=filename)
          h3(class="characterName")= filename
          img(class="portrait" src= url)
  link(rel='stylesheet', href='/stylesheets/characters.css')

The CSS it's using is as follows:

#portraitsBox {
  border: 1px solid black;
  padding: 10px;
}

.characterBox {
  position: relative;
  padding: 5px;
  border: 1px solid black;
  width: 350px;
  display: inline;
}

.characterName {
  padding-top: 0px;
  width: 150px;
  font: Arial;
  text-align: center;
}

Everything seems to be fine without the display: inline property, but once I include it, it messes everything up. The result can be seen here:

And for some reason, the container div resizes itself to 169.9px wide! What could be causing this issue? I've checked for Bootstrap default stylings in Firebug, but there doesn't seem to be anything overriding my custom CSS (which is included in the extended layout file).

Answer №1

Are you seeking to achieve this outcome:

I'm a bit puzzled because you mentioned that disabling display inline should work fine, but when I tested it, the elements still appeared as block.

If the screenshot demonstrates your desired result, simply adjust the wrapper #portraitsBox to have a display property of flex.

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 could be the reason my CSS and Javascript animation is not functioning properly?

Currently working on creating a dynamic animation menu using CSS and Javascript, but encountering some issues. The concept involves having a menu with initially hidden opacity (using CSS), which becomes visible when the hamburger menu is clicked, sliding i ...

the language of regular expressions expressed in strings

As a beginner in Javascript and regular expressions, I found myself stuck on how to create a route that matches all URLs starting with /user/.... Initially, I thought of using app.get(/user/, function(req, res){ /*stuff*/}); However, curiosity led me to ...

skywalking statistics api key

Hey everyone! I'm working on a node.js application and I'm trying to create a dashboard that shows usage statistics based on endpoints, each with their own API key. My app is built on node.js 16 + postgres + skywalking. For instance, the requests ...

Experiencing a compatibility issue in React while attempting to integrate Material-UI (MUI

Working on a react project, I decided to incorporate MUI and MUI icons by using npm install @mui/material and npm install @mui/icons-material. After importing the SearchIcon, however, an error message appears on my react page: ./node_modules/@mui/styled- ...

Unlimited highway CSS3 motion

I have come across a stunning 2D Highway background image that I plan to use for my mobile racing game project which involves JS and CSS3. The image can be found at this link. My goal is to create an animation of the road in order to give players the illu ...

Which is the Better Choice for an MMO WebSocket Server: Node.js or C++?

Contemplating creating a live game using WebSockets for the web has been on my mind. With my knowledge of Node.js, it's tempting to develop it there. However, C++ appears to be the favored server language due to its speed. Would it be best to try bui ...

What is the process for converting a CSV file to JSON format using node.js?

I am working on converting a CSV file from Clash Royale into an array. The CSV file has over 40 properties in its header or data. For example: name level count upgrade cost common 14 5, 20, 50, 100 rare 12 50, 150, 400, 1000 Below is my node.j ...

Is there a workaround for the issue of the NodeJS Web Cryptography API require() being undefined in an unsecure origin (Heroku App)?

My goal is to implement the experimental Web cryptography API (SubtleCrypto) on my Node.js server hosted on Herokuapp. The aim is to encrypt data from a fetch request sent from gitpages to herokuapp, concealing sensitive information from the browser consol ...

Error: The function register.route(...) does not support the use method

Upon using express.Router(), I encounter an error when attempting to apply the use method, resulting in the following message: TypeError: register.route(...).use is not a function Code /server/routes const express = require('express'); const re ...

Examining the anticipated timeout in the mocha test

I have a Faye publish/subscribe server that sends a message to new subscribers only if a message has already been sent to the other subscribers. I am currently using mocha for unit testing. This initial test verifies the basic functionality: it(&apos ...

I attempted to implement "cors" in my project, but encountered the error message "Access to XMLHttpRequest has been blocked". What could be causing this issue?

I am facing an issue with my express API where I receive a CORS error message after making a request. Error: Access to XMLHttpRequest at 'http://localhost:9000/api/courses' from origin 'http://localhost:4222' has been blocked by CORS p ...

Trouble with DevExpress ASPxButton: Some Properties Fail to Update

It's been a while and I'm facing a tough challenge. I need to change the image source of an ASPxButton from the code behind, but it seems like the height, width, and border style are getting lost in the process (resulting in an image with its own ...

When removing the class "img-responsive" from an image, the bootstrap columns begin to overlap

Just starting out with Bootstrap while working on an Angular2 project and I have a question. Currently, I have a map-component taking up 3 columns on the left-hand side, but every time I resize the browser, the image also resizes. I want the image to rema ...

Master the Art of Image Loading in Codeigniter

Hey there, I'm completely new to Codeigniter. In the Controllers folder, I've created a file called caller.php and in the \Views directory, I've created a file named home1.php. Additionally, within the root directory, I've made an ...

Issue: Lost connection - The server has terminated the connection in Node.js MySQL environment

I keep encountering this error after a period of inactivity. I suspect it is due to MySQL being idle. Can anyone provide suggestions on how to prevent this error from happening? Error: Connection lost: The server closed the connection. at Protocol.e ...

Tips for utilizing dynamic variables when setting props in React Native styles

I am encountering an issue while trying to set props in the stylesheet to dynamically change the background color based on data received from the server. undefined is not an object (evaluating 'this.props.colorCode') Below is the snippet of my ...

Creating Eye-Catching Images by Incorporating Image Overlays Using Just One Image

I'm facing a bit of a challenge here. I need to figure out how to overlay an image onto another image using just a single image tag. Specifically, I want to add a resize icon to the bottom right corner of an image to let users know they can resize it ...

Using Express JS (Node JS) to log the input array field with single quotes applied

I have designed a form with various input fields, including an array input field : <input type="hidden" id="user_id" name="user_id" value="1" /> <input type="text" name="test[0][name]" value="car" /> <input type="text" name="test[1][value]" ...

Update the display of the mouse pointer

I use CSS to set a custom cursor image: #scroll_up{ display: block; position: absolute; width: 960px; height: 300px; cursor: url(../imgs/cursor_up.png), auto; } The above style is assigned to a div element so that the cursor appea ...

What steps are needed to design a search bar similar to Zomato's?

I am looking to create a search bar that resembles the one on . I have managed to make a floating search box on top of my background image. However, I am unsure how to align various input fields and buttons side by side. Below is the current CSS code I am ...