Aligning elements at the bottom of multiple columns - html

I've got three unequal length columns of text and I want to put a button at the bottom of each column. I'm looking for a current method--preferably CSS only--of positioning the buttons so that they're at the same vertical position in the page when the columns are side-by-side (floated), and then are positioned after the relevant column when the layout is single column (on small screens). I don't necessarily need the columns to be equal length since they don't have backgrounds, unless that's part of the solution.
This is the code/description for the relevant section:
<div 1 - position:relative>
<div 2 - display:block;overflow:hidden>
<div 3 - position:relative; float:left>
<div 4 - display:block>
<img src="image1.jpg" />
<h1>Title 1</h1>
<p> Column 1 text</p>
</div 4>
</div 3>
<div 3 - position:relative; float:left>
<div 4 - display:block>
<img src="image2.jpg" />
<h1>Title 2</h1>
<p> Column 1 text</p>
</div 4>
</div 3>
<div 3 - position:relative; float:left>
<div 4 - display:block>
<img src="image3.jpg" />
<h1>Title 3</h1>
<p> Column 1 text</p>
</div 4>
</div 3>
</div 2>
</div 1>
I've tried lots of variations in code and placement, but I haven't been able to make it work. I've also found a few solutions, but they were either old (back to IE 5) or I couldn't figure out if they were relevant Maybe they were but I couldn't see it!).
Placing them in a separate div after the column divs looks good on a full screen, but on a small screen all the buttons are positioned after the last column. Placed at the beginning or end of the columns has them positioned vertically based on the length of text in each column.
I tried position:absolute;bottom:0 to place them at the bottom of div 2, with poor results. Any ideas/solutions are much appreciated.

The only non-JS solution I can think of would be to make it a table.
<table valign=top cellspacing=18px>
<tr>
<td align=center><h2>Title 2</h2></td>
<td align=center><h2>Title 2</h2></td>
<td align=center><h2>Title 3</h2></td>
</tr>
<tr>
<td valign=top>
<img src="image1.jpg" />
Column 1 text
</td>
<td valign=top>
<img src="image2.jpg" />
You looked me dead in the eye and told me you were dying.<br />
And then there was no light on the earth.<br />
But what you saw in me that night was not a light.<br />
Only Darkness.
</td>
<td valign=top>
<img src="image3.jpg" />
Column 3 text
</td>
</tr>
<tr>
<td align=center><button>Hello</button></td>
<td align=center><button>There</button></td>
<td align=center><button>Sir </button></td>
</tr>
</table>
This code gives the desired result, and you can mess around with the css for each cell.
Otherwise, you could loop through each div element with jQuery or pure JavaScript, find the largest height, store it in a variable, then loop back through the div elements containing the button and set each height according to the variable. Then the position:absolute;bottom:0px; would work.

Actually, the table only works on wider screens. Pretty sure it won't flow the text into a single column with the buttons between text sections. I used display: and screen width media queries to alternately display/hide two sets of buttons, one set positioned after each column and one set floated in a div positioned after all the columns. I guess I could have also made two versions and used a media query to display/hide based on screen width. The jsfiddle at jsfiddle.net/DTMgJ/5/ also solves it using media queries and large negative margins.

Related

Netsuite Advanced PDF footer centering issue

I am customizing forms in NetSuite and have gotten everything to work as I would want, except the footer. For some reason the text-align: center function is working based on the number of characters in the row of the footer, rather than the center of the page. Below are images of my code and print examples that show the error better. The only difference in the code between footer code images 1 and 2 is that I removed the word "number" in row 55 to depict the centering is based on characters.
Footer Code 1
Footer Print 1
Footer Code 2
Footer Print 2
If you were to show the borders on your tds you'd get a better sense of what's going on. Basically you are not providing hints for the td and table sizes so the normal table width processing is happening. ie. the tables will only be wide enough to hold the text so they appear to be text size based.
Also I suspect you have a lot more markup than you need. The following will give you what I think you are looking for. Note that you may want to play with padding to get the correct left and right alignments.
<macro id="nlfooter">
<hr />
<table class="footer" style="width: 100%;">
<tr>
<td align="left" colspan="4">email</td>
<td align="center" colspan="6">Phone</td>
<td align="right" colspan="4">Page info</td>
</tr>
<tr>
<td align="center" colspan="14">
<b>Thank you</b>
</td>
</tr>
</table>
</macro>

