What could be causing the span tag to not have CSS applied and the background image to not be displaying

The header I have created, shown in the image, is facing two issues. Firstly, I am unable to add ellipsis to the span tag even though I used it. I want the ellipsis to appear when the screen resolution is small. Secondly, the image uploaded is not displaying correctly as it is just a demo image.

<div class='sign-out'>
    <span>Show  name</span>
    <a>Sign out</a>
</div>
.sign-out span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 10%;
}

I also want to include images as depicted in the attached picture.

<div class='toggle-icon'>
    <span class='image-background'>
        <img src='https://dl.dropboxusercontent.com/s/gisoddbkajwuk1j/chart.png?dl=0'/>
    </span>
    <span class='image-background'>
        <img src='https://dl.dropboxusercontent.com/s/6yft5r97hi1pik7/table.png?dl=0'/>
    </span>
</div>

[![enter image description here][1]][1]

When attempting to remove the background shadow of buttons using the following code:

.image-background{
    background-color: black;
    width: 30px;
    height: 25px;
    text-shadow: none !important;
    border: none !important;
    box-shadow: none !important;
  }

It doesn't seem to work properly. Any suggestions for this issue?

Answer №1

To resolve the ellipsis issue, make sure to address the following: When dealing with spans, remember that they are inline elements and therefore cannot have a set width applied directly. To work around this limitation, you can convert the span into an inline block.

.sign-out span {
    display: inline-blok;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 10%;
}

For more information, visit:

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

Using Paypal API in PHP to create a payment form

<?php $action=$_REQUEST['action']; if ($action=="") { ?> <center> <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type=" ...

Utilize the PHP json_encode() function in combination with MySQL to generate a JSON object for transmission to a jQuery function

I'm having trouble generating a json object from MySQL results with PHP. This is my PHP code $json = array(); $result = mysqli_query ($connection, $query); echo '['; while($row = mysqli_fetch_array ($result)) { ...

Running a JavaScript function within a designated div element

I'm currently facing an issue with executing a javascript function - onload only in a specific div. I seem to be stuck on this problem, so if anyone could offer some assistance, I would greatly appreciate it. Thank you very much in advance! functio ...

Servlet-enhanced Turn-Based Gaming Experience

I am working on developing a turn-based game, similar to Checkers, using Servlets and JSP pages. I have set up a specific page with a newGame button that redirects players to the gamePage. This redirect sends one player to Black.jsp and the other to Red.js ...

move position when clicked-javascript animation

Is there a way to create a button that changes a div's position with a 2-second transition on the first click and then returns it back on the second click? I tried implementing this code, but unfortunately, it doesn't bring the div back. va ...

Replicate the preceding input data by simply clicking a button

Here is some HTML and jQuery code that I am working with: $(".btn-copy").click(function() { var previousContent = $(this).prev()[0]; previousContent.select(); document.execCommand('copy'); }); <script src="https://cdnjs.cloudflare.com ...

Issues with HTML formatting in PHP emails

I am sending an approval/disapproval email to a user. I want to include a button in the email so that when the user clicks it, they can approve or disapprove the request. However, I am facing an issue as I cannot see the button in the mail when I receive ...

Is it possible to achieve a callback with jQuery after loading?

Currently, I am working with PHP and jQuery and have successfully implemented the following code. $(".design").load("<?php echo get_bloginfo('url'); ?>/?addmod_ajax=1",{ menu: 'layout', }); This is my desired action. I woul ...

Why won't my button's text resize?

I am facing an issue with my button's CSS code. In Chrome, when I resize the window to view the mobile layout, the text overflows outside of the div. a.syntra-green-button { background-color: #6faf3c; border: 1px solid #9dcc77; color: w ...

New Ways to Style the Final Element in a PHP Array - Part 2

So, here's the current challenge I'm facing along with a detailed explanation of what I'm trying to achieve. Initially, following your suggestions worked smoothly; however, things took a drastic turn when I altered the ORDER BY field and int ...

Utilize PHP to generate a table from data

I successfully created a table using information retrieved from my database, and everything is displaying as intended. However, I am facing an issue where adding a background color applies it to every row in the table. How can I add a background color wit ...

Having trouble with margin auto 0 not functioning properly in Safari on iPad?

I'm facing a challenge with centering a div in Safari on iPad. It works fine in Chrome, but in Safari there are margins on the left and right which require scrolling to view the whole content. Any suggestions on how to make this work seamlessly in bot ...

Typewriter Effect: The caret is advancing too quickly

I am trying to achieve a typewriter effect on my text, but the blinking cursor is extending further than the actual text. See Image for Problem Here is the code I am using: HTML: <div class="title"> <h1>Hi, I'm ConnerDE< ...

Transform this color matching game into an image matching game using JavaScript and jQuery

I have a color matching game that I would like to enhance by matching background-images instead of just background-colors. However, I am facing difficulties in making this change. For instance, instead of matching the color red with the text "red," I wan ...

What strategies can be used to ensure that the page layout adjusts seamlessly to even the smallest shifts in window size?

Of course, I am familiar with media queries and how they allow us to set specific min-width and max-width ranges for CSS changes. However, when I look at the website styledotme.com, I notice that the block/div beneath the navigation bar gradually shrinks ...

Is it advisable to utilize media queries and transform: translateY(-%) to position content above the mobile keyboard?

I've been struggling for nearly a whole day and could really use some assistance. I'm having trouble understanding how chat web apps manage to work around this particular issue. There have been numerous forum posts discussing the problem: I am tr ...

Is it possible to implement a personalized "Loading..." div in Fancybox 2?

Despite searching extensively, I have not been able to find a solution or any reference in the documentation at : Is there an option to substitute my own custom div in place of the loader GIF during the loading process when Fancybox is waiting for content ...

Tips for retrieving an input value following a DOM insertion

Developing a function to inject HTML into the DOM following an AJAX call like this: The function for injecting HTML $.ajax({ type: "POST", url: base_url + "main/GetTheLastSeq" }) .done(function( msg1 ) { ...

After receiving the response, the Ajax success function does not run as expected

I have written the following code: $(".simpleCart_shelfItem button").click(function() { $(this).prop('disabled', true); $(this).addClass('disabled'); $(this).html("Adding &nbsp;&nbsp;<i cl ...

Getting the userID variable in a pop-up modal in PHP

On a page, employee information is displayed after retrieval from a database using a foreach() loop to show employees matching the search criteria. See image below for an example: Clicking a button triggers a simple Bootstrap modal with basic form fields, ...