The subscribe text seems to be displaying outside of the button. Do you have any suggestions on why this is happening and what steps I

I'm having trouble getting the word "Subscribe" to appear correctly inside the button. No matter what I try, it ends up stuck on the right of the button, completely outside of it. I even tried isolating it in a standalone HTML file and the issue persists. Any assistance with fixing this would be greatly appreciated.

Here is the code:

<div class="container">
            <form action="">
            <h1>Join Our Newsletter</h1>
                <p>For daily updates about our Church and Mass readings. Please join our Newsletter</p>
                <div class="email-box">
                    <i class="fas fa-envelope"></i>
                    <input class="tbox" type="email" name="" value="" placeholder="Enter your email">
                    <input class="btn" type="button">Subscribe</button>
                </div>
            </form>
        </div>

Here is the CSS:

 *{
margin: 0;
padding: 0;
font-family: 'Libre Baskerville', serif;
 }

.container{
    padding: 10px;
}

.container p{
    max-width: 600px;
    margin: 40px auto;
    color: white;
}

.email-box{
    height: 40px;
    display: flex;
    justify-content: center;
}

.email-box i{
    background: rgba(250, 247, 177, 0.6);;
    width: 40px;
    line-height: 40px;
}

.tbox,.btn{
    border: none;
    outline: none;
}

.tbox{
    width: 0px;
    transition: 0.5s;
}

.email-box:hover > .tbox,.tbox:focus{
    width: 260px;
    padding: 0 10px;
}
.btn{
    background: rgba(250, 247, 177, 0.6);
    color: white;
    padding: 0 10px;
    text-transform: uppercase;
    cursor: pointer;
    width: 100px;
}

.button{
    width: 100px auto;
}    

https://i.sstatic.net/KUKb6.jpg

Answer №1

It appears that the tag below is not properly closed.

<input class="tbox" type="email" name="" value="" placeholder="Enter your email" />

In addition, the button is missing a proper closing tag:

<button class="btn" type="button">Subscribe</button>

Answer №2

It seems like your HTML code is not valid. The <input> element does not require a closing tag. There are two ways you can correct this issue:

  1. Add a value to the input and close the tag properly:

<input class="btn" type="button" value="Subscribe" />

  1. Alternatively, you can use the <button> tag element for your button:

<button class="btn" type="button">Subscribe</button>

Answer №3

Looks like there's a small issue with the button tag – it's missing an opening tag! 😄

 *{
margin: 0;
padding: 0;
font-family: 'Libre Baskerville', serif;
 }

.container{
    padding: 10px;
}

.container p{
    max-width: 600px;
    margin: 40px auto;
    color: white;
}

.email-box{
    height: 40px;
    display: flex;
    justify-content: center;
}

.email-box i{
    background: rgba(250, 247, 177, 0.6);;
    width: 40px;
    line-height: 40px;
}

.tbox,.btn{
    border: none;
    outline: none;
}

.tbox{
    width: 0px;
    transition: 0.5s;
}

.email-box:hover > .tbox,.tbox:focus{
    width: 260px;
    padding: 0 10px;
}
.btn{
    background: rgba(250, 247, 177, 0.6);
    color: black;
    padding: 0 10px;
    text-transform: uppercase;
    cursor: pointer;
    width: 100px;
}

.button{
    width: 100px auto;
}    
<div class="container">
            <form action="">
            <h1>Join Our Newsletter</h1>
                <p>For daily updates about our Church and Mass readings. Please join our Newsletter</p>
                <div class="email-box">
                    <i class="fas fa-envelope"></i>
                    <input class="tbox" type="email" name="" value="" placeholder="Enter your email">
                    <button class="btn" type="button">Button</button>
                </div>
            </form>
        </div>

Find the corrected answer below!

