How can I position a div in the center of a fullpage.js slide?

I'm currently utilizing the fullPage.js plugin sourced from this link: . I have successfully implemented vertical slides by using the following HTML code:

<div class="section" id="section2">
        <div class="slide" id="slide1">
        <div id="logocontainer">
            <div class="help1">

                <div id="about_img">
                    London<br>
                    Paris<br>
                    Tokyo<br>
                </div>

                <div id="about_txt">
                    <h2>London</h2>
                    <p>
                    London is the capital city of England. It is the most populous city in the United Kingdom,
                    with a metropolitan area of over 13 million inhabitants.
                    </p>
                    <p>
                    Standing on the River Thames, London has been a major settlement for two millennia,
                    its history going back to its founding by the Romans, who named it Londinium.
                    </p>
                </div>

            </div>
        </div>
    </div>
        <div class="slide" id="slide2">

        <!--    <img src="img/R1.png" alt="a" id="stand-one" /> -->
        </div>

        <div class="slide" id="slide3">
            <h1>Slide 3</h1>
        <!--    <img src="img/R1.png" alt="a" id="stand-one" /> -->
        </div>
    </div>

Along with the accompanying CSS code:

.help1  #about_img{
    line-height:30px;
    height:660px;
    width:400px;
    float:left; 
    background-color: #eeffaa;
}
.help1 #about_txt{
    height:660px;
    width:500px;
    float:left;      
}
    #logocontainer{
       position: absolute;
       top: 20%;
       margin-top: -35px;/* half of #content height*/
       left: 0;
       width: 100%;
    }
    .help1 {  
       margin:0;
       height: 660px;
       width: 900px;
       background-color: #b0c4de;
    }

Upon attempting to center the contents of the div within 'slide1', I encountered a challenge with positioning. Adjusting the CSS from:

.help1 {  
           margin:0;
           height: 660px;
           width: 900px;
           background-color: #b0c4de;
        }

To:

.help1 {  
           margin-left:auto;
           margin-right: auto;
           height: 660px;
           width: 900px;
           background-color: #b0c4de;
        }

Resulted in the div being centered between slides instead of the desired center within 'slide1'. Is there a possibility to achieve the desired centering on individual slides while maintaining the vertical slide functionality?

Answer №1

To create a sliding effect, apply a relative position:

.fp-slide{
    position:relative;
}

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

Extracting the name from a JSON key/value pair and then adding it to a TextField

Here is a sample JSON data: { "Id": 1, "Title": "Information on Jane Smith", "Comments": "Additional details here", "UpdatedBy": "Jane Smith", "UpdateDate": "May ...

ReactJS Error: Cannot find reference to 'require'

I'm currently implementing the DRY concept in React JS by attempting to reuse the same HTML partial across different files. Here is the partial: var AdminMenu = React.createClass({ getInitialState: function() { return {}; }, render: function() ...

System for Node.js execution replay logging

Running a straightforward script that performs various tasks can be tedious when trying to debug errors. The log messages scattered throughout the code clutter the file, requiring more and more console.log entries for detailed information. Instead of fill ...

When using the setTimeout function to update the state, React useContext appears to be ineffective

As a newcomer to React, I have a question about refreshing the score in my card game within a forEach loop using setTimeout. While the state appears to update correctly, the DOM (Component overarching) does not reflect these changes. export function Refill ...

Error in TypeScript while running the command "tsd install jquery" - the identifier "document" could not be found

Currently, I am facing an issue with importing jQuery into my TypeScript project. In order to achieve this, I executed the command tsd install jquery --save, which generated a jquery.d.ts file and added /// <reference path="jquery/jquery.d.ts" /> to ...

What do I need to verify? An uncaught TypeError has occurred in the promise, indicating that the property 'MyFunctionName' cannot be read from an undefined URL

The issue arises solely in the compiled application, leading me to believe it's a browser-specific problem. However, I'm uncertain: I've inserted the following script into a webpage: async function exportChatAsXMLHelper(params){ let dis ...

Can a single shield protect every part of an Angular application?

I have configured my application in a way where most components are protected, but the main page "/" is still accessible to users. I am looking for a solution that would automatically redirect unauthenticated users to "/login" without having to make every ...

The Facebook JS SDK is causing an XSS error and returning a "user_denied" response, even though the Auth Popup for FB.Login is not being

I currently have a Facebook canvas app located at Previously, I was using an anchor link to direct users to the OAUTH login flow. After implementing the Facebook JavaScript SDK, I followed this logic: 1) Initialization of the FB API FB.init({ a ...

Dynamically fetching data with Node.js using Ajax requests

Despite my efforts to scour Google and Stack Overflow, I have been unable to find a reliable method for posting data to my Node.js server. I've noticed conflicting information on various methods, likely due to changes over time. One particular code ...

Unable to access the newly created object's properties following the instantiation of a new resource in AngularJS

Currently, I am in the process of developing a new Resource utilizing AngularJS that falls under the category of Person. After successfully creating this resource, my goal is to retrieve the id associated with the new resource from the server. it('sh ...

What is the best way to retrieve the value from a callback function in the outer scope?

I'm facing an issue with accessing values from a callback function in the parent scope. Essentially, I need to retrieve and use data fetched by the s3.getObject() function in the outer scope (last line). Below is my JavaScript code used for fetching ...

Tips for accessing a variable through request.query

When I made a call to getContents() in my client-side code: $.getJSon("/getContents", function(room){ theRoom=$("#roomName").val();//textarea's value ... }); I am now trying to figure out how to retrieve theRoom variable in getContents(), which is ...

Using Semantic-UI causes issues with the functionality of the height property set to 100%

View my CodePen here <head> <meta charset="utf-8"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.css"> </head> <body> <div class="ui secondary pointing menu" id=" ...

Two elements occupy the rest of the vertical space

In the center, there is a div with content inside. I want the top and bottom divs to occupy the remaining space. Similar to this example <div class="container"> <div class="top"> </div> <div class="middle"> C ...

How can I modify the content within a scoped `<style>` tag in Vue?

Is there a way to dynamically change the contents of a <style> block in my Vue component using Vue variables? Many commonly suggested solutions involve inline styles or accessing the .style property with JavaScript. However, I am looking for a metho ...

Setting default property values in a React component using Typescript

   Is there a way to define default property values in React components when using Typescript? I came across a post on SE suggesting the use of a static class variable called defaultProps with key-value pairs for properties. However, this method didn&a ...

Ways to delete an attribute from a DOM element with Javascript

My goal is to use JavaScript to remove an attribute from a DOM node: <div id="foo">Hi there</div> First, I add an attribute: document.getElementById("foo").attributes['contoso'] = "Hello, world!"; Then I attempt to remove it: doc ...

The focus functionality in Angular seems to be malfunctioning

Having trouble with simple focus in Angular <div class="search pull-right tab-{{ showDetails2 }}" data-ng-click="showDetails2 = !showDetails2; showDetails = false; showDetails1 = false;searchFocus();"> html <input type="text" data-ng-model="mod ...

Is there a method for removing the Microsoft Translator widget while still keeping the translation feature intact?

I am currently utilizing the Microsoft Translation Widget to automatically translate a webpage without requiring any user interaction. Unfortunately, I have been facing an issue where I am unable to remove or hide the widget that keeps popping up on the p ...

Issue with Angular Bootstrap Modal autofocus functionality malfunctioning

I successfully integrated a bootstrap modal using angular bootstrap into my project. If you want to check out the code I used, here is the plunker link. Inside the modal, there is only one input field (textbox) that the user needs to fill, along with sav ...