Symbols within input fields as well as within alert messages

Struggling to place a glyphicon inside input tags? Despite trying multiple codes from various sources, I still can't seem to make it work. Here's what I have:

<div class="form-group">
    <label for="cedula">Cedula:</label>
    <div class="inner-addon left-addon">
        <i class="glyphicon glyphicon-user"></i>
        <input type="text" class="form-control" id="cedula" name="cedula" placeholder="Numero De Cedula" required="true" autofocus="true" maxlength="9">
    </div>
</div>

Here is the CSS code I have been using:

/* positioning adjustments */
.inner-addon {
  position: relative;
}

/* styling for glyph */
.inner-addon .glyphicon {
  position: absolute;
  padding: 10px;
  pointer-events: none;
}

/* alignment of glyph */
.left-addon .glyphicon  { left:  0px;}
.right-addon .glyphicon { right: 0px;}

/* adding padding around input fields */
.left-addon input  { padding-left:  30px; }
.right-addon input { padding-right: 30px; }

However, I keep encountering this strange symbol outside the input field:

https://i.sstatic.net/5IYv5.jpg I am trying to follow Bootstrap documentation and place the glyphicon within an alert box:

if( $errors !== ""){
    echo '<div class="alert alert-danger">'; 
    echo '<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>';
    echo $errors; 
    echo '</div>';
}

Despite following the guidelines, a weird symbol continues to appear: https://i.sstatic.net/gIBxO.jpg

Answer №1

Simply utilize the following code snippet without any extra CSS required:

<div class="form-group has-feedback">
<label class="control-label" >Cedula:</label>          
    <input type="text" class="form-control" id="cedula" name="cedula" placeholder="Numero De Cedula" required="true" autofocus="true" maxlength="9">
    <i class="glyphicon glyphicon-user form-control-feedback"></i>
</div>

Answer №2

try using this:

<div class="input-group">
    <span class="input-group-addon" id="basic-addon1"><i class="glyphicon glyphicon-user" ></i></span>
    <input type="text" class="form-control" id="cedula" name="cedula" placeholder="Identification Number" required="true" autofocus="true" maxlength="9">
 </div>

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

What is the best way to align navigation arrows vertically?

I am working on a modal album that displays images of various sizes. My issue is with styling the navigation arrows to appear in the center of the page, regardless of the image size. I have included my code below: <div class="row img-box"> <d ...

Simple CSS and HTML trick for creating a seamless hide and hover effect

Every time I've attempted this task in the past, it has been straightforward. However, this time it's proving to be challenging. The goal is simple - have an image display a description when hovered over by a user. HTML: <div class="descript ...

Introduction to AngularJS search filtering

My webpage is currently very simple: <h4>{{event.name}}</h4> <p>{{event.desc}}</p> <p>At: {{event.venue.name}}</p> I am looking to enhance it by adding a search feature that can search through the name, description, ve ...

I am interested in utilizing Google Apps Script (GAS) to store images in GoogleDrive and automatically populate the corresponding URL in a

Currently, I am utilizing GoogleAppsScript to develop a form for submitting names and images. The idea is to store the submitted name and image in GoogleSpreadSheet while also storing the image in GoogleDrive along with its destination URL. The process inv ...

Attempting to ensure that my website is fully optimized for all devices and

I am currently facing an issue with my CSS code on iPad. I want to change the background-image displayed based on whether the user is using an iPad or not. Specifically, I want to use headerold.jpg as the background-image for iPads while keeping headernew. ...

Placing a larger container inside a smaller one and perfectly centering it

I am trying to find a solution to center a 1600px container within a 940px container on my webpage. The goal is to keep the page centered at all times, with the main content being 940px wide. When I add an image that is 1600px, it aligns left with the 940p ...

How can I dynamically insert a new HTML element into $event.target using Angular 2?

I have a webpage with a list of items. I want to display a "copy" button next to each item when the mouse hovers over it. I am currently able to create the "copy" button within the element using the following method: mouseOver(event) { if (event.tar ...

Learn how to dynamically incorporate multiple Bootstrap collapse elements in PHP

I've encountered an issue with my code that contains both HTML and PHP. The problem arises when there are multiple elements in a collapse, as only the first element works properly. This is due to the fact that each element has the same id named "colla ...

Preserve the information within

Recently, I encountered an issue with a file that generates HTML and adds it to a PHP string using a buffer. Here's the code snippet: <?php ob_start(); ?> <table> <tr> <td>Content</td> </tr> ...

Currently seeking assistance in replacing an existing Wordpress object with a new one

I'm looking to swap out the current slider image with a new slider. Whenever I try to replace it with the TOP 5 Games, they disappear or don't show up at all. <?php if( function_exists('cyclone_slider') ) cyclone_slider('24&ap ...

Is there a jQuery or Javascript alternative to CSS Counter?

Can a counter be implemented that changes the text of a tag directly using jQuery/Javascript? For example, if there were two tags like this: <a>hello</a> <a>bye</a> After executing the jQuery/JS function, the result would be: < ...

How do I check the value of a JavaScript variable in an XSL choose statement?

Currently, I am working with an xsl file in SharePoint and have implemented an xsl choose statement to conditionally display records from my xml. In the code snippet below, I am testing DAS_ID to determine if it is equal to *someValue*. While hardcoding a ...

Tips for choosing the nearest table rows with CSS

When it comes to CSS, specifying a style for the immediate child rows of a table can be done like this: table > tr { background: blue; } The challenge arises when we have a <tbody> tag surrounding the <tr> tags. Is there a way to addre ...

Leveraging Google maps to find nearby stores

I recently created a store locator but hit a roadblock when I discovered that Google Maps does not allow you to iframe the entire page. Is there a workaround for this issue to display the map? Or is there an alternative method that doesn't involve ifr ...

Is there a way to modify the default color when the header is assigned the "sticky" class?

Currently, I am in the process of building my own website and have implemented an exciting hover effect that randomly selects a color from an array and applies it when hovering over certain elements. However, once the cursor moves away, the color reverts b ...

Retrieve the location of video(s) embedded in raw HTML code

When loading a webpage into my WebView, I am able to retrieve the raw HTML as text. This particular page contains various video elements that are embedded within it, and I am looking to extract their locations as a list of strings in order to download them ...

Difficulty positioning CSS, aligning flex-box grid with floating text

My attempt to include an aside section is causing alignment issues with the navigation menu and the aside itself. The problem seems to be related to using float:left for the 200x200 images. I want the layout to be well-positioned like the expected image. I ...

Eliminate any trace of Bootstrap 4 design elements on the .card-header

I'm facing some difficulties in removing all the default styling of Bootstrap 4 from the .card component. It seems like this issue might not be directly related to Bootstrap since I am also experiencing it in Edge browser. Could someone please assist ...

The Angular routing feature seems to be malfunctioning as the URL is showing up but the page fails to load

After including angular.min.js and angular-route.min.js I encountered an issue where clicking the login button would change the URL to '/home', but the home.html page wouldn't load. I attempted adding a controller under templateUrl, but it ...

Centering an item using Bootstrap

I am using bootstrap in reactjs and attempting to center a text in the middle of the screen, but it seems to not be working. Can someone please point out what I am doing wrong? <div className="h-100 d-flex align-self-center justify-content-center&q ...