The text background failed to display partially upon inserting new "a" and "span" elements within the same div

I'm facing a minor issue or glitch. Can anyone explain why the "Log Out" button in imgA is changing to imgB? This problem arises when I add new lines that are marked as "// New!!" in the provided HTML code. The issue seems to be affecting the "right" div section. Below, you'll find the complete header code along with CSS for the left and mid div elements.

CSS styles for left and mid div:

.header {
    background: #FFF;
    display: flex;
    flex: 0 1 50px;
    flex-flow: row;
    line-height: 50px;
}
.header > #left {
    background: transparent;
    color: #535659;
    cursor: pointer;
    flex: 0 1 auto;
    font-size: 30px;
    padding: 0 10px 0 70px;
}
.header > #left:after,
.header > #left:before {
    background: rgba(0, 173, 181, 0.6);
    border-bottom-right-radius: 50%;
    border-top-right-radius: 50%;
    content: "";
    left: 10px;
    height: 30px;
    position: absolute;
    top: 10px;
    width: 30px;
}
.header > #left:before {
    background: rgba(250, 85, 85, 0.8);
    border-bottom-left-radius: 50%;
    border-bottom-right-radius: 0%;
    border-top-left-radius: 50%;
    border-top-right-radius: 0%;
    left: 30px;
}
.header > #mid {
    background-color: teal;
    flex: 1 1 auto;
}

CSS styles for right div:

.header > #right {
    background: transparent;
    flex: 0 1 auto;
    font-size: 20px;
    padding: 0 10px;
    text-decoration: none;
}
.header > #right > .logout {
    background: #FA5555;
    border: 2px solid #FA5555;
    border-radius: 30px;
    color: #FFF;
    cursor: pointer;
    padding: 3px 10px 3px 10px;
    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
 }
.header > #right > .option {
    background: #FFF;
    color: #000;
    cursor: pointer;
}

