Achieving the perfect alignment for a slideshow in CSS and HTML

Greetings everyone! I am looking to center my slideshow on my website and would greatly appreciate any assistance.

ISSUE I am trying to center the logo and the entire slideshow, but as you can see, it is slightly off-center to the right. VIEW ISSUE(IMG)

CODE

body {
    background: #E9E9E9;
}
div.box {
    display: block;
    text-align: center;
    margin: auto;
    z-index: 5
}

/* Navigation Menu Styles... */

/**********Start slideshow************/

.slideshow {
    position: relative;
    margin: auto;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* Slideshow Animation Keyframes... */

@-webkit-keyframes css-animation-fade {
    from { opacity:0;}
    5% {opacity:1;}
    15% {opacity:1;}
    20% {opacity: 0;}
    to {opacity: 0;}
}
<!DOCTYPE html>
<html>
<head>
<title>Paid Templates Packages</title>
   <link rel="stylesheet" href="paid.css" media="screen" title="no title" charset="utf-8">
  <link href="paid.css" rel="stlesheet" type="text/css">
</head>
<body>

<div class="box">
<a href="index.html"><img src="icon1.png" width="50%" height="50%"></a>

<div id="wrapper">
<div id="navMenu">

<!-- Navigation List Items... -->

<br class="clearFloat">

</div> 
</div> 

  <div class="slideshow">
  <img src="icon1.png" class="css-img">
  <img src="icon1.png" class="css-img">
  <img src="icon1.png" class="css-img">
  <img src="icon1.png" class="css-img">
  <img src="icon1.png" class="css-img">
  <img src="icon1.png" class="css-img">
  </div>
  </div>
  
</body>
</html>

When viewing the webpage on Chrome, the slideshow appears slightly offset to the right. Any help in resolving this issue would be highly appreciated. Thank you in advance for your assistance!

Sincerely, Zefrolity

In the "RUN SNIPPET", the slideshow displays as desired initially, however, when images fade in, they appear stacked under each other instead of transitioning smoothly.

Answer №1

Give this code a shot. I find it works well for centering elements.

.gallery {
    position: absolute;
    margin: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

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

Several directories containing references to PHP and CSS files

I'm encountering an issue with my PHP file named header.php. Here is the content of the file: <title><?php echo $title; ?></title> <link href="core/css/styles.css" rel="stylesheet" /> <link href="core/css/bootstrap.css" re ...

Utilizing Vue to Transform Unicode Characters into HTML Elements

I have a scenario where an API response contains a Unicode string that needs to be displayed correctly in the view. Despite Vue treating it as a string and not automatically converting it to HTML, I believe JavaScript should handle the rendering process. ...

Content below divs that are fixed and absolutely positioned

I have a design layout similar to this (a small snippet) and I am facing an issue where the text within .content is not clickable. The positioning of #gradient is fixed due to the background image, and #empty has an absolute position to cover the entire bo ...

Using PHP, eliminate all hyperlinks from the DOM HTML

I have a string called $processhtml that contains some HTML. My goal is to remove all link tags and their contents from the HTML using PHP. For example: "This is some text with <a href="#">link</a>" should become: "This is some text with" ...

Is the required attribute malfunctioning in HTML5?

I've come across some similar inquiries, but none of them address my specific question. I am working on a form where certain details are required, while others are optional. I have used the required tag for the mandatory fields. The submit button is l ...

Tips for positioning Bootstrap dropdown menus directly below the selected navigation item

Trying to position the "Big Dropdown" menu directly below the corresponding nav item has been challenging. Despite setting a max-width for the menu, achieving proper alignment has proven difficult. I'm looking for a responsive solution that is clean a ...

Attempting to utilize media queries in order to create a responsive header image

I am currently using Bootstrap 5 to build a website and I am facing an issue with making the header image responsive on mobile devices. While it looks good on desktop, laptop, and tablet screens, on mobile the text and button are not aligning well as they ...

Tips on concealing Bootstrap 5 modal through button press

I've created a Bootstrap 5 modal that allows users to download a file by clicking a button. Everything works as expected, but I'm facing an issue with hiding the modal after the download button is clicked. I've been trying to use jQuery to ...

Customize the background color of a clipPath in SVG

I'm looking to design a landing page featuring a colored div with a clip-path, intended to showcase a video playing in the background. However, I'm encountering an issue where the background looks grayish without any clear explanation. Despite t ...

Enhance iframe with hover effect

I'm currently working on a unique WordPress blog design where images and iframes (YouTube) transition from monotone to color upon hover. So far, I've successfully implemented the grayscale effect for images: img { -webkit-filter: grayscale(100% ...

Div surrounded by divs

Describing it can be a bit tricky, so I created this sketch to help illustrate: https://i.sstatic.net/K8KOM.png I have two divs - an outer div and an inner div. My goal is to add a line between the two divs. Is there a way to achieve this and what would ...

Combine CSS files in a specific sequence

In my project, I have multiple CSS files being generated in the css/ folder using libsass. Additionally, I already have a normalize.css file placed in the same directory to ensure consistent styling across different browsers. As part of my build process, w ...

An error was caught: Cursor blinking not functioning properly in textbox when using JavaScript

Currently, I am in the process of creating an HTML form that involves selecting items from a list box. Once an item is selected, an input text box is generated automatically for entering the quantity of the selected item. I have implemented a feature where ...

Exploring the creation of CSS animations using box-shadow effects

Looking to create a CSS animation where part of a line (200px) changes color like a gradient. Any ideas on how to achieve this effect? Below is the current code being used: * { margin: 0; padding: 0 20px; } h1 { text-align: center; } ...

There appears to be an empty void on the website

If you could kindly click on this link & use CTRL + F to search for the text "Info", you will see a visual representation similar to the image below. There seems to be quite a bit of empty space below these texts. I experimented with padding, display: ...

What is the best way to add two different texts (each with a distinct font) and an image into a NatTable cell while also adjusting the margins?

Just a couple of queries: 1) Is it possible to incorporate two different text fonts and an image into a NatTable cell? 2) How can the margins be set up like in the example image below? In different scenarios: a) Through Java 1.6 (without RichTexCellEdi ...

Tips on redirecting the user to the page they have selected

<section> <div class="container"> <select name="semester" id="select-semester"> <option value="no-semester">choose a semester</option> <option valu ...

Using a percentage in CSS translate can result in an image appearing blurry

I am facing a frustrating issue. Whenever I align an image using percentage-based transform translate, it results in a slight blur. This problem is specifically related to percentage alignment. Here is the CSS snippet: img { display: block; height: ...

Adding a border to an image using JQuery

I have implemented an image slider as shown below: <div class="bx-wrapper" style="width:516px; position:relative;"> <div class="bx-window" style="position:relative; overflow:hidden; width:516px;"> <ul style="width: 999999px; pos ...

Outformatted Layout in HTML Email on Outlook, Post-Image Loading

When I send HTML emails in Outlook, I encounter a problem. Initially, the images do not appear when I view the newsletter, but the table layout is fine. However, once I download the images and they fit perfectly in their cells, the layout suddenly breaks ...