?
Solved

vertical-align:middle; does not work

Posted on 2016-07-18
6
Medium Priority
?
53 Views
Last Modified: 2016-07-19
Please look at http://rkassoc.org/Houston/form.htm

Notice bordered item on left near bottom with text INITIAL TEST.

HTML / CSS for that is:

<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;">INITAL<br>TEST</div>

Why does vertical-align:middle; not work?

Thanks
0
Comment
Question by:Richard Korts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 22

Expert Comment

by:Kim Walker
ID: 41717599
Vertical align is limited to inline elements and table cells. It does not apply to block level elements such as divs.

Why are you creating a table with divs? That must be extremely frustrating.

One way around this is to make your div behave like a table cell by giving it a display of table-cell.
<div class="col-sm-2 col-xs-2 text-center" 
	style="display:table-cell;padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;">
	INITAL<br>TEST
</div>

Open in new window


Please use the code tool to post your code to make it easier to read. It's so easy there's no excuse not to. Simply select your code and click the word CODE in the toolbar above your comment/question.
0
 

Author Comment

by:Richard Korts
ID: 41717606
I added display:table-cell; Makes no difference.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
      <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
<title>City of Houston Backflow Assembly & Test Report Form</title>
 <style>
.nopadding {
   padding: 0 !important;
   margin: 0 !important;
}
.wrapper{
  max-width:1100px;
min-width:600px;
  margin:0 auto;
  
}
</style> 
<script type="text/javascript">

</script>
<script>
  $(function() {
    $( "#datepickerid" ).datepicker();
  });
  $(function() {
    $( "#datepickert" ).datepicker();
  });
</script>
</head>
<body>
<div class="wrapper">
<form method="POST" name="st" action="post_form.php" onSubmit="return chk_cals();">
<div class="container-fluid" >
<div class="row">
	<div class="col-sm-3 col-xs-3" style="padding-top:3px;"><img src="images/logo.png" class="img-responsive"></div>
	<div class="col-sm-9 col-xs-9 text-center" style="padding-top:50px; font-size:22px;"><b>City of Houston - Backflow Assembly & Test Report Form</b></div>
</div>	
<div class="row">
	<div class="col-sm-6 col-xs-6 text-right" style="padding-top:3px;">Name of Property:&nbsp;</div>
	<div class="col-sm-6 col-xs-6 text-left"  style="padding-top:3px;"><input type="text" name="pn" style="width:300px;"></div>
</div>	
<div class="row">
	<div class="col-sm-6 col-xs-6 text-right" style="padding-top:3px;">Property Address:&nbsp;</div>
	<div class="col-sm-6 col-xs-6 text-left"  style="padding-top:3px;"><input type="text" name="padr" style="width:300px;"></div>
</div>	
<div class="row">
	<div class="col-sm-6 col-xs-6 text-right" style="padding-top:3px;">City, State, Zip:&nbsp;</div>
	<div class="col-sm-6 col-xs-6 text-left"  style="padding-top:3px;"><input type="text" name="city" value="Houston">,&nbsp;<input type="text" size="2" name="state" value="TX">&nbsp;<input type="text" style="width:50px;" name="zip"></div>
</div>
<div class="row">
	<div class="col-sm-6 col-xs-6 text-right" style="padding-top:3px;">Key Map#:&nbsp;</div>
	<div class="col-sm-6 col-xs-6 text-left"  style="padding-top:3px;"><input type="text" name="keymap1" style="width:40px;">-<input type="text" name="keymap2" style="width:30px;"><span style="padding-left:20px;">Phone#:&nbsp;</span><input type="text" name="phac" style="width:40px;">-<input type="text" name="phex" style="width:40px;">&nbsp;<input type="text" name="phl4" style="width:45px;"></div>
