The layout is disrupted due to an input field with a label in Semantic UI

My goal is to create an input field with a right-aligned label in Semantic UI. The documentation provides an example of a cornered label that functions correctly, but when attempting to use a regular label, the layout of the input field gets disrupted.

To illustrate my issue, I have created a fiddle (http://jsfiddle.net/26fqd39d/).

The code below, extracted from the documentation, demonstrates a successful implementation with a label positioned on the right side within the input field:

<div class="ui labeled input">
    <input type="text" value="#"></input>
    <div class="ui corner label"><i class="copy icon"></i></div>
</div>

In my scenario, using a cornered label doesn't suffice as I would like to incorporate units like km and mi into the label, which require more space.

When switching to a regular label, as shown below, the label moves to a new line disrupting the layout:

<div class="ui labeled input">
    <input type="text" value="#"></input>
    <div class="ui label"><i class="copy icon"></i></div>
</div>

As evident in the fiddle, the label breaks onto a separate line. I seek guidance on how to construct an input field with a right-aligned label using Semantic UI. Understanding the reason behind this issue will greatly aid me in creating layouts with Semantic UI.

Thank you.

Answer №1

After some experimentation, I discovered a workaround using aligned icons instead of labels. Hopefully this solution proves useful.

<div class="ui left icon input">
    <input type="text" placeholder="Paste paste paste">
    <div class="icon"><i class="paste icon"></i></div>
</div>

http://jsfiddle.net/98765abc/8/

Answer №2

Although I may not be an expert in Semantic, you can maintain your corner class and modify the right borders as shown below:

.ui.action.input > .button {
    border-top-right-radius: 0px !important;
    border-bottom-right-radius: 0px !important;
}

Make sure to use !important to ensure it overrides the existing style, and be specific with your class selector to target only the desired buttons. Alternatively, you can utilize a style attribute.

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 process of integrating SCSS into an Angular2 Seed Project?

Is there a recommended method for incorporating SCSS into an Angular2 Seed Project? Are there any informative tutorials or reference sites available? I attempted to implement SCSS following instructions from this link https://github.com/AngularClass/angu ...

Tips for validating multiple forms on a single page without altering the JavaScript validation structure

My JSP page currently consists of two forms: <body> <form id="1"></form> <form id="2"></form> </body> Only one form is visible at a time when the page is viewed. A JavaScript validation file is used to check the ...

What is the best approach to streamline this Jquery solution?

In my current jQuery setup, I have the following: $("button").click(function() { var counter = 1 $("tr td:nth-child(2)").text(counter); click ++; }); Instead of using; $"(tr td:nth-child(2)").text(counter); I am looking to implement .slice() to ...

The postback feature is not compatible with the Dynamic HTML 5 menu

Using code behind on the pageload of a master page, I am able to generate an HTML 5 menu using ul tags. Everything works fine until there is a postback, at which point the dynamic contents of the menu disappear. Can someone please advise on how to re-rende ...

Tips on utilizing innerHTML or innerText to add content to the Evernote editor, a rich text editor

A method authored by Jayant was employed in this particular post how-to-insert-text-into-the-textarea-at-the-current-cursor-position to perform an insertion into the Evernote editor. The Evernote editor being a rich text editor, altering from el.value to ...

Using AJAX in HTML to retrieve data from PHP

I am facing an issue with my HTML code: <body> <div class="po-logo"> <img src="img/logos/lw.png" alt="logo watchbees"/> </div> <form> <div class="mui-textfield mui-textfield--float-label reg-window"> <input id="u ...

`Changing drop-down menu to display the previously selected item upon page refresh in a Django application`

Is there a way to retain the selected filter in a Django/Python application when a page refreshes after using an HTML drop-down form? Here is the current form I am using: <form name="portfolio_filter" action="" method="get"> <select class="o ...

Differentiating between the simple and luxurious text editing features available in the TinyMce editor

I am currently utilizing the TinyMCE editor to enhance the appearance of a textarea field where users can input comments. My goal is to offer two options for users: one for plain text and the other for a rich text editing experience. When a user selects th ...

Removing lines of text from the output of a JavaScript retrieval

Currently, I have a working script that retrieves a complete address block to be inserted into a selected field. However, I am now attempting to remove unnecessary parts of the generated text block for better display. This is the code snippet: <script ...

In Angular/Typescript, dynamically add a class to a `td` element when it is clicked. Toggle the class on and off

My problem arises when trying to individually control the arrow icons for each column in my COVID-19 data table. By using Angular methods, I aim to show ascending and descending arrows upon sorting but run into the challenge of changing arrows across all c ...

Utilizing Bootstrap framework to create a user-friendly navigation bar with dropdown functionality for a seamlessly organized and visually appealing full

Looking to utilize bootstrap for creating a top navigation layout and encountering an issue with the default left alignment. How can I make it span the full width at the top? Current https://jsfiddle.net/v2notb5n/ <nav class="navbar"> < ...

Creating a floating border effect.Would you like to know how

Currently working on a new component, I'm looking to create a unique border for certain cards. However, I'm struggling to find the perfect solution. Check out the specific border style needed in the image provided below. https://i.sstatic.net/4vA ...

Singling out a particular navigation tab

When attempting to link specific table IDs so that the corresponding tab is active when opened (i.e. www.gohome.com/html#profile), I am facing an issue where the active tab remains unchanged. Even after specifically calling out tab IDs, there seems to be n ...

How to eliminate .php and .html extensions from your URLs using htaccess

I'm facing an issue where Google has indexed some pages using the wrong URLs. The URL they have indexed is: http://www.example.com/user/emp.php while I want it to redirect to: http://www.example.com/user/emp Here is my .htaccess file with the nec ...

What is the best way to conceal menus on Big Cartel?

Is there a way to hide menu items on a custom theme without having to create a new one? I'm looking for a solution like adding something to the stylesheet. Any suggestions would be appreciated! <div id="store" class="clearfix"> <div id=" ...

Choose a specific option from the dropdown menu using a URL parameter

After reviewing this code snippet: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> // <![CDATA[ $(document).ready(function() { // Parse your query parameters here, and assi ...

Center the font in the middle of the text field

I'm having a text field with a jQuery hint. How do I align the font to be in the middle? I've attempted using vertical-align: middle but it doesn't seem to work. <style type="text/css"> #name { border: 1px solid #c810ca; heig ...

Looking for a way to add a permanent footer to the bottom of your webpage without affecting the tab order for accessibility?

I have a paginated form with a fixed navigation footer at the bottom that needs to stay in place even when scrolling. This footer should also be at the bottom of the page for mobile devices and tablets. To achieve this, I used position: fixed on the foote ...

Single Page Site - navigation to distinct sections with 'placeholder' pages

As part of a school project, I have been tasked with designing a website. My goal is to create a single-page website, but we are required to link to different pages like contact.html. I also want the page to smoothly scroll to the navigation section when a ...

"HTML Parsing with Simple DOM: Dealing with Class Names Containing Spaces

I am currently utilizing PHP Simple HTML DOM to extract elements from the source code of a website (which is not my own). However, when attempting to locate a ul class named "board List", it is not being found. It seems like there may be an issue with spac ...