Change particular div class in kendo grid row template

I am running one project where i am using kendo grid row template.
Below is my html grid code:
table id="grid" style="width:100%">
<colgroup>
<col class="photo" />
<col class="details" />
<col />
</colgroup>
<thead style="display:none">
<tr>
<th>
Details
</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3"></td>
</tr>
</tbody>
</table>
<script id="rowTemplate" type="text/x-kendo-tmpl">
<tr>
<td style="width:30%">
div class="row">
<div id="dvImage" class="col-sm-4" style="width:118px">
#= imagelink #
</div>
<div class="col-sm-8" style="width:400px">
<span class="name" style="font-size:14px; color:green">#: Link #</span>
</div>
</div>
</td>
</tr>
</script>
In the above script for div class name "dvImage" for sometimes data is not present so it's still contain those space.
I googled many things and got to know that if we can find this div class in onDataBound event then i can check if this div don't have data then can hide this div for particular row. but when i tried this only for first row i am able to hide the data for other rows still it was containing space.
All suggestions are welcome.
If I understand your requirements correctly if the image doesn't exist then you want the rest of the row details to take up the rest of the space? If this is not correct the please correct me.
Assuming this is the case then you can actually change your template like this:
Before
<div id="dvImage" class="col-sm-4" style="width:118px">
#= imagelink #
</div>
After
#if(data.imagelink === null || data.imagelink === ""){#
<div class="col-sm-12" style="width:518px">
#} else {#
<div id="dvImage" class="col-sm-4" style="width:118px">
#= imagelink #
</div>
<div class="col-sm-8" style="width:400px">
#}#
I have put together a demo for you to look at here: http://dojo.telerik.com/eMiMa/2
(in the demo I have told the grid to hide the photo for every even row and expand the details grid to take up two columns rather than 1 column)
What this change simply does is look at your template and checks to see if the imagelink value is valid and if it isn't then it simply expands the detail div for you to take up the maximum space. If the image does exist then it processes the template as normal.
In order to keep the dimensions the same the opening div for your next section is contained within the conditional formatting so that it applies the correct spacing for you.
If the requirement is to just hide the entire row then you can move this conditional check to the top of the template and hide the entire row. If this is the desired outcome then I can update the answer to reflect this.

HTML Table with images

so i am currently re making the site for my university's drama department and i want to add 3 images side by side (with spacing between them). They also need to have captions. But the caption needs to have a header (that is styled differently than the caption itself) followed by the caption itself. having looked around here and other places i figured i would be able to do this using a table since formatting size would be easiest this way. I have been at this portion of the site for almost 1 month and have tried numerous other methods (divs, tables, etc.) I was wondering if someone else has done something like this and would be able to impart some advice. The site currently is located here: drama site. Any help would be appreciated (i hope this follows the guidelines, first time asker)
Edit: The following is the portion of the code i need help with:
function windowSize() {
var w = var w = document.getElementById('body').clientWidth;
document.getElementById('newsTable').style.width = w + 'px';
document.getElementById('newsItems').style.height = document.getElementById('newsItems').clientWidth + 'px';
}
<body id="body" onload="windowSize();getCurrentPage();" onresize="windowSize()">
<table id="newsTable" cellpadding="0" border="0">
<tr>
<td id="newsItems" align="center" background="http://i.imgbox.com/5GLGmmDE.gif">1</td>
<td id="newsItems" align="center" background="http://i.imgbox.com/5GLGmmDE.gif">2</td>
<td id="newsItems" align="center" background="http://i.imgbox.com/5GLGmmDE.gif">3</td>
</tr>
<tr>
<td id="newsItems" align="center">4</td>
<td id="newsItems" align="center">5</td>
<td id="newsItems" align="center">6</td>
</tr>
</table>
</body>
I don't want the pictures to be as big as they are in the link, i would like them to be a bit smaller. I would also like some room between them. Currently when the page gets bigger the image starts to repeat. If i took the repeat off then it would have blank space where it would normally repeat
Probably the nicest option would be to use bootstrap. It can do a lot of the columner work for you. But if that sounds a little complex, here is a simple fiddle with three images side by side.
http://jsfiddle.net/44uv9a2m/
I'm just wrapping the images and their captions in divs, then giving them a fixed width.
.oneThird{
width:30%;
float:left;
margin:.5%;
}
.oneThird img{
width:100%;
}
<div class="oneThird">
<img src="http://www.photosnewhd.com/media/images/picture-wallpaper.jpg"></img>
<p>Caption</p>
</div>
<div class="oneThird">
<img src="http://www.photosnewhd.com/media/images/picture-wallpaper.jpg"></img>
<p>Caption</p>
</div>
<div class="oneThird">
<img src="http://www.photosnewhd.com/media/images/picture-wallpaper.jpg"></img>
<p>Caption</p>
</div>
* Edit *
This is a basic bootstrap example.
http://www.bootply.com/n6AdJPYIe3

