CSS columns aren't aligning up - html

So I've been racking my brains over this CSS for a while now, need someone to look over it with a fresh set of eyes... Basically what's happening is that I have 4 columns which sit next to each other in the Footer, but the last column is automatically shifting underneath the 3rd column. I can't see what's happening to make it do that?!
Check out the link below:
test.snowflakesoftware.com
Below is the CSS:
#mod_footer {
width: 100%;
background: url(images/footer.jpg);
background-position: center top;
background-repeat: no-repeat;
background-color: #212530;
}
.mod_footer_container {
margin: 0 auto;
width: 1200px;
padding-top: 25px;
}
.mod_footer_col {
float: left;
width: 25%;
padding-right: 25px;
}
#mod_footer_col_end {
float: left;
width: 25%;
}
#nav-bottom-left,
#nav-bottom-left ul {list-style-image: url(images/bullet.png); font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 12px; color: #FFF;}
#nav-bottom-left a {}
#nav-bottom-left li {margin-left: 25px;}
#nav-bottom-right,
#nav-bottom-right ul {list-style-image: url(images/bullet.png); font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 12px; color: #FFF;}
#nav-bottom-right a {}
#nav-bottom-right li {}
p.footer_title {color: #9bcbf3;}
p.footer {font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 12px; line-height: 18px; color: #FFF;}
p.footer .menu-item {list-style-image: url(http://www.snowflakesoftware.com/wp-content/themes/images/bullet.png);}
.mod_footer_container_bottom {
clear: both;
margin: 0 auto;
width: 1200px;
padding-top: 25px;
padding-bottom: 25px;
}
#mod_footer_bottom_col {
width: 100%;
}
And below is the HTML:
<div id="mod_footer"><footer>
<div class="mod_footer_container">
<div class="mod_footer_col">
<p class="footer_title">Quick Links</p>
<br />
<div id="nav-bottom-left" class="nav"><nav>
<p class="footer"><?php wp_nav_menu( array('theme_location' => 'footer-menu-one' )); /* editable within the Wordpress backend */ ?></p>
</nav></div><!--#nav-bottom-left-->
</div><!--mod_footer_col-->
<div class="mod_footer_col">
<p class="footer_title">In our Labs</p>
<br />
<div id="nav-bottom-right" class="nav"><nav>
<p class="footer"><?php wp_nav_menu( array('theme_location' => 'footer-menu-two' )); /* editable within the Wordpress backend */ ?></p>
</nav></div><!--#nav-bottom-right-->
</div><!--mod_footer_col-->
<div class="mod_footer_col">
<p class="footer_title">Become a Partner</p>
<br />
<p class="footer">We're always looking for new partners to team up with in order to encourage and facilitate the use of geospatial data and components within mainstream IT systems. Want to join us? All you need to do is contact us and we can get the ball rolling...</p>
<br />
<p class="footer">Join our Partner Programme</p>
</div><!--mod_footer_col-->
<div id="mod_footer_col_end">
<p class="footer">Interoperable data exchange via open standards - It's what we're all about.</p>
<br />
<p class="footer">Whether you want to load OS MasterMap, publish INSPIRE compliant data or know how to deliver AIXM via web services or any other GML data, we can help. Our software is enabling geographic information specialists around the world to easily load, publish, visualise and share geospatial data....</p>
</div><!--mod_footer_col_end-->
</div><!--mod_footer_container-->
<div class="mod_footer_container_bottom">
<div id="mod_footer_bottom_col">
<p class="footer">© <?php echo date("Y") ?> <?php bloginfo('name'); ?>. <?php _e('All Rights Reserved.'); ?></p>
</div><!--mod_footer_bottom_col-->
</div><!--mod_footer_container_bottom-->
</footer></div><!--mod_footer-->
As you can see by visiting the link, the 4th column starts with the words 'Interoperable data exchange via open standards'
Hope someone can help!
Thanks!

Your cols are all 25% width. So 4 of them should make up 100% of the width of the footer.
Where you've gone wrong is adding the padding of 25px to them. So your essentially saying 100% + 75px which is forcing your last col to do what it's doing.
Either do your measurements in pixels as you know the width of the footer and subtract the 25px padding from the width or do it all in percentages but make sure the width + padding isn't > 100%.

I agree with Spacebeer's answer, here is an alternative solution to the problem:
css3 box-sizing: http://css-tricks.com/box-sizing/
Using this as
.mod_footer_col{box-sizing:border-box;}
would allow you to keep the padding.
Note: this doesn't work in ancient browsers. (ie7)

Remove padding-right:25px from .mod_footer_col as your columns have width 25% each. And this 25px padding when added in 25% columns width it pushes your 4th column down.
You can add padding in p.footer to keep spacing between columns paragraphs.

Related

HTML/CSS : Add Responsive Box+Text Over Image

I have a website www.weardenali.com. A part of the site has an image banner which I want to be overlayed by a Colored Box and some text, just like how Bellroy.com has theirs.
This is what I have, a failed code which isn't responsive :
Wear Denali (my site):
Bellroy:
This is the code i am using now :
.image-banner-content.content-left {
padding-left: 1% !important;
}
.sf-animation.image-banner-content,
.sf-animation[data-animation="none"].image-banner-content {
bottom: 80% !important;
}
a.link:hover,
a.link:active {
text-decoration: underline;
color:#F03E3E !important;
}
<div style="margin-bottom: 60%; float: left; display: inline-block; padding: 0px 10px 5px 10px; background-color: #ffffff; position: relative;">
<h3>
<span style="color: #0e3559;">
Designed by Urban Adventurers
</span>
</h3>
<h4>
<a href="http://weardenali.com/" class="link" style="color: #0e3559; float: left; font-family: 'Lato', sans-serif; -webkit-font-smoothing: antialiased; font-size: 12px; letter-spacing: 1.2px;">
> SHOP NOW
</a>
</h4>
</div>
I appreciate any advice/pointers.
Assuming your image banner was done in a kinda sorta ok way... This should work:
<!--- code for the image banner --->
<div class="MyAdvertisement">
<h3>Designed by Urban Adventurers</h3>
<a href="http://weardenali.com/">
<i class="fa fa-chevron-right" aria-hidden="true"></i>
SHOP NOW
</a>
</div>
<!--- end code for the image banner --->
Note that I added Font Awesome code for the > you had in there. Using glyphs the way you did is annoying for non-sighted users. Google Font Awesome. It's nice.
I'm not sure what you want to do exactly. I'll give you css for pixel values, but if you want responsive as is 'scales with the browser', use percentages.
.MyAdvertisement {
display: block;
position: absolute;
top: 0;
left: 0;
width: 200px;
height: auto;
overflow: hidden;
background: white;
}
If you can't put your code where I suggested, you are going to have to tell us more about your site code before anyone can help you in any meaningful way.
Good luck & have fun.

Align divs within a div when images are present

I am having trouble figuring out the proper CSS for this page. I would like to maintain a responsive design so that images will re-size for the container they are in. If you look at this JSFiddle in Chrome and Safari it works fine. The images do not resize in FireFox or IE 11. The larger full images do not show on an iPad or iPhone at all. I'm not sure where to turn to next.
Here's the HTML
<div class="colab_page_block_full colab_margin_bottom">
<div class="colab_page_block_half colab_page_block_left colab_top">
<img src="https://www.filzfelt.com/images/pages/collaborators-chiara-assets/chiara-debenedetti-01.jpg" alt="" class="colab_image colab_bottom">
</div>
<div class="colab_page_block_half colab_page_block_right">
<h1 class="colab_text_padding">About Chiara Debenedetti</h1>
<p class="colab_text_padding">Chiara Debenedetti was born in Italy in 1982 and graduated from the European Design Institute of Milan in 2003. She founded Harta Design in 2011 and specializes in packaging, logos and corporate identity for luxury brands in the fashion, fragrance
and food and beverage industries.</p>
<p class="colab_text_padding">“Design for me is going beyond the visual form in order to develop the material aspect. We have five senses, but we often forget about touch. And yet this is the sense that allows us to first interact with the reality that surrounds us: the mother-daughter
relationship comes to mind. In my daily work as a designer, whether I am dealing with graphics or home décor objects, I always pay particular attention to the materials. My studio has become a depository of paper and textiles. With Bloomx, I aimed
to highlight the X-factor of felt: its feeling of warmth to the touch together with the lightness of the shapes that one can create at will.” </p>
</div>
</div>
<div class="colab_page_block_full colab_margin_bottom">
<img src="https://www.filzfelt.com/images/pages/collaborators-chiara-assets/chiara-debenedetti-02.jpg" alt="" class="colab_image colab_bottom">
</div>
<div class="colab_page_block_full colab_margin_bottom">
<div class="colab_page_block_half colab_page_block_left colab_bottom">
<img src="https://www.filzfelt.com/images/pages/collaborators-chiara-assets/chiara-debenedetti-03.jpg" alt="" class="colab_image colab_bottom">
</div>
<div class="colab_page_block_half colab_page_block_right">
<h2 class="colab_text_padding">About Bloomx</h2>
<p class="colab_text_padding colab_margin_bottom">Bloomx is a modular product that marries design and mathematics while providing strong graphic patterning through the play of positive and negative space. The exponent ‘ x’ (best known as ‘ power’ ) represents the infinite solutions in quantity, colors,
and shape. By pairing the single module—a clean essential shaped 6 petals flower—with header options, Bloomx can provide soft and textural space separation as flexible room dividers. 63 colors of 100% Wool Design Felt can be configured in limitless
ways and the product can grow or shrink as needed by adding or removing modules. Plus, the product can be quickly and easily reconfigured in the future as needs or tastes change.</p>
<img src="https://www.filzfelt.com/images/pages/collaborators-chiara-assets/chiara-debenedetti-04.jpg" alt="" class="colab_image colab_bottom">
</div>
</div>
<div class="colab_page_block_full">
<img src="https://www.filzfelt.com/images/pages/collaborators-chiara-assets/chiara-debenedetti-05.jpg" alt="" class="colab_image colab_bottom">
</div>
And here's the CSS that I have so far.
.colab_page_block p {
margin: 0;
font-style: normal;
font-weight: normal;
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height: 1.5;
color: #585858;
margin-top: 1.4em;
}
.colab_page_block h1 {
margin: 0;
font-style: normal;
font-weight: normal;
-webkit-font-smoothing: antialiased;
font-family: Museo-300, "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 2rem;
line-height: 1;
color: #2f292a;
}
.colab_page_block_full {
width: 100%;
overflow: auto;
display: table;
border: 1px solid black;
}
.colab_page_block_half {
width: 48%;
display: table-cell;
}
.colab_page_block_left {
padding-right: 2%;
border: 1px solid red;
}
.colab_page_block_right {
padding-left: 2%;
border: 1px solid blue;
}
.colab_text_padding {
padding-left: 4%;
padding-right: 8%;
}
.colab_image {
overflow: auto;
max-width: 100%;
max-height: 100%;
}
.colab_bottom {
vertical-align: bottom;
}
.colab_top {
vertical-align: top;
}
.colab_margin_bottom {
margin-bottom: 3.5em;
}
And here's a link to the JSFiddle:
https://jsfiddle.net/twestfall/Lbqfo40u/4/?utm_source=website&utm_medium=embed&utm_campaign=Lbqfo40u
Change the CSS for .colab_image to:
.colab_image {
overflow:auto;
width: 100%;
height: auto;
}
Here's a working JSFiddle.

How can I have the text content of a div overflow in a HTML email template?

I'm working on this HTML email template and thought I was done until I figured out that GMail and some other e-mail clients strip out the position CSS property.
Since writing html/css for email readers is like going back into the stone ages I'm a little bit stuck on this one.
What I want is to display a score bar which is sort of like a progress bar, with a score text inside of it, like this:
This works fine until the score becomes really low and the score text doesn't fit inside of the blue container anymore. The text just gets cuts off like so:
and at 0%:
Please note that I'm not sure why the word "Score" still shows up in the last one.
What I want is the score text just to overlap into the red part when the text is too long to fit inside of the blue container.
My code is as follows:
<div style="float: left;width: 70%;height: 30px;max-height: 30px;background-color: #f00;color: #fff;font-weight: bold;padding: 0px;font-size: 18px;">
<div style="float: left;width: 0%;height: 30px;max-height: 30px;margin: 0;padding: 0;background-color: #3c88a7;overflow: visible;">
<div style="padding-left: 10px; float: left;line-height: 30px;max-height: 30px;">Score 0%</div>
</div>
</div>
I've also tried to solve it with a table, but I walk into the same problem - there seems to be no cross-platform way to make the text overflow the cell.
Any ideas how to solve this, so it works in all the major email clients and webmail clients?
It is as simple as this:
<div style="margin:0;padding:0;background:blue">
<p style="width:10%;background:red;color:white;white-space: nowrap;">Score: 10%</p>
</div>
not very polished, but at least for a code-starter it's fine, i guess
You could use just two div without positioning. You have to use white-space: nowrap to prevent your text from wrapping.
Example Snippet:
div.wrap {
width: 100%; height: 26px; max-height: 26px;
background-color: #dd6666; color: #333;
padding: 0px;
}
div.wrap > div {
line-height: 26px; max-height: 26px;
background-color: #3c88a7; padding: 0px 0px 0px 4px;
width: 30%; white-space: nowrap; color: #fff;
font-family: helvetica, sans-serif; font-size: 14px; font-weight: bold;
}
div.d2 > div { width: 5%; }
div.d3 > div { width: 15%; }
div.d4 > div { width: 0%; }
div.d5 > div { width: 60%; }
<div class="wrap d1">
<div>Score 30%</div>
</div>
<br /><div class="wrap d2"><div>Score 5%</div></div>
<br /><div class="wrap d3"><div>Score 15%</div></div>
<br /><div class="wrap d4"><div>Score 0%</div></div>
<br /><div class="wrap d5"><div>Score 60%</div></div>
Here's a completely insane solution. :)
I wrote the SVG to CSS here...
http://jsfiddle.net/coqckyj9/1/
Then converted the SVG to base64 and pasted it into the div background image...
http://jsfiddle.net/coqckyj9/2/
<div id='bar' style='width: 100px; height: 20px; background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPjxyZWN0IGZpbGw9J2JsdWUnIHdpZHRoPSc0cHgnIGhlaWdodD0nMjBweCcgLz48cmVjdCBmaWxsPSdyZWQnIHg9JzRweCcgIHdpZHRoPSc5NnB4JyBoZWlnaHQ9JzIwcHgnIC8+PHRleHQgeD0nMnB4JyB5PScxNnB4JyBmaWxsPSd3aGl0ZScgZm9udC1zaXplPScxOCc+U2NvcmUgNCU8L3RleHQ+PC9zdmc+);'></div>

Unwanted spacing between divs inside Html table column

I can't get rid of the space between each div I'm presenting in this HTML table, in my "ArticlesBar" column. In this column I have a div for the scroll bar and 3 other divs for header body and date of a news article. Between each of those divs I have a spacing. Any ideas on how to remove it?
This fiddle would help : http://jsfiddle.net/3TseC/
Please check the left column in the fiddle
HTml code:
<table class="homepage_table">
<tr>
<td id="Articlesbar" width="20%">
<div width="20%">
<%#include file="newsData.jsp" %>
</div>
</td>
<td id="about_td" width="80%">
<div class="fadein">
<img src="imp.gif">
<img src="http://thefinancialbrand.com/wp-content/uploads/2008/08/tagline-tagcloud.gif">
<img src="slogan1.gif">
</div>
<div id="about_text" width="100%" height="100px">
Founded in 1992 as a Finance and Securities Company,
Imperia Bank converted into a fully fledged commercial bank in January 1996.
Since then the bank has had a long standing tradition of achieving strong financial performance and carrying out
expansion strategies while successfully focusing on efficient client service delivery.<br><br>
Over the last 20 years, Imperia Bank has achieved a sustained growth in our customer deposit base which is largely attributed to the level of confidence our customers have in the bank and our corporate strategy.
Currently we have 23 branches in our expanding branch network across major towns and cities.<br><br>
Imperial Bank will continue to enhance the existing risk management parameters through the effective use of our newly installed and cutting edge core banking system.
As part of our growth strategy, we are also continuing to recruit qualified professional staff, and providing appropriate training to our existing human resources to ensure we continue to meet evolving customer demands.
</div>
</td>
</tr>
</table>
Another html(imported from jsp file, I'm actually using imported data from MySql, but to show the problem I'm using regular text insid div):
<div id= "newsHeader">this is a header</div>
<div id = "newsBody">this is the body</div>
<div id = "newsDate">this is the date</div>
CSS code:
.homepage_table {
border: 250;
width: 100%;
height: 600px;
margin: auto;
}
.homepage_table td {
border: 0;
}
#about_td {
background-image: url('http://www.promenadd.com/en/wp-content/uploads/2013/04/promenadd_grey_background.jpg');
background-repeat: no-repeat;
background-size: 110%;
font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, "AppleGothic", sans-serif;
font-weight: bold;
}
#about_text {
padding-right: 50px;
padding-left: 50px;
color: steelblue;
}
#Articlesbar {
height: 50px;
}
#Articlesbar div {
overflow-y: scroll;
height: 100%;
margin: 0;
}
#newsHeader {
font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, "AppleGothic", sans-serif;
color: steelblue;
font-weight: bold;
font-size: 20px;
padding-right: 10px;
padding-left: 10px;
width: 100%;
height: 20px;
margin: 0;
}
#newsBody {
font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, "AppleGothic", sans-serif;
color: red;
font-size: 14px;
padding-right: 10px;
padding-left: 10px;
width: 100%;
margin: 0;
height: 20px;
}
#newsDate {
margin: 0;
width: 100%;
font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, "AppleGothic", sans-serif;
font-size: 14px;
padding-right: 10px;
padding-left: 10px;
height: 20px;
}
Sure no worries
all you need to do if I am right in assuming that you don't want the huge white space between the
<div id= "newsHeader">this is a header</div>
<div id = "newsBody">this is the body</div>
<div id = "newsDate">this is the date</div>
elements is to replace the css selector
#Articlesbar div
with
#Articlesbar > div
This selector means that only the direct descendent of #Articlesbar will gain the attribues of the style.
as it stands the three other divs are having their heights set to 100% as well.
re-re updated fiddle
Your #articlesbar has a height of 50px. And you give all the divs inside that a height of 100% of that, hence the spacing.
I cleared it up a bit, try to start from here again:
http://jsfiddle.net/3TseC/3/
why are you using tables anyway, they just seem to make things more complicated for what you want. I would just setup one div that holds the complete article then if you want add child divs to display headers, content, etc.
Also, use CSS margin like this margin:0px;

