Troubleshooting CSS/HTML - Element Alignment Issue

I used to have an object that was perfectly centered with a fading opaque box around it. But now, the text is in the corner and the box has disappeared. Despite everything appearing fine with the CSS positioning, I can't seem to figure out why this is happening. Any help on why my item is no longer centered with a box would be greatly appreciated. You can view an example here (scroll down to the last slide, the contact me page)

You can find the CSS for the box and the text below.

Text CSS:

#slide4 .contact{
     color: red;
     position: relative;
     font-size:70px;
     top: 30px;
     left: 36%;
}
#slide4 .contact1{
     color: rgba(51,51,51,.3);
     position: relative;
     font-size: 40px;
     top: 100px;
     left: 8%;
}
#slide4 .contact2{

    position: absolute;
    font-size: 40px;
    top: 140px;
    right: 21%;
        color: rgba(51,51,51,.3);
}
#slide4 .box{
        position:relative;
    width: 400px;
        height: 200x;
    padding-right: 25px;
    padding-left: 25px;
    padding-top: 25px;
    padding-bottom: 25px;
        background: rgba(255,255,255,.9);
    top: 100px;
    left: 32%;
    opacity: 0;
    filter:alpha(opacity=0);
}

Box CSS:

    <div class="box">
    <span class="contact1">This is a test</span>
    <span class="contact2">This is a test</span></div>
    </div>

To summarize, why is my box no longer centered with properly styled text?

Answer №1

While using the Inspect Element feature in Chrome, I am unable to locate the CSS properties associated with slide4. Please make the following updates to your CSS file style.css as recommended below:

/******************************
 SLIDE 3 
*******************************/
#slide3{
    background-color:#b6c10b;
}
#slide3 .text{
    position: relative;
    top: 35px;
    left: 505px;
    font-size: 35px;
    color: rgba(51,51,51,0.3);opacity: .3;}    ~~> remove } as its extra

} 

