Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a row element which contains several inline-block elements. The problem is that I can't add padding or margin to any because the margin itself overflows. I'd like all elements to be perfectly aligned vertically.

Here's an image of the issue:
here[^]

HTML:
<div id='content'>
	<div class='row'>
		<span class='label'>Alerts</span>
		<div class='checkbox'>
			<div class='checkbox_inner'></div>
		</div>
		<span class='label checkbox_label'>Enable Email Alerts</span>
	</div>
</div>


CSS affecting these elements:
CSS
body
{
	color: white;
	margin: 0;
	font-family: "Lato", "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
	font-size: 11px;
	font-weight: 700;
}

#content
{
	width: 100%;
	height: calc(100% - 48px);
	background: linear-gradient(180deg, rgb(30,40,45), black);
	color: rgb(150,155,160);
	position: absolute;
}

.inline_textbox
{
	display: inline-block;
}

.row
{
	margin: 8px 0;
}

.row:after
{
	clear: both;
}

.label
{
	width: 200px;
	display: inline-block;
}

.checkbox
{
	display: inline-block;
	border-radius: 2px;
	border: 1px solid rgb(80,100,120);
	transition: border-color 0.3s;
	cursor: pointer;
}


What I have tried:

Mentioned in question
----------------------
Posted
Updated 17-Apr-18 11:35am
v3
Comments
Bryian Tan 17-Apr-18 16:45pm    
what in the checkbox_label class?
[no name] 17-Apr-18 16:46pm    
Just an additional class I'm going to use after I've solved this issue. There are no styles for it yet.
Bryian Tan 17-Apr-18 17:14pm    
where is the checkbox? there is a checkbox in the screenshot, but not in the HTML markup or CSS.
[no name] 17-Apr-18 17:14pm    
<div class='checkbox'>
custom element.

1 solution

Anyway, I'm not able to guess how the checkbox was being generated.

Here is an example. The example use input checkbox type and added the following properties to the checkbox class

padding: 0;
  margin:0;
   vertical-align: top;


cp_vertical_align - JSFiddle[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900