Adjust Baseline with Semantic UI Toggle

I am trying to center align my toggle next to other form elements such as input boxes. Here is the snippet of HTML code:

.ui.toggle.checkbox {
  display: inline-flex;
  align-items: baseline;
  vertical-align: middle;
}

.ui.toggle.checkbox label {
  margin-left: 0.5em;
}
<div class="ui toggle checkbox">
  <input type="checkbox" name="power-off" id="power-off">
  <label>Power Off</label>
</div>

Any suggestions on how to achieve this? It doesn't seem to be working :-(

https://i.sstatic.net/DVkrq.png

Answer №1

To achieve the desired effect, adjust the width of the div to 100% and interchange vertical-align with justify-content in this way:

 .elements{
  display:flex;
  justify-content: center;
}

.ui.toggle.checkbox >label  {
  margin-left: 0.5em; 
}
<div class="elements">
  <div class="ui toggle checkbox">
        <input type="checkbox" name="stromlos" id="stromlos">       
        <label for="stromlos">Stromlos</label>
  </div>
</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

Starting the Android System Magnifier with a Click: A Step-by-Step Guide

Is there a way to incorporate a magnifying glass into an HTML page using jQuery or within an Android app? Ideally, it would be for a single picture. In my application, I am displaying an HTML file from my assets in a webview. The HTML page utilizes jQuery ...

Ensure that the dimensions of a div remain consistent across all screen resolutions, specifically for desktops and not mobile devices

Currently I am in the process of creating a highly secure and encrypted social network, but I have hit a stumbling block. I hadn't considered how my website would display on other desktops and laptops (not mobile devices). The issue is that I set all ...

Create a "read more" and "read less" link without using jQuery

For a college assignment, I need to dynamically insert new paragraphs when the "more" link is clicked and remove them when the "less" link is clicked. We are not allowed to use CSS or jQuery for this task. My current code for this functionality is below. T ...

Creating a layout where elements are evenly sized using Flexbox, regardless of their

How to ensure uniform size for all grid cells? Check out the issue on JSBIN | See the code on JSBIN I'm utilizing flexbox to construct a grid layout. Some cells in the grid have content while others are empty, causing inconsistencies in cell sizes. ...

Using jQuery to access the ID of a div and create a custom close button

I am trying to implement a close button for my popup DIVs. Each one has a unique ID and I want to hide them by setting the CSS 'display' property to 'none' when closed. However, the following example is not functioning as expected. I a ...

Switching the root directory for the Next.js application caused a meltdown on the production server, while the development server and local build remained unaffected

TL;DR I modified my base path from "/" to "custom-subpath" and encountered CSS missing on the production server despite it working well on my local server. Please forgive me, as explaining this issue may be challenging due to my limite ...

How to style the 'FILE' input type in HTML

What is the best way to style a file upload button with an image to ensure it looks neat and tidy across all browsers without any overlapping text from the default control? Appreciate your help! ...

Tips for positioning text above a dashed line in the blade template using Laravel and Bootstrap 4

I am working on a small Laravel project where I need to pass the variable {{$docno}} to a blade template. Below is the code snippet in the blade file. <body> <div class="container-fluid"> <div class="text-center"> ...

Trouble with displaying inline images using <div> tag

I am trying to display 9 images in a WordPress footer side by side horizontally. Here is the HTML code I used: <div id="sponsers"> <ul> <li><img src="http://mysite.com/image1.png" width=257 height=67></li> <li><img s ...

The 3D Circle Flip feature on a certain webpage designed by Nordstrom is experiencing issues when viewed on Firefox

Click here to see a 3D Circle Flip effect. It works correctly in Chrome, but in Firefox the text does not change when flipping. ...

Setting up the page header in Next.js

I integrated some themekit CSS into the head of my Next.js project, but I'm getting a warning in the browser console. What could be causing this issue? Expected server HTML to contain a matching <head> within a <div>. const Layout = ({ ch ...

Dynamic addition of CSS classes to HTML elements using PHP

I'm working on developing an application that includes multiple courses. Each course is completed over a certain number of days, such as 14 days or 20 days. To visually track progress, I've implemented a step progress bar that looks like this:htt ...

Using JQuery to dynamically swap out the Bootstrap progress bar

I created a progress bar using bootstrap with a default value of 33% and a switch that toggles between all active or inactive. When the switch is activated, I want the progress bar to show a value of 100%, and when it's inactive, a value of 0%. Howev ...

Position of background image

Attempting to incorporate an image within a textbox in the following format (## representing the image): --------------------- | ## | --------------------- My progress so far: input.loading { background: url(/images/loader.gif) no ...

When the datepicker is clicked, ensure that the input remains active

I'm facing an issue where the label in a Bootstrap datepicker goes back to the bottom after clicking on the input and selecting a date. However, it stays up after the second click. I am unsure how to fix this problem, so any help or suggestions would ...

Setting HTML in the title for the list view in fullcalendar.js version 4

Received the following information from a source, but was unable to leave a comment due to insufficient points. Looking for assistance on setting HTML in title using fullcalendar.js v4 eventRender: function(info) { info.el.querySelector('.fc-titl ...

Alternative to using table-row for generating table breakpoints in CSS, consider using a

Currently, my table layout looks like this: <div style="display:table"> <div style="display:table-row"> <div style="display:table-cell">Content 1</div> <div style="display:table-cell&q ...

The issue is that only the first checkbox within ngFor is being toggled on and off each time a different checkbox is clicked

When I have checkboxes inside a ngFor loop and click on any one of them, only the first one gets checked and unchecked, updating only the status of the first checkbox. Here is the HTML template: <div *ngFor="let num of count" class="m-b-20"> & ...

Changing the placement of navbar components in Bootstrap 4 based on screen size

Through the use of Bootstrap 4, I have successfully created a navbar that collapses into a button when the screen size decreases. However, I am facing an issue where one item (the icon image) gets centered while the rest of the items are aligned to the lef ...

Simple HTML/CSS text blocks positioned beside images in a list format

I'm attempting to design a list (ul) where each li has an img on the left and text aligned to the left (including a title and paragraphs) positioned next to the image on the right. I've experimented with float: left and various display propertie ...