I have a fairly complex layout (multiple layers of nesting, and overlaying components) that had been using a table to perform the layout. I am trying to convert it to using CSS and DIV's. But the usual problem with lack of vertical alignment in DIVs has reared it's head.
I need an image within a DIV to aligned with the bottom on the DIV container. But I vary the height of the image with a script to produce some animations. The animation only works if the image is 'bottom' aligned. The "vertical-alignment: bottom" construct only works on in-line elements.
Any ideas?
Welcome to the Cumulus Support forum.
Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080
Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080
CSS DIV's and alignment
Moderator: daj
- daj
- Posts: 2041
- Joined: Tue 29 Jul 2008 8:00 pm
- Weather Station: WH1081
- Operating System: Pi & MX
- Location: SW Scotland
- Contact:
Re: CSS DIV's and alignment
The style sheet
The html
The important part is the position statement in the containing DIV and the IMG, and also the 'bottom'
Code: Select all
#mydiv { height: 200px;
border: 1px solid;
position: absolute;
width: 500px;
}
#mydiv img {
position: absolute;
bottom: 0px;
left: 0px;
}
Code: Select all
<div id="mydiv">
<img src="http://www.grantownweather.co.uk/images/works_iphone.png"/>
</div>- mcrossley
- Posts: 14388
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: CSS DIV's and alignment
Thanks David, I'll give that a whirl... once I unpick it all again,and get it something like!