Tips for resizing an element's width without affecting its contents

Greetings (Baguette English speaker), I'm facing an issue where a certain element appears too large without any valid reason, and I'm seeking guidance on how to rectify it. Despite my attempts to adjust the width and padding, the problem persists. You can see in the top left corner that the block is excessively wide.

Below is the CSS for the Facebook logo, but the same anomaly occurs across all logos:

.reslogo {
position: fixed;
z-index: 200;
top: 0px;
-webkit-transition: .3s ease-in-out;
transition: .3s ease-in-out;
color:#fcecd9;
width: auto;

}

.facebook{
left: 0%;
top:-10%;
animation-name: logofb;
animation-duration: 0.5s;
animation-delay: 7.5s;
animation-fill-mode: forwards;
transition-property: top;
-webkit-transition: .3s ease-in-out;
transition: .3s ease-in-out;
}

@keyframes logofb {
from {top:-10%;}
to {top: 0%;}
}

.facebook:hover {
margin-top: 2%;
box-shadow: 10px 5px 5px black;
}

I'm looking for a solution to ensure the box perfectly aligns with the logo size.

Answer №1

give this a shot.

<!DOCTYPE html>
<html lang="en-US>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Web Page</title>
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.9.2/css/all.css" integrity="sha384-60iBUHEmvpQ+7lW4y48PXFnhCaXq0LM5d66M1N7hH1+njAivzOeqgndPJK28bnvf" crossorigin="anonymous">
    <link rel="stylesheet" href="styles.css">
</head>
<body>

    <div class="icon-container">
        <i class="fab fa-facebook-f icon"></i>
        <i class="fab fa-instagram icon"></i>
        <i class="fab fa-youtube icon"></i>   
    </div>

</body>
</html>

 *
{
    margin: 0;
    padding: 0;
}

.icon-container
{
    background: #333;
    display: flex;
    height: 40px;
}

.icon
{
    color: #FFFFFF;
    font-size: 24px;
    padding: 6px;
}

Output

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

Designing links within a web application

Currently, I am developing a web application that will contain a high volume of clickable elements. The challenge lies in maintaining a visually appealing design while adhering to web best practices such as using different colors and underlines for links. ...

Refresh the DIV content using an external file

I have an external file containing text that is updated regularly. <div id='1'>TEST 1</div> <div id='2'>TEST 2</div> <div id='3'>TEST 3</div> This file is named IO.HTML. My script retrieves ...

Migrating from PHP/MySQL to PDO: A Smooth Transition

I am a beginner in PHP/MySQL and I have some queries. I was watching a YouTube tutorial on creating a basic dynamic website that retrieves data from a MySQL database and displays it on a single PHP index page. I followed the tutorial up to the point wher ...

Strange behavior observed in Google Maps when using multi-colored polylines

Take a look at the code snippet below : View Sample Html In the code, two Polylines are defined. Although the first one is set to display in red, both lines appear in yellow. If I swap the order of variable definitions like so: var route1 = var route ...

Modify the width of a div element by clicking on it using Javascript

I need to achieve three tasks onclick: change the display:none property of the element with id="notes_content" to display: block modify the width of the element with id="oct" from 1190px to 550px update the width of elements with class="oct_days" from ...

JavaScript: Retrieve the second value from a select dropdown menu

What is the method to retrieve and display the second value of "investortype" within "exploremax"? <script type="text/javascript> function $(id) { return document.getElementById(id); } function addCommas(nStr) // adds commas f ...

What is the best way to utilize a single component from Twitter Bootstrap?

Is there a way to use the Twitter Bootstrap plugin from this website ( https://github.com/silviomoreto/bootstrap-select ) for only one specific element on my webpage? I don't want all elements on my site to adopt the Twitter Bootstrap styling (such as ...

Video streaming platform without the need for javascript and plugins

Is it feasible to watch Youtube videos without relying on javascript and plugins, exclusively using HTML5 or a similar alternative? ...

Utilizing CSS grid to center one specific div, while aligning the remaining divs on the subsequent line

I need to create a pyramid structure within a parent div utilizing 4 child divs. The first child should be centered, with the remaining children positioned below in a second row. <style> .parent { width: 100%; display: grid; grid-template-co ...

Navigating the process of returning a list from an AJAX method to a view through a controller in ASP.NET MVC

I need to retrieve a list from my controller and pass it to the view. Currently, I have the following script: function fetchNames(_id, _name) { $.ajax({ type: 'Post', url: 'GetNames/', data: { id: _id, name: _name}, su ...

**Issue Resolved:** Looking to have the form results appear only when a valid input is submitted; otherwise, the

As a newcomer to PHP, SQL, and HTML, I've been learning for around 3 months now. Can someone assist me in achieving the following: I would like my form to display the results table only if a valid search has been submitted, showing only the database r ...

Unexpected server error encountered during navigation of php pages

I am using PHP to retrieve data from a MySQL table and display it in an HTML table. Each row in the table has a 'remove' button that triggers a PHP script (remove.php) to delete the corresponding row from the database table and return to admin.ph ...

Why is it that in IE9, submitting a basic form using jQuery doesn't seem to work?

Take a look at the code snippet below: <html> <head> <style type="text/css"> #myform {display:none;} </style> </head> <body> <button type="button" id="uploadbutton">Upload Images</button> <form name="myf ...

Slicknav is failing to appear on the screen, although it is being

After spending hours trying to implement a slicknav menu into my school project, I'm stuck and seeking guidance. Despite having some coding experience, I can't seem to find the solution to my problem. Any help, insight, or tips on fixing or impro ...

Avoiding special characters in URLs

Is there a way to properly escape the & (ampersand) in a URL using jQuery? I have attempted the following methods: .replace("/&/g", "&amp;") .replace("/&/g", "%26") .replace("/&/g", "\&") Unfortunately, none of these are y ...

Position the caret beneath the anchor text

<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="text-decoration: none"> <span class="criteria">any</span> <span class="caret" style="margin-top:6px;"></span> </a> The code snippet above ...

How can I make the footer on my webpage have a white background?

My goal is to create a white div that spans from point (A) to point (B) on the page, just like in the image. I aim for it to stretch all the way down to cover the entire browser without showing any gray background underneath, even when the page is scrolled ...

Overflow scroll block containing a table within a div element

I am working on displaying a loop of records fetched from the database. I want to place these records inside a div block with overflow so that users can scroll through a long list easily. However, when I try to implement the below code, the appearance of t ...

Tips for showing tooltip above all else

Having an issue with the tooltip not displaying correctly. Tried adjusting the z-index with no success. Styling in CSS: a.tooltipA { outline:none; } a.tooltipA strong { line-height:30px; } a.tooltipA:hover { text-decoration:none; } a.tool ...

Connect identical Microdata domains without including one inside the other

I am trying to connect the same Microdata domain in a different div, this is what I currently have: <div id="colleau" itemscope itemtype="http://schema.org/Organization"> <!-- Here I have information like name, foundingDate, founders, etc... -- ...