a:link {color:#333333;
opacity: .3;}    
a:visited {color:#333333;    ~~> add } as its missing
a:hover {color:#333333;
opacity: .3;} 
a:active {color:#333333;
opacity: .3;}

Answer №2

After implementing your code, I made a slight adjustment by removing the last two sentences regarding opacity in the .box{} portion. Surprisingly, it did the trick.

If that doesn't work, simply set the opacity of the box to 1.

I trust this solution will be beneficial.

Thanks!

Answer №3

There are a few mistakes in the code you posted:

  • The height for the box is missing 'px'.
  • The opacity settings are causing the box to not appear.
  • An additional div tag is present in the markup.
  • The slide element is not included in the markup.

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

"Exquisite Broth - What is the best way to extract images with a particular src attribute using web scraping

Recently, I embarked on a journey to learn webscraping and decided to take on the challenge of scraping Mangadex as my latest project. Any advice you can offer would be highly appreciated! My goal is to extract images by capturing the src attribute of an ...

Creating duplicates of a div element with each click

I am looking for a way to create a button (ADD) that, when clicked, generates a form with a field and a delete button. The form fields and the delete button should be erased when the button is clicked. <button type="button" class="btn btn ...

I need to use HTML formatting to ensure that my form appears professional and visually pleasing

Currently, I am working on enhancing the appearance of an HTML form. However, I seem to be struggling with the formatting, and I also aim to ensure that the form is responsive. My goal is to have the first name and last name fields on one line, followed by ...

Guide on using PHP to assign the value of an array to an input field

Here is an array I have: $texts = [ "maybank2u.com", "Open BillPayment", "Status: Successful", "Reference number 2950211545", "Transaction date: 01 Feb 2016 13:09:17", "Amount: RM100.00", ...

Automatically generated webpage smoothly scrolling downward

Within my application, I have been developing dynamic pages with a CSS property of overflow-y:auto applied to the page container. Everything seems to be working fine, The issue arises when the page loads and the height exceeds that of the container. While ...

The elements of the second flex item should also be arranged in a line next to each other

<script src="https://use.fontawesome.com/2a2c577e07.js"></script> <div class="parent-flex"> <div class="class1">Class 1</div> <div class="class2"> <img src="http://farm4.static.flickr.com/3140/3506456511_43787 ...

comparing multiple values separated by commas with JavaScript

I need validation using a comma-separated value format. Within the illustration, there are two fields: "Saloon Price" (value: 10,10,10,10) and "Saloon Offer Price" (value: 11,11,11,11). The first value must be less than the second. Saloon price Value & ...

How to Pick HTML Dropdown Options with VBA

Find Dropdown List Code Image Here Looking for a solution to automate selecting a dropdown option from the list shown in the provided image. I've attempted to implement the following code, where NGR is assigned as a string with values from the list. ...

How to create a dynamic background color animation in jQuery similar to a progress bar animation

I have a container with text content (for example: My Name) and it is displayed in a RED background color along with a button. What I am looking for : When the button is clicked, I want to change the background color of the container from RED to BLUE, si ...

Scrolling problems with numerous bootstrap modals on a Webpage

I am faced with an issue on a page where I have set the property overflow: auto. This page features a hyperlink to open the first modal, and within the first modal, there is a link to the second modal. My steps are as follows: Open Page 1 Click on the l ...

The ng-include directive in Angular seems to be malfunctioning when trying to include the intended link

Imagine having a hyperlink <a href="#one">Click here</a> and an article: <article id="one"><h2>This is the destination</h2></article> When the hyperlink is clicked, it should take you to the article. However, when mo ...

"Shuffle the Order of Divs Each Time the Page Loads

I have multiple divs labeled as "gallerycard". I want them to appear in a different random order each time the page is loaded. <div id="gallerycard"> <div id="name">Akulina</div> <div id="info">N/A</div> </div> ...

What steps should be followed to direct the user to a different webpage after changing the index page name?

I'm in the process of creating a new website. The previous name of my website was home.html but I recently changed it to index.php. However, when I try to access the website, it keeps redirecting me to home.html instead of index.php. Can anyone offer ...

How can I utilize PHP to generate several tables within a single database?

I need some guidance on creating multiple tables within the "new" database. I'm curious if it's possible to include PHP code inside the query to generate table names dynamically. Any help would be greatly appreciated. Thank you in advance. <? ...

Prevent anchor tags from modifying the current URL

In the realm of React, I am endeavoring to incorporate an anchor tag that directs users to an external website "https://www.google.com/". Within my code, there exist two instances of this very anchor tag. The initial tag functions as intended, effortless ...

Prevent background element from being selected with a double-click

Whenever I double-click on the background, the first element gets selected. How can I prevent this from happening? Here is a fiddle to demonstrate: https://jsfiddle.net/cb6fjr7n/1/ <input style="text" value="lala"/> If you double-click outside of ...

What steps should I take to implement two-way binding for a contenteditable element using ng-bind-html in AngularJS?

I'm still learning Angularjs and came across the code snippet below in the documentation. I am curious how I can modify this to utilize ng-bind-html instead of ng-model. Will there be a conflict if I use both ng-bind-html and ng-model simultaneously? ...

There are no visible CSS styles detected in the email

Why do the CSS styles not appear when viewing this HTML page in an email client like Yahoo or Gmail using mutt? The table appears plain without any styling, but it displays correctly in a web browser. Is there something I am overlooking? mutt -e "set cont ...

Guide on displaying only one v-menu when clicking to reveal the menu

I have implemented the v-for loop on v-menu and I am attempting to trigger the v-menu to open using only the button. My goal is to open one menu at a time when the button is clicked. Currently, all buttons are being displayed simultaneously because the v- ...

Create an input field with a dynamic and exclusive identifier using the DataTables plugin

I am having trouble creating unique IDs for each input field based on the number of rows Here is the code snippet: $(document).ready(function() { var oTable = $('#jsontable').dataTable(); //Initialize the datatable $.ajax({ url ...