HTML code (imgA without any "// New!!", imgB after adding ""// New!!". Note: "// New!!" is used for highlighting purposes only and doesn't exist in the actual HTML files.)

<div class="header">
    <div id="left"><b>SPAP</b>r</div>
    <div id="mid"></div>
    <div id="right">
        <a class="option" onclick=""><span>Register</span></a> // New!!
        <a class="option" onclick=""><span>Settings</span></a> // New!!
        <a class="logout" onclick=""><span>Log Out</span></a>
    </div>
</div>

Thank you for your assistance.

Answer №1

Greetings to all visitors,
In JavaScript, a double slash "//" is utilized for commenting out code. However, in HTML, you would need to use "<!-- -->" to comment something out. So, simply change

// New!!

to

<!-- New!! -->

We hope that this explanation is helpful.

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

scraping text content from a CSS node using Scrapy

My goal is to extract a catalog ID number from the following webpage: from scraping.selector import Selector from scraping.http import HtmlResponse url = 'http://www.enciclovida.mx/busquedas/resultados?utf8=%E2%9C%93&busqueda=basica&id=& ...

Scrolling automatically

I'm experimenting with creating a typing effect using JavaScript and the typed.js library, found here: My approach involves using a div as a container. However, I've encountered an issue - when the text reaches the height of the div, scroll bars ...

PHP code for retrieving all combobox values from a form during submission

When I submit the form, I am only able to retrieve the value of the last combo box. Is there a way to capture all the combo boxes' values? Also, I need to know how to access the value of a label. Below is the code snippet used to generate the list of ...

Trouble arises when dealing with components beyond just the background while using jquery_interactive_bg.js

After experimenting with different plugins, I managed to achieve a parallax effect on my website's landing page by using the interactive_bg.js plugin. Following the steps outlined in a demo tutorial, I was able to attain the desired visual effect. Be ...

``Fixing the focus background color for mobile devices and iPads using React and Material io: A Step-by-Step

My custom button has a background and a :hover color. It works fine on the web, but on mobile devices, the color of the :hover persists even after clicking the button when the mouse is not over it. I am looking for a solution to fix this issue because the ...

Exploring Angular 4: A deep dive into routing and ensuring responsiveness

I set up an ubuntu server on AWS and most things are running smoothly, but there are a couple of issues that have me stumped. When visiting my web app, you can only interact with the buttons in the menu. Trying to access a link like 'mypage/items&ap ...

Ensure the div remains floating to the left even when the browser window is resized

I'm currently working on creating a timeline, but I'm struggling to keep the div aligned horizontally. Within a div container with overflow set to hidden, I have divs floating to the left. Inside these divs are ul elements with fixed widths. My ...

A problem arises in Next.js when CSS is not rendering properly during Server Side Rendering

After creating my next.js application using the command npx create-next-app, I realized that the styles from the imported .css files are rendering correctly on Client Side Render but not on Server Side Render. The Next.js documentation states that importe ...

How to use jQuery Animate to create a step-by-step animation with image sprites?

I'm working on creating an image sprite using jQuery and I'm curious if it's feasible to animate it in steps rather than a linear motion. I initially tried using CSS3 animations, but since IE9 is a requirement, the animations didn't wor ...

Change the size of the image to use as a background

I have an image that is 2000x2000 pixels in size. I originally believed that more pixels equated to better quality with less loss. Now, I am looking to display it on my browser at a resolution of 500x500. To achieve this, I attempted to set the image as t ...

Providing dynamic HTML content instantly on the same webpage

My goal is to switch between different snippets on the same site without changing the location. I want to achieve this using a select element with only HTML and JavaScript, if possible. The idea is to avoid loading multiple lengthy documents by selecting w ...

Add a Variety of Data Entries to a Table

I am currently attempting to add multiple pieces of data (from a date form) into a table using Jquery and MomentJS. However, the output does not appear as desired. Below is my code: $(".btnNext").on('click', function(e) { var Day = 1; ...

Attempting to toggle the visibility of div elements based on radio button selections

I'm currently working on a script that will dynamically show and hide different div elements based on the radio button selection made by users. The jQuery library is loading correctly, as I have tested it with an alert message upon page load. Si ...

Creating a function to update data in a Node.js/MongoDB environment

Hey there! I'm new to working with nodejs and mongodb, and I'm trying to create a function that updates the win, lose, and draw record in my UserSchema. Here's my Schema: UserSchema = new mongoose.Schema({ username:'string', ...

Ways to verify the presence of an element in a list

I found this interesting JS code snippet: ;(function ($) { $('.filter-opts .opt').click(function(){ var selectedName = $(this).html(); $('.append').append('<li>' + selectedName + '</li> ...

Is it acceptable to insert all of the meta tags into a div element inside the header section?

At the moment, I house all of the meta tags within a div element inside the Header. I created an AMD module to retrieve these meta tags by accessing the div. <div id="serverInfo"> <meta id="environment" name="environment" content="DEV" /&g ...

Aligning the content in the center of a div with inline display

Hi there, I have a quick question for the experts out there. I'm new to all of this so please bear with me :) I'm attempting to center an inline social sharing div on my website, but it's proving to be quite challenging. The div is nested w ...

What is the process for obtaining X through the use of createElement('img')?

Is there a way to retrieve the X position from the left of the tag created using document.createElement('img'); var block00 = document.createElement("img"); block00.src = "images/sep1.png"; If so, how can it be done: if (block00.getBoundingCli ...

Retrieving values from a database using Bootstrap multiselect search option

I am currently utilizing bootstrap-multiselect in my project. I am attempting to retrieve database values through an ajax request in the search feature, but unfortunately, the values are not being appended. Here is my code: $('#example-getting-sta ...

Place anchor tags in the middle of a navigation bar div

Having some trouble aligning the items in my navigation bar. I plan to include some svg icons in the nav bar later on, but for now, I can't seem to get the alignment right. Any ideas? It's probably a simple fix, but I've tried various metho ...