Unable to get CSS class to apply to span element

I've been working on styling spans using CSS but for some reason, they don't seem to be taking the dimensions I assigned to them. I'm not sure what I am missing here in order for them to properly inherit the width and height values. Any suggestions would be greatly appreciated. Thank you!

HTML CODE

<div id="content">        
                <div class="forum-group">
                    <h2 class="header-2">General Discussion</h2>
                    <ul class="child-forums">
                        <li class="child-forum">
                        <a class="forum-link" href="#">
                            <span class="forum-icon"></span>
                            <span class="forum-details">
                                <span class="forum-title"></span>
                                <span class="forum-desc"></span>
                            </span>
                        </a>

CSS CODE

.forum-group{
    width:948px;
    height:259px;    
    margin-left:auto;
    margin-right:auto;
}
.header-2{
    width:948px;
    height:35px;
}
.child-forum{
    width:310px;
    height:106px;
    float:left;
    background-image: url(images/forum-child-background.jpg);
    opacity: 0.5;
    filter: alpha(opacity=50);
    margin-left:4px;
    margin-bottom:4px;
}
.child-forum:hover {
    opacity: 1.0;filter: alpha(opacity=100); 
}
.child-forums{
    width:948px;height:219px;
}
.forum-link{
    width:309px;height:106px;
display: inline-block; 


}
.forum-icon{
    width:60px;height:60px;
}
.forum-details{
    width:220px;height:43px;
}
.forum-title{
    width:217px;height:18px;
}
.forum-desc{
    width:217px;height:15px;
}

Answer №1

span tags are considered inline elements and therefore do not respond to the width and height properties.

To make these properties work, you can try changing them to display: inline-block.

Answer №2

It is recommended to apply the CSS property display:inline-block to your spans.

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

verifying the status of a checkbox with PHP (Terms and Conditions)

Struggling to figure out how to get the state of a checkbox using PHP. Spent hours searching on Google for solutions, but nothing seems to be working... The logic I need is to display an error message if the checkbox is not checked. Tried various methods ...

Issue with background opacity not functioning properly in Internet Explorer 8

I am facing an issue with displaying 2 images in IE8 and IE9. Below is the code snippet causing the problem: .ui-widget-content { border: 0px solid #aaaaaa/*{borderColorContent}*/; background: rgba(0, 0, 0, 0.1) ; /*{bgColorContent}*/ url(images ...

Make sure to concentrate on the input field when the DIV element is clicked

In my React project, I am working on focusing on an input element when specific buttons or elements are clicked. It is important for me to be able to switch focus multiple times after rendering. For instance, if a name button is clicked, the input box for ...

What causes a slow disappearance of both the form element and its child elements when the visibility attribute is set to hidden on the

Have you ever noticed that the child elements of an element form hide slowly when using visibility:hidden, but hide quickly when using display:none? This slow hiding can negatively impact user experience. I tried to find information on this issue, but eve ...

What is the best method for retrieving Json data and updating an HTML table in real time?

I am working with a Json data file that is updating every second. My goal is to display this data in real time on an HTML page of my website without having to reload the entire page. I am new to JavaScript and currently in the learning phase, so any help w ...

Adding color dynamically to text within ion-card based on a regex pattern

My goal is to enhance the appearance of certain text elements by wrapping them in a span tag whenever a # or a @ symbol is detected, creating the look of usernames and hashtags on Twitter. Below is the code I am currently using: TS FILE: ngOnInit(): void ...

Stop Duplicate Entries from Showing in Your Angular Project

In my application, there is a form that enables users to search for doctors based on the criteria they select from drop-down menus. Below is the structure of the form: https://i.sstatic.net/itguq.png When a user chooses a city and clicks the search butt ...

HTML forms default values preset

I need help with pre-setting the values of a dropdown menu and text box in an HTML form for my iPhone app. When the user taps a button, it opens a webview and I want to preset the dropdown menu and text field. Can someone guide me on how to achieve this? ...

Issue with sending form data to MySQL database

I have a couple of forms that need to be submitted to my database. I created a general function to update a specified table, but the problem is that the code doesn't modify the database; it only changes the column (fullname) to zero. Below is my code, ...

What is the process for adjusting settings through selected options in a pop-up menu?

Here are the choices available: <form> <select id="poSelect" > <option selected disabled>Choose here</option> <option id="buyeroption" value="100101">I am a Buyer</option> ...

Event delegation will be ineffective when the target element is nested within another element

After receiving a recommendation from my colleagues on Stackoverflow (mplungjan, Michel), I implemented the event delegation pattern for a comment list. It has been working well and I am quite excited about this approach. However, I have encountered an iss ...

Tips for aligning a Font-Awesome icon vertically centered with a line of text in Bootstrap 4

My goal is to vertically center a Font Awesome icon next to a small block of text. To better illustrate, here is a reference image of what I am aiming for: This is the visual I aspire to achieve The section of my website that I am currently fine-tuning ca ...

The JQuery click handler seems to only be functioning on the initial item

I am currently working on a table where I need to create a functionality that can change a value in the database for each row. However, I am facing an issue where the changes I make only affect the specific row in the table and not the rest of the rows. M ...

I am trying to confirm in PHP whether any of the gender checkboxes have been selected. However, the code I have tried so far does not appear to be functioning as expected

Please refrain from suggesting the use of checked = "checked" in HTML, as the validation must be performed in PHP as per the requirements of my assignment. PHP Code: if (isset($_POST["gender"])) { $gender = $_POST["gender"]; if (($gender != "male") || ( ...

Maximizing performance with internal Bootstrap?

An interesting concept to consider is that the fastest website could actually be an empty webpage. Each additional piece of data added compromises performance, yet it's the server's responsibility to send all the code to the client. When using ...

When a user chooses an item, the ui-select dropdown appears hidden behind additional fields on the screen

In my AngularJS application, I am utilizing ui-select within a table that repeats rows using ng-repeat. The following code snippet displays how ui-select is implemented: <ui-select name="{{'selProperty' + $index}}" ng-model="thing.property" ...

What is the reason for index.html requesting the css or js modules as if they were directories when loading?

I am currently developing a server using expressjs: 'use strict'; var express = require('express'); var logger = require('morgan'); var path = require('path'); var bodyParser = require('body-parser'); va ...

How can I format and send an email message using HTML?

I'm currently working on a form and encountering an issue. HTML does not natively support sending emails without a specific email program installed. Is there perhaps a way to send a message that can be converted into an email? Are there any services a ...

The right side alignment is malfunctioning

I need assistance with creating a section on a webpage that resembles a piece of paper, where there is content displayed on white background against a grey background. Here's what my CSS currently looks like: body { background:grey; } .page { ...

What is preventing me from utilizing global variables in distinct HTML and JavaScript files?

I am facing a perplexing issue with my HTML files, specifically index.html and lobby.html. Within main.js, which is loaded in index.html, I attempt to load lobby.html using window.location.href. Despite trying various methods to define global variables i ...