Solved

vertical-align:middle; does not work

Posted on 2016-07-18
6
38 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
  • 3
  • 3
6 Comments
 
LVL 21

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 21

Accepted Solution

by:
Kim Walker earned 500 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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 21

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
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 define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now