HTML CSS image in second column of table not displaying correctly

I am trying to create a table which has a list on the first column and an image in the second column. However when I put the image in the second column it moves the list of the first column down. Here is what happens:
As you can see the image moves the list down. How could I get it so it looks like this:
This is the code for the table.
<table border="0">
<tr>
<td>
<ul>
<li>F1</li>
<li>ALMS</li>
<li>Le Mans 24 Hour</li>
<li>WTCCBritish GT</li>
<li>BTCC</li>
<li>Toca support races</li>
</ul>
</td>
<td>
<img src="http://www.motorground.co.uk/wp-content/uploads/2013/02/track-day-0732-300x200.jpg" alt="PrivateTuitionimg073" width="300" height="200" class="aligncenter size-medium wp-image-23" />
</td>
</tr>
</table>
You must add to your img style:
float: right
And position it at the bottom of te list in same cell.
Normally you have to set the vertical alignment for the table cell.
Just see this content. This should answer your question ;)
http://phrogz.net/css/vertical-align/index.html

Representing Table with DIV

I had a table
<td colspan="6">
<table width="100%" border="0">
<tr align="center">
<td width="5%"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></td>
<td width="7%"><strong>Item Id </strong></td>
<td width="20%"><strong>Item</strong></td>
<td width="17%"><strong>Type</strong></td>
<td width="17%"><strong>Rate</strong></td>
<td width="17%"><strong>Quantity</strong></td>
<td width="17%"><strong>Price</strong></td>
</tr>
I am representing the table through <DIV> like This
<div id="table">
<div class="row" id="row" align="center">
<div id="cell"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></div>
<div id="cell"><strong>Item Id </strong></div>
<div id="cell"><strong>Item</strong></div>
<div id="cell"><strong>Type</strong></div>
<div id="cell"><strong>Rate</strong></div>
<div id="cell"><strong>Quantity</strong></div>
<div id="cell"><strong>Price</strong></div>
</div>
but I can't find any replacement for colspan="6". Can anyone help?
OK, let's get this straight for the 100th time.
Tables are not evil.
Tables are for tabular data. If you have headers, rows or columns, then it's cool. Tables are the thing to use.
In HTML. Tables.
Misusing elements is evil
Using any element for the wrong reason is wrong.
h1 for images
table for layout
button for links
These things are wrong. And bad.
Summary
Use tables for tables, not for layout, and everyone will be happy.
Div do not use concept of columns. You can have as many as you want, div's in a row. You can fix width of div and then can use them to build up table. By the way you can go for css framework like bootstrap will be much more efficient.
Make the div width in such a way that, it will occupy "TD" sections.
For that you just need to add one more class with some higher width in it and some less div on the new row.