Require assistance in positioning a div menu within another div

Struggling to create a social media menu for my about page, I can't seem to get it aligned properly within another div or on its own. It appears slightly off center and I'd like it to either float left with a 100px margin or be nested in the other div. There's another centered div on my page acting as a nav bar.

HTML

<div class="center">
<div id="social" class="ul li">
<ul>
<li>
<div class="caption">Linkedin</div> 
<img src='linkedin.png'/>

</li>
<li>
<div class="caption">Twitter</div><img src='twitter.png'/>

</li>
<li>
<div class="caption">Github</div>
<img src='github.png'/>
</li>
<li>
<div class="caption">Facebook</div><img src='facebook.png'/>
</li>
<li>
<div class="caption">Instagram</div>
<img src='instagram.png'/>
</li>
<li>
<div class="caption">Hangouts</div>
<img src='hangouts.png'/>
</li>
<li>
<div class="caption">Yelp</div>
<img src='yelp.png'/>
</li>
<li>
<div class="caption">Pinterest</div>
<img src='pinterest.png'/>
</li>
</ul>
</div>
</div>
</div>

CSS

.social ul li div {
display: none;
text-align: center;
position: absolute;
top: 45px;

jQuery

$('ul li').mouseenter(function () {
var image = $(this).find('img'),
    caption = $(this).find('div');

caption.width(image.width());
caption.height(image.height());
caption.fadeIn();
}).mouseleave(function () {
var image = $(this).find('img'),
    caption = $(this).find('div');

caption.width(image.width());
caption.height(image.height());
caption.fadeOut();
});

Answer №1

It seems like you might be looking to adjust the positioning of your #social div by 100px from the left. If that's what you're aiming for, you can achieve this using the following CSS:

#social{
    position:absolute;
    left:100px;
}

You can see this code in action on this jsfiddle link. If my explanation doesn't quite address your question, please let me know so I can try to better understand and assist you.

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

The challenge of styling table borders with CSS

Can anyone help me with a problem I'm having while trying to create simple borders on a table? The border appears bold in the second row and last row, does anyone know why this is happening? https://i.sstatic.net/bCuhK.jpg Just a note: when I checke ...

Incorporating an unique identification code within the input field

I have a HTML code that displays geolocation information: <span id="currentLat"></span>, <span id="currentLon"></span> When combined with JavaScript, it works perfectly. However, I am trying to display the above value in a text fi ...

Utilize the assigned value of a variable from a separate file

Is it possible to set a variable in an external file called "Variable.js", assign it a value in a file named "Page1.html", and then use that variable with its assigned value in another file named "Page2.html"? For example, let's consider the contents ...

How to retrieve the count of div elements using JQuery

I am working with multiple divs: <div class="somediv">text</div> <div class="somediv">text</div> <div class="somediv">text</div> <div class="somediv">text</div> When a ...

HTML Table Column Alignment: Ensuring a Clean and Organized Layout

I'm currently working on constructing tables that demonstrate parent/child connections. Consider this example. <head> <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_em ...

Dynamic Product Showcase using Bootstrap Framework

Currently, I am working on creating a product listing section for a hypothetical e-learning website that I'm developing. The top image is intended for desktop viewing, while the bottom one is optimized for mobile users. https://i.sstatic.net/vq8R2.p ...

Discover the URLs that are connected to my iframe/widget

I've crafted a widget.html page that includes a "Powered by Example.com" box or widget. Additionally, I've implemented an HTML iframe that points to this specific page (widget.html) on my website. <iframe src="http://example.com/widget.html"& ...

How can I make a clickable <div> easily navigable with tab functionality?

I am currently tackling a project that involves implementing an onclick event within a <div>. While I've successfully set up the primary functionality, there is one issue at hand. Specifically, I need the onclick event to trigger when a user nav ...

On click, the current image should be replaced with the thumbnail image

I have been working on a project and came across a codepen link https://codepen.io/robgolbeck/pen/bVGmop that is similar to what I need. However, I am trying to achieve a specific functionality where clicking on a thumbs image replaces the large image with ...

Ways to make JavaScript cycle through a set of images

I'm having trouble trying to set up a code that will rotate multiple images in a cycle for an image gallery I'm working on. So far, I've only been able to get one image to cycle through successfully. Any help or suggestions would be greatly ...

What is the best way to align this button to the right?

I'm really struggling with this issue and could use some assistance. I've been trying to place this green button on the right side since yesterday, but traditional methods like using margin aren't working. HTML <ion-header> &l ...

JavaScript HTTP request causes website navbar animation to malfunction

Currently, I am assisting a client with their static website. This task isn't my primary role, but due to some expertise in this area, I have volunteered to support them. To streamline the process and avoid duplicating HTML code across multiple files, ...

Unable to get the Gtranslate function to function properly within the drop-down menu

Currently, I am using Gtranslate.io languages on my website with flags displayed without a drop-down menu. Everything is running smoothly but now I am looking to enhance the user experience by placing the flags inside a drop-down list. I want English to ...

How can I apply styling to a hyperlink that links to a specific anchor in HTML?

I’m currently dealing with anchor links positioned at the top of my page that navigate to scroll-out infoboxes located at the bottom. When a user clicks on one of these anchors, it directs them to the corresponding box below; however, I also want these b ...

Continuous scrolling to ensure that the child element remains perfectly centered

Within my parent div named lyricpadding, there are several <h4> elements with unique IDs. My goal is to use Jquery, Javascript, or CSS to ensure that the <h4> with the class of highlighted remains centered within the parent container. I do no ...

Modify the class of the dropdown and heading 2 elements if they meet specific conditions using Animate.css

Is it possible to add a class using jQuery when two specific conditions are met? 1) If the dropdown selection is either "acting" or "backstage" 2) If the membership status is set to "Non-member" If both of these requirements are fulfilled, I would like ...

Is there a way to organize an array of elements into three columns using PHP?

My array of menu items is being displayed on the screen in 3 columns, but I want them to appear differently without altering the HTML structure. Currently, they are listed like this: 1 2 3 4 5 6 7 8 9 I would like them to display as follows: 1 4 7 ...

Removing an object from a THREE.js scene while eliminating the Ray effect: Tips and tricks

function collisionDetection(bullet, b){ for(var i = collidableMeshList.length-1 ; i>=0; i--){ var collideMesh = collidableMeshList[i]; var v = collideMesh.geometry.vertices[0]; var c = collide ...

Is there a way to showcase a row of images when a button is clicked?

I am looking to create a functionality where pressing one of the buttons shown in the image below will toggle visibility of specific sections containing 3 images each. For example, clicking on "Tapas" will only display tapas images and hide main course ima ...

Unable to get the splash screen to display at 100% height using CSS

Here is an example of a splash screen I have created. HTML <div id="spalsh"> <span> <img src="{% static 'dbexplorer/img/loading.gif' %}" style="height: 100px;" > </span> </div> CSS #spalsh{ width: 98%; ...