</div>
<div class="row">
	<div class="col-sm-6 col-xs-6 text-right" style="padding-top:3px;">Same as above:&nbsp;<input type="checkbox" name="ckmasa">&nbsp;Mailing Address:&nbsp;</div>
	<div class="col-sm-6 col-xs-6 text-left"  style="padding-top:3px;"><input type="text" name="madr" style="width:300px;"></div>
</div>
<div class="row">
	<div class="col-sm-6 col-xs-6 text-right" style="padding-top:3px;">Contact Name:&nbsp;</div>
	<div class="col-sm-6 col-xs-6 text-left"  style="padding-top:3px;"><input type="text" name="conname" style="width:200px;"></div>
</div>	
<div class="row">
	<div class="col-sm-6 col-xs-6 text-right" style="padding-top:3px;"><b>Type of Assembly</b></div>
	<div class="col-sm-6 col-xs-6 text-left"  style="padding-top:3px;">&nbsp;</div>
</div>	
<div class="row">
	<div class="col-sm-1 col-xs-1">&nbsp;</div>
	<div class="col-sm-10 col-xs-10 text-center" style="padding-top:3px;"><span style="padding-right:50px;">New&nbsp;<input type="radio" name="anr"></span><span style="padding-right:50px;">Existing&nbsp;<input type="radio" name="anr"></span>Replaced:&nbsp;<input type="text" name="rsn" style="width:150px;">&nbsp;(Old serial number replaced)</div>
	<div class="col-sm-1 col-xs-1">&nbsp;</div>
</div>	
<div class="row">
	<div class="col-sm-1 col-xs-1">&nbsp;</div>
	<div class="col-sm-10 col-xs-10 text-center" style="padding-top:3px;"><span style="padding-right:50px;"><input type="radio" name="asstyp">&nbsp;Reduced Pressure Principle (RP)</span><span style="padding-right:50px;"><input type="radio" name="asstyp">&nbsp;Reduced Pressure Principle Detector (RPD)</span><span><input type="radio" name="asstyp">&nbsp;Pressure Vacuum Breaker (PVB)</span></div>
	<div class="col-sm-1 col-xs-1">&nbsp;</div>
</div>	
<div class="row">
	<div class="col-sm-1 col-xs-1">&nbsp;</div>
	<div class="col-sm-10 col-xs-10 text-center" style="padding-top:3px;"><span style="padding-right:50px;"><input type="radio" name="asstyp">&nbsp;Double Check Valve (DCV)</span><span style="padding-right:50px;"><input type="radio" name="asstyp">&nbsp;Double Check Valve - Detector (DCD)</span><span><input type="radio" name="asstyp">&nbsp;Spill Resistant Pressure Vacuum Breaker (SVB)</span></div>
	<div class="col-sm-1 col-xs-1">&nbsp;</div>
</div>
<div class="row">
	<div class="col-sm-1 col-xs-1">&nbsp;</div>
	<div class="col-sm-10 col-xs-10 text-center" style="padding-top:3px;"><span style="padding-right:30px;">Manufacturer:&nbsp;<input type="text" name="mfg" style="width:150px;"></span><span style="padding-right:30px;">Model #:&nbsp;<input type="text" name="model" style="width:100px;"></span><span style="padding-right:30px;">Size:&nbsp;<input type="text" name="size" style="width:100px;"></span><span>Serial Number:&nbsp;<input type="text" name="serno" style="width:150px;"></span></div>
	<div class="col-sm-1 col-xs-1">&nbsp;</div>
</div>
<div class="row">
	<div class="col-sm-1 col-xs-1">&nbsp;</div>
	<div class="col-sm-10 col-xs-10 text-center" style="padding-top:3px;"><span style="padding-right:30px;">Serving/Location:&nbsp;<input type="text" name="sloc" style="width:450px;"></span><span>Date Installed:&nbsp;<input type="text" name="instdate" id="datepickerid" ></span></div>
	<div class="col-sm-1 col-xs-1">&nbsp;</div>
</div>
<div class="row">
	<div class="col-sm-12 col xs-12">&nbsp;</div>