Header text next to a picture formatting

Here is my code:
<div class="contact">
<p class="size25">TOP 1% Realtors</p>
<p class="size16">32 years in real estate</p>
<p class="size16">Closed one home every 10 days in 2011 - 2012</p>
<p class="size16">Specializing in the 24/680 Corridor</p>
<p class="size16">example#aol.com</p>
<p class="size25 phone">(510) 555.5555</p>
</div>
CSS:
.contact p{
float:right;
}
.contact{
color: #fff;
display: block;
width: 421px;
height: 114px;
position: absolute;
margin-top: -96px;
margin-left: 519px;
font-family: 'Marcellus', serif;
font-weight:300;
line-height: 12px;
}
.contact a:link {
text-decoration:none;
color: #AC872F;
}
.phone{color: #AC872F}
.size25{font-size:25px}
.size16{font-size:16px}
.size14{font-size:14px}
.size11{font-size:11px}
.size10{font-size:10px}
Image: http://imgur.com/LntF419
I want the text on the right to be aligned right and each on it's own line. Right now as you can see the email is not. This is also my first time using twitter bootstrap so if there is something that can help me please let me know.
Add clear: both to the .contact p. The clear attribute removes other elements in line with a floating element.
Demo: http://jsfiddle.net/q4YdC/ (I've removed the div margin for visibility reasons)