(I've also made the button text black for better visibility!)

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

Utilizing the content of an HTML element within Ruby embedded code - a comprehensive guide

Below is the code snippet in question: <% @groups.each do |group| %> <tr> <td id="groupid"><%= group.id %></td> <td><a href="#dialog" name="modal"><%= group.title %></a></td> </tr> &l ...

The downward trajectory of the Hamburger Menu is uncompromised, yet it refuses

Currently, I am utilizing Ruby on Rails 7 and Bootstrap 5. I encountered an issue with my hamburger menu functionality - it opens successfully but fails to close. Strangely, all other dropdowns work perfectly fine. Below is the snippet of the problematic c ...

What's the best way to use CSS to center an HTML element on a page?

My goal is to perfectly center an HTML element on a page, ensuring that the center of the element aligns with the center of the page. The current code I am using is as follows: #associate { position:absolute; color:white; background-color:red; ...

Not all records are compatible with PHP Echo when placed within a paragraph

Looking for some assistance with a simple form set up; <div class="formholder"> <form action="column1.php" method="post"> <input type="text" placeholder="URL:" name="url" required=""><br> <input type="t ...

Finding strikeout text within <s> or <del> tags can be identified by closely examining the HTML codes

The issue arises with the text that reads as follows: 316.6.1 Structures. Structures shall not be constructed This is represented in HTML as: <b> <s> <span style='font-size:10.0pt'>316.6.1 Structures</span> ...

Retrieve information from a MySQL database and integrate it into a different application

This php script is used to generate a table with a "book" button next to each row. The goal is to extract the values of "phase" and "site" from the specific row where the "book" button is clicked, and transfer them to another form (in "restricted.php") fo ...

converting blob to base64 in javascript

I need assistance with decoding a blob object to a base64 string using JavaScript. Here is the code I am working with: var reader = new FileReader(); reader.addEventListener("loadend", function () { // Accessing contents of blob as a typed array ...

Determine if two JavaScript strings are anagrams of one another by comparing their characters. What specific method or approach is utilized in this scenario?

Could someone please provide a breakdown of the JavaScript code logic used here? The following code is designed to check if two strings are anagrams of each other, but I'm having trouble understanding the approach taken to perform this check. Any he ...

Additional cushioning is added when utilizing the X-UA-Compatible meta tag

After experimenting with various meta tags in the <head> section of my static HTML page, I have found that using <meta http-equiv="X-UA-Compatible" content="IE=edge" /> allows me to access newer CSS elements such as table:last-of-type in IE9. ...

CSS unexpectedly transitions away

Check out this link for additional details As the cursor moves away from the element, it swiftly reverts back to its original form (I've demonstrated this in the video) .productinfo { display: flex; flex-direction: column; align-items: c ...

Overlap of Navigation and Logo Divs on Mobile Website

Trying to optimize my website for mobile at coveartschildcare.com, but the header divs keep overlapping and nothing I do seems to fix it. Here's the CSS code I'm currently using: @media only screen and (min-device-width: 320px) and (max-devi ...

Calculate the total of all values within a specific column on an HTML table

My table consists of TollFree, US, and Canadian data which refreshes every 5 minutes to display the latest information. TollFree US Canadian 7,312 826 ...

I am trying to center align this image, but for some reason, it's not cooperating

Attempting to center the image using margin-left: auto and margin-right: auto properties in the code snippet above has proven unsuccessful. The image is not aligning as desired. What could be causing this issue with the code? Are there any other techniq ...

"Troubleshooting: Difficulty with hover function in jqgrid not functioning on colored rows

My JQGrid setup includes the following: <table id="grid"></table> var data = [[48803, "DSK1", "", "02200220", "OPEN"], [48769, "APPR", "", "77733337", "ENTERED"]]; $("#grid").jqGrid({ datatype: "local", height: 250, colNa ...

What methods can be used to center a Google map on a specific location?

I am facing an issue with three map canvases on different divs. Despite setting the center to the same position in all three of them using JavaScript, the second and third maps do not seem to reflect that center. Does anyone have any insights on what cou ...

The function is not being called as expected when using `onclick` or `eventListener('click')`

I'm in the process of developing a login form for my website that will offer 2 options - "login" and "signup". The concept is similar to mini tabs and iframe windows. Essentially, I have two divs side by side for "login" and "signup". When the user cl ...

Building a Compact Dropdown Menu in Bootstrap

I am looking to implement a compact Bootstrap dropdown feature, but I am unsure of how to do it. Take a look at this image for reference. base.html: <a class="text-light" data-bs-toggle="dropdown" aria-expanded="false&qu ...

Modify the color of the dropdown menu that is currently in use

I am a beginner in using bootstrap and I'm struggling to customize the CSS to my preferences. One issue I encountered is with a dropdown menu in my header where I managed to change the colors successfully. However, when the dropdown menu is selected, ...

Consistent word spacing across several lines

Can someone help me with an issue I'm facing? It seems simple, but I can't seem to figure it out. I am looking for a way to maintain consistent spacing between words on multiple lines without using tables. Essentially, I want something like invi ...

Certain rows appear to be missing even though they are present in both the webpage and its corresponding source code

I am facing a CSS issue that I am unable to resolve. I have 20 results that should be displayed on my website, but only 14 of them are appearing. The other ones are visible in the source code when inspected. When I move the position of the menu up or down, ...