</div>	
<div class="row">
	<div class="col-sm-2 col-xs-2" style="padding-top:3px;">&nbsp;</div>
	<div class="col-sm-6 col-xs-6 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:30px;">REDUCED PRESSURE PRINCIPLE ASSEMBLY</div>
	<div class="col-sm-4 col-xs-4 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:30px;">PRESSURE VACUUM BREAKER & SVB</div>
</div>
<div class="row">
	<div class="col-sm-2 col-xs-2" style="padding-top:3px;">&nbsp;</div>
	<div class="col-sm-4 col-xs-4 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:30px;">Double Check Valve Assembly</div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;height:30px;">RELIEF VALVE</div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;height:30px;">AIR INLET</div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;height:30px;">CHECK VALVE</div>
</div>
<div class="row">
	<div class="col-sm-2 col-xs-2" style="padding-top:3px;">&nbsp;</div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;">CHECK VALVE #1</div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;">CHECK VALVE #2</div>
	<div class="col-sm-6 col-xs-6 text-center" style="padding-top:3px;vertical-align:middle;">&nbsp;</div>
</div>
<div class="row">
	<div class="col-sm-2 col-xs-2 text-center" style="display:table-cell;padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;">INITAL<br>TEST</div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;">D. C. Closed Tight&nbsp;<input type="checkbox" name="itcv1ct"><br>RP&nbsp;<input type="text" name="itcv1psi" style="width:75px;">&nbsp;PSI<br>Leaked&nbsp;<input type="checkbox" name="itdcv1l"></div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;">Closed Tight&nbsp;<input type="checkbox" name="itcv2ct"><br><input type="text" name="itrvpsi" style="width:75px;">&nbsp;PSI<br>Leaked&nbsp;<input type="checkbox" name="itdno"></div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;">Opened At<br><input type="text" name="itrvpsi" style="width:75px;">&nbsp;PSI<br>Did Not Open&nbsp;<input type="checkbox" name="itrvdno"></div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;">Opened At<br><input type="text" name="itaipsi" style="width:75px;">&nbsp;PSI<br>Did Not Open&nbsp;<input type="checkbox" name="itaidno"></div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;">Held At<br><input type="text" name="itcvpsi" style="width:75px;">&nbsp;PSI<br>Leaked&nbsp;<input type="checkbox" name="itcvl"></div>
</div>
<div class="row">
	<div class="col-sm-2 col-xs-2 text-center" style="display:table-cell;padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;">REPAIRS<br>MATERIALS<br>USED</div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;"><textarea rows="3" cols="18" name="rmucv1"></textarea></div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;"><textarea rows="3" cols="18" name="rmucv2"></textarea></div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;"><textarea rows="3" cols="18" name="rmurv"></textarea></div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;"><textarea rows="3" cols="18" name="rmuai"></textarea></div>
	<div class="col-sm-2 col-xs-2 text-center" style="padding-top:3px;vertical-align:middle;border-style: solid;border-width: 1px;height:90px;"><textarea rows="3" cols="18" name="rmucv"></textarea></div>
</div>
</div>
</form>
</div>
</body>
</html>

Open in new window

0
 
LVL 22

Accepted Solution

by:
Kim Walker earned 2000 total points
ID: 41717642
My mistake, it doesn't work on floated divs. You will have to manually adjust the top padding and height to achieve this.

You didn't answer why you're creating a table with divs.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Richard Korts
ID: 41717669
"You didn't answer why you're creating a table with divs."

I am using Bootstrap to achieve a responsive "table" effect.
0
 
LVL 22

Expert Comment

by:Kim Walker
ID: 41718138
That sounds tedious. Good luck.
0
 

Author Comment

by:Richard Korts
ID: 41719276
What would you recommend?

I need a responsive site with a table like layout.

I know of NO OTHER WAY.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
Suggested Courses
Course of the Month9 days, 12 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question