CSS bubble doesn't work in Firefox - html

I have some CSS:
.bubbledLeft,
.bubbledRight{
position: relative;
margin-top: 3px;
max-width: 99%;
clear: both;
min-width: 99%;
}
.bubbledLeft{
float: left;
margin-right: auto;
padding: 14px 10px 4px 15px; /*position within the border*/
}
.bubbledLeft:before{
z-index: -1;
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
content: "";
border-width: 8px 10px 8px 17px;
border-image: url("/assets/chat/speech_bubble_left_2.png") 8 10 8 17 stretch stretch;
-webkit-border-image: url("/assets/chat/speech_bubble_left_2.png") 8 10 8 17 stretch stretch;
-moz-border-image: url("/assets/chat/speech_bubble_left_2.png") 8 10 8 17 stretch stretch;
-o-border-image: url("/assets/chat/speech_bubble_left_2.png") 8 10 8 17 stretch stretch;
}
.bubbledRight{
float: right;
margin-left: auto;
text-align: right;
text-align: left;
padding: 4px 15px 4px 15px; /*position within the border*/
}
.bubbledRight:before{
z-index: -1;
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
content: "";
border-width: 8px 17px 8px 10px;
border-image: url("/assets/chat/speech_bubble_right_2.png") 8 17 8 10 stretch stretch ;
-webkit-border-image: url("/assets/chat/speech_bubble_right_2.png") 8 17 8 10 stretch stretch ;
-moz-border-image: url("/assets/chat/speech_bubble_right_2.png") 8 17 8 10 stretch stretch ;
-o-border-image: url("/assets/chat/speech_bubble_right_2.png") 8 17 8 10 stretch stretch ;
}
HTML:
<div class="content">
<textarea id="messageText" rows="3" style="width: 80%; resize: none; height: 40px; border: 0px; position: fixed; top: 0px; left: 0px; z-index: 999;" >Napisz wiadomość...</textarea>
<button id="sendMsgBtn-ajax" class="sendMsgBtn">Wyślij</button>
<div class="commentArea" id="commentArea">
<% #msgs.each do |m| %>
<% if (current_user.blank? == false && m.user.blank? == false && m.user.email == current_user.email) %>
<div class="bubbledRight">
<%= m.body %>
<br />
<div class="date-right"><%= m.created_at.to_time.strftime("%Y-%m-%d %H:%M") %></div>
<div class="nick-right"> ~<%= m.user.blank? == false ? m.user.email : "gość" %></div>
</div>
<br />
<% else %>
<div class="bubbledLeft">
<%= m.body %>
<br />
<div class="date"><%= m.created_at.to_time.strftime("%Y-%m-%d %H:%M") %></div>
<div class="nick"> ~<%= m.user.blank? == false ? m.user.email : "gość" %></div>
</div>
<br />
<% end %>
<% end %>
</div>
</div>
It works perfectly on Chrome, Opera and Safari but it doesn't on Firefox. Why ?
Screenshots (left chrome right firefox): http://ge.tt/7dGLW7U?c

Firefox doesn't seem to like having border-width on its own without other border properties. Try adding this line before your border-width line:
border:solid transparent;
UPDATE:
The latest CSS3 spec says that the border image should not be displayed in the middle of the box, so Firefox's implementation is correct. To show the border image in the whole box, add the fill value for the border-image-slice property, or use the fill keyword in the border-image shorthand. The following CSS should work for you:
-webkit-border-image: url("speech_bubble_left_2.png") 8 10 8 17 fill stretch;
-moz-border-image: url("speech_bubble_left_2.png") 8 10 8 17 fill stretch;
-o-border-image: url("speech_bubble_left_2.png") 8 10 8 17 stretch;
border-image: url("speech_bubble_left_2.png") 8 10 8 17 fill stretch;
Note that Opera doesn't support fill yet but it will work if you just use stretch on its own. Also, it's better to put the non-prefixed property last for browsers that support it, as this is the order that CSS rules are parsed.

Related

Move Logo Without Changing Design

I have a logo I created using a div and two letters which I want to move inside the coral colored div. However every time I change left/right properties or margin/padding I end up changing the letter placement in the design.
I tried playing around with the CSS using developer tools but I'm still having trouble.
Is there a better way I could use to move the logo itself and maybe make it a big smaller inside the coral div? This is what I'm trying to do screenshot. *note: screenshot is from Figma but I'm trying to code what it looks like
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<!-- Faustina-->
<link href='https://fonts.googleapis.com/css?family=Faustina' rel='stylesheet'>
<!-- Didact Gothic -->
<link href='https://fonts.googleapis.com/css?family=Didact Gothic' rel='stylesheet'>
<!-- Encode Sans Semi Condensed -->
<link href='https://fonts.googleapis.com/css?family=Encode Sans Semi Condensed' rel='stylesheet'>
<!-- Stylesheet -->
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="parent">
<!-- Description -->
<div class="description">
<div class="d">DESCRIPTION</div>
</div>
<!-- Logo -->
<div class="logo">
<div class="logo-container">
<div class="box">
<div class="letter-c">C</div>
<div class="letter-p">P</div>
</div>
</div>
</div>
<!-- Navigation -->
<div class="tabs">
<nav>
<ul>
<li>About</li>
<li>Projects</li>
<li>Blog</li>
<li>Resume</li>
</ul>
</nav>
</div>
<!-- Icon -->
<div class="icon"> </div>
<!-- Contact-Footer -->
<div class="contact">
<footer>
<div class="icon-container"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="linkedin-icon">
<!--! Font Awesome Pro 6.1.1 by #fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z" /></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512" class="github-icon">
<!--! Font Awesome Pro 6.1.1 by #fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" /></svg>
</div>
</footer>
</div>
</body>
</html>
CSS
.parent {
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(5, 1fr);
grid-column-gap: 0px;
grid-row-gap: 0px;
}
/****************************************************************/
/* Logo */
.logo {
grid-area: 1 / 1 / 2 / 2;
background-color: lightcoral;
}
.logo-container {
margin: 20px;
width: 100px;
height: 100px;
left: 100px;
top: 56px;
}
.letter-c {
position: absolute;
width: 31px;
height: 63px;
left: 26px;
top: 8px;
font-family: 'Faustina';
font-style: normal;
font-weight: 400;
font-size: 50px;
line-height: 63px;
/* identical to box height */
color: #DEC3C3;
-webkit-text-stroke: 2px white;
}
.letter-p {
position: absolute;
width: 27px;
height: 66px;
left: 47px;
top: 29px;
font-family: 'Didact Gothic';
font-style: normal;
font-weight: 400;
font-size: 50px;
line-height: 66px;
/* identical to box height */
color: #FFFFFF;
}
.box {
position: absolute;
width: 100px;
height: 100px;
left: 0px;
top: 0px;
background: #DEC3C3;
}
/****************************************************************/
/* Navigation */
.tabs {
grid-area: 1 / 2 / 2 / 6;
background-color: lightgreen;
}
ul {
list-style: none;
text-align: right;
margin: 20px;
}
li {
display: inline-block;
padding: 0px 10px;
font-family: 'Encode Sans Semi Condensed';
font-style: normal;
font-weight: 500;
font-size: 18px;
color: black;
}
/****************************************************************/
/* Description */
.description {
grid-area: 2 / 1 / 5 / 3;
background-color: red;
}
/****************************************************************/
/* Icon */
.icon {
grid-area: 2 / 3 / 5 / 6;
background-color: lightblue;
}
/****************************************************************/
/* Contact-Footer */
.contact {
grid-area: 5 / 1 / 6 / 6;
background-color: lightseagreen;
}
svg {
position: absolute;
width: 32px;
height: 32px;
color: #DEC3C3;
}
footer {
position: absolute;
width: 200px;
height: 50px;
left: 620px;
top: 942px;
}
.icon-container {
position: absolute;
width: 200px;
height: 50px;
left: 0px;
bottom: 0px;
background: rgba(222, 195, 195, 0.2);
border-radius: 30px;
}
.github-icon {
left: 132px;
bottom: 10px;
}
.linkedin-icon {
left: 42px;
bottom: 10px;
}
Make the following changes to .logo-container {...}:
Inside .logo-container {...}, include position: relative (to make absolute postioning of .box with respect to it, work). Then remove the margin, left and right values.
The margin property isn't necessary in .logo-container since it will cue its margins from the grid placement of its parent .logo.
The left and right properties aren't needed as well for the same reason as above (and also since, setting position: relative produces defaults of top: 0 and left: 0); remember, you are trying to position the .box div which houses the letters, not .logo-container itself. You should rather position .box from its own rule set.
If you need padding around .logo-container set it within its parent: .logo
Here's what .logo-container rule should look like:
.logo-container {
position: relative;
width: 100px;
height: 100px;
}
.box {
// Position me (w/ margin, left and right) from here instead
// if you wish to.
}
.logo {
...
// put padding around .logo-container here.
}
And Voilà! Problem fixed!
If you want the .parent div to take the full height of the viewport (i.e screen), you may set height: 100vh in its CSS rule:
.parent {
...
height: 100vh;
}
Alternatively (much better way):
html,
body {
height: 100%;
}
.parent {
height: 100%;
}
If you need to remove browser default box-sizing, margin and padding properties, then add this rule set at the top of your CSS file or section:
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}

How to set element to the right in html?

I'm trying to set the toggle buttons to the right. float, right : 0, align-self is not working for me.
What am I doing wrong ?
The picture is at the end.
HTML:
<div if:true={showCards} class='main-container'>
<div class="main-container-top">
<p class="currs-available"> {trainingPlans.length} {headerLabel} </p>
<lightning-input
class="search slds-p-vertical_small"
type="search"
onchange={handleSearch}
variant="label-hidden"
placeholder="Search" >
</lightning-input>
<c-toggle-button
class="toggle"
buttons={toggleData}
ontoggleswitch={handleToggleSwitch}
default=1>
</c-toggle-button>
</div>
.............
......
.....
and relevant CSS:
.main-container{
background: #f5f5f5;
}
.main-container-top{
display: flex;
}
.currs-available{
width: 33%;
font-size: 20px;
font-weight: 700;
padding: 9px 0 0 20px;
}
.toggle{
width: 33%;
}
Image of element
You can use position: absolute; if you're using right: 0;
Although, the display: flex; will be ignored

Div background color not updating

I have the folowing structure:
.wrapper{
position: relative;
margin: 20px;
}
#bottomBar{
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -40;
}
#percentageText{
position: absolute;
z-index: 9;
margin-top: 37px;
left: 20px;
background-color: red;
}
<div class="wrapper">
<div class="ldBar"
data-type="fill"
style="margin: 0 auto;"
id="bottomBar"
data-fill-dir="ltr"
data-path="M10 10 H 790 V 90 H 10 L 10 10 M10 10 A 5 5 0 0 0 10 90 M 790 10 a 5 5 0 0 1 0 80"
data-fill-background="rgba(0, 0, 0, 0.0)"
data-fill="red"></div>
<div id="percentageText"></div>
</div>
the text in percentage text is controlled by a JS script that works. I want to change the background of the div where the text is
However background-color does nothing whatsoever to the div of the text.
What am i doing wrong?
set height and width for your div and test it again!you can use below css.
.wrapper{
position: relative;
margin: 20px;
}
#bottomBar{
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -40;
}
#percentageText{
position: absolute;
z-index: 9;
margin-top: 37px;
left: 20px;
background-color: red;
height:100px;
width:100%;
}
<div class="wrapper">
<div class="ldBar"
data-type="fill"
style="margin: 0 auto;"
id="bottomBar"
data-fill-dir="ltr"
data-path="M10 10 H 790 V 90 H 10 L 10 10 M10 10 A 5 5 0 0 0 10 90 M 790 10 a 5 5 0 0 1 0 80"
data-fill-background="rgba(0, 0, 0, 0.0)"
data-fill="red"></div>
<div id="percentageText"></div>
</div>
You are changing the background color of the div #percentageText.
Your color red is not showing because the div is empty. Try adding some text inside #percentageText, or increase the width of the element, and your color will become visible.
Looks like there is a bug in HTML classes. Try the same thing using an ID instead of a class. I had the same problem. Classes did not work. An ID did. If this is indeed a bug in HTML (JS, CSS), it needs to be fixed urgently.

HTML CSS stop watch

I was trying to style and align the header with
(i) stop watch to the right along with "Login" link,
(ii) the logo to the left along with a link to "Home" and
(iii) the content with logo and form would be in the center in body part.
Tried to float and align but it just messed up, could not find what I am making error new bee here, any help will be appreciated thank you.
**update: Have been trying to debug, it looks like
html code for header messes up the layout of the header and
while refreshing it looks like something is overlapping the style.
The header format look to be overlapped with some styling
but could not find the exact error and any help is appreciated. Thank You**
HTML CODE for header
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<%= link_to image_tag("images.jpeg", alt: "Logo"),
id: "logo" %>
<nav>
<ul class="nav navbar-nav pull-left">
<li><%= link_to "Home", root_path %></li>
<ul class="nav navbar-nav pull-right">
<li><%= link_to "Log in", users_path %></li>
</ul>
<ul class="nav navbar-nav pull-right">
<li> <!-- Lets make a simple stopwatch using CSS3 -->
<!-- Time for the markup -->
<!-- The core logic is a simple div containing numbers being moved
using keyframe animations. The numbers have space between them so that they
can be aligned vertically easily by reducing the container width. Lets
wrap up the 'numbers' in a cell to display only 1 digit-->
<!-- We will replicate the digits now -->
<div class="container">
<!-- time to add the controls -->
<input id="start" name="controls" type="radio" />
<input id="stop" name="controls" type="radio" />
<input id="reset" name="controls" type="radio" />
<div class="timer">
<div class="cell">
<div class="numbers tenhour moveten">0 1 2 3 4 5 6 7 8 9</div>
</div>
<div class="cell">
<div class="numbers hour moveten">0 1 2 3 4 5 6 7 8 9</div>
</div>
<div class="cell divider"><div class="numbers">:</div></div>
<div class="cell">
<div class="numbers tenminute movesix">0 1 2 3 4 5 6</div>
</div>
<div class="cell">
<div class="numbers minute moveten">0 1 2 3 4 5 6 7 8 9</div>
</div>
<div class="cell divider"><div class="numbers">:</div></div>
<div class="cell">
<div class="numbers tensecond movesix">0 1 2 3 4 5 6</div>
</div>
<div class="cell">
<div class="numbers second moveten">0 1 2 3 4 5 6 7 8 9</div>
</div>
<div class="cell divider"><div class="numbers">:</div></div>
<div class="cell">
<div class="numbers milisecond moveten">0 1 2 3 4 5 6 7 8 9</div>
</div>
<div class="cell">
<div class="numbers tenmilisecond moveten">0 1 2 3 4 5 6 7 8 9</div>
</div>
<div class="cell">
<div class="numbers hundredmilisecond moveten">0 1 2 3 4 5 6 7 8 9</div>
</div>
</div>
<!-- Lables for the controls -->
<div id="timer_controls">
<label for="start">Start</label>
<label for="stop">Stop</label>
<label for="reset">Reset</label>
</div>
</div>
<!-- Lets load up prefixfree first -->
<script src="http://thecodeplayer.com/uploads/js/prefixfree.js" type="text/javascript"></script>
</nav>
</header>
</li>'
CSS CODE
/* mixins, variables, etc. */
$gray-medium-light: #eaeaea;
#mixin box_sizing {
-moz-boz-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* universal */
html {
overflow-y: scroll;
}
body {
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #167EA8), color-stop(1, #0E0754) );
background:-moz-linear-gradient( center top, #167EA8 5%, #0E0754 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#167EA8', endColorstr='#0E0754');
background-color:#167EA8;
color:#FFFBFA;
font-size: 12px;
font-weight: bold;
}
section {
overflow: auto;
}
textarea {
resize: vertical;
}
.center {
text-align: center;
h1 {
margin-bottom: 10px;
}
}
/* header */
#logo small{
float: left;
margin-right: 2px;
font-size: 1.0em;
color: white;
text-transform: uppercase;
letter-spacing: 3px;
padding-top: 15px;
font-weight: bold;
&:hover {
color: white;
text-decoration: none;
}
}
* {margin: 0; padding: 0;}
.container {
padding: 100px;
text-align: center;
}
.timer {
padding: 10px;
background: linear-gradient(top, #222, #444);
overflow: hidden;
display: inline-block;
border: 7px solid #efefef;
border-radius: 5px;
position: relative;
box-shadow:
inset 0 -2px 10px 1px rgba(0, 0, 0, 0.75),
0 5px 20px -10px rgba(0, 0, 0, 1);
}
.cell {
/*Should only display 1 digit. Hence height = line height of .numbers
and width = width of .numbers*/
width: 0.60em;
height: 40px;
font-size: 50px;
overflow: hidden;
position: relative;
float: left;
}
.numbers {
width: 0.6em;
line-height: 40px;
font-family: digital, arial, verdana;
text-align: center;
color: #fff;
position: absolute;
top: 0;
left: 0;
/*Glow to the text*/
text-shadow: 0 0 5px rgba(255, 255, 255, 1);
}
/*Styles for the controls*/
#timer_controls {
margin-top: -5px;
}
#timer_controls label {
cursor: pointer;
padding: 5px 10px;
background: #efefef;
font-family: arial, verdana, tahoma;
font-size: 11px;
border-radius: 0 0 3px 3px;
}
input[name="controls"] {display: none;}
/*Control code*/
#stop:checked~.timer .numbers {animation-play-state: paused;}
#start:checked~.timer .numbers {animation-play-state: running;}
#reset:checked~.timer .numbers {animation: none;}
.moveten {
/*The digits move but dont look good. We will use steps now
10 digits = 10 steps. You can now see the digits swapping instead of
moving pixel-by-pixel*/
animation: moveten 1s steps(10, end) infinite;
/*By default animation should be paused*/
animation-play-state: paused;
}
.movesix {
animation: movesix 1s steps(6, end) infinite;
animation-play-state: paused;
}
/*Now we need to sync the animation speed with time speed*/
/*One second per digit. 10 digits. Hence 10s*/
.second {animation-duration: 10s;}
.tensecond {animation-duration: 60s;} /*60 times .second*/
.milisecond {animation-duration: 1s;} /*1/10th of .second*/
.tenmilisecond {animation-duration: 0.1s;}
.hundredmilisecond {animation-duration: 0.01s;}
.minute {animation-duration: 600s;} /*60 times .second*/
.tenminute {animation-duration: 3600s;} /*60 times .minute*/
.hour {animation-duration: 36000s;} /*60 times .minute*/
.tenhour {animation-duration: 360000s;} /*10 times .hour*/
/*The stopwatch looks good now. Lets add some styles*/
/*Lets animate the digit now - the main part of this tutorial*/
/*We are using prefixfree, so no need of vendor prefixes*/
/*The logic of the animation is to alter the 'top' value of the absolutely
positioned .numbers*/
/*Minutes and Seconds should be limited to only '60' and not '100'
Hence we need to create 2 animations. One with 10 steps and 10 digits and
the other one with 6 steps and 6 digits*/
#keyframes moveten {
0% {top: 0;}
100% {top: -400px;}
/*height = 40. digits = 10. hence -400 to move it completely to the top*/
}
#keyframes movesix {
0% {top: 0;}
100% {top: -240px;}
/*height = 40. digits = 6. hence -240 to move it completely to the top*/
}
/*Lets use a better font for the numbers*/
#font-face {
font-family: 'digital';
src: url('http://thecodeplayer.com/uploads/fonts/DS-DIGI.TTF');
}
Body part, Home Page
<% provide(:title, "Home") %>
<div class="center jumbotron">
<h1><%= link_to image_tag("logoo.jpg", alt: "Logo") %></h1>
<h2>
Interviewer Name <%= text_field_tag('input_second', 'First Middle Last Name', class: 'input-large') %>
</h2>
<h2>
Interviewee Name <%= text_field_tag('input_second', 'First Middle last Name', class: 'input-large') %>
</h2>
<h2>
Date <%= text_field_tag('input_second', 'mm/dd/yyyy', class: 'input-large') %>
</h2>
<%= link_to "Begin Interview Now", about_path, class: "btn btn-lg btn-primary" %>
</div>

Unexpected Whitespace in DIV

I am going nuts with a whitespace problem inside a div. Two of my divs have unexplained whitespace but a third similar one has none. When I use the compatability mode of IE8 the whitespace disappears so I am guessing it is something to do with the CSS but for the life of me I can't seem to see what.
The page causing the issue is at http://www.infinitedreamers.co.uk/blog/
I have made one of the divs background white to show what I mean.
The snippet of the page is as follows:
<div id="id_front_main">
<div id="id_front_top">
<div id="id_front_top_title">
<h2>Latest Gallery Images</h2>
</div><!--#id_front_top_title-->
<table id="id_gallery_latest"><tr><td width="25%"><img src="http://www.infinitedreamers.co.uk/cpg132/albums/userpics/10001/thumb_Fae4.jpg" height="100" width="86" alt="Contemplation"/><p class="id_title">Contemplation</p></td><td width="25%"><img src="http://www.infinitedreamers.co.uk/cpg132/albums/userpics/10001/thumb_Fae6.jpg" height="100" width="100" alt="Emo Fae"/><p class="id_title">Emo Fae</p></td><td width="25%"><img src="http://www.infinitedreamers.co.uk/cpg132/albums/userpics/10001/thumb_IOTPM.jpg" height="100" width="88" alt="Invasion of the Saucer-Plushies"/><p class="id_title">Invasion of the Saucer-Plushies</p></td><td width="25%"><img src="http://www.infinitedreamers.co.uk/cpg132/albums/userpics/10001/thumb_StarPlushies.jpg" height="100" width="84" alt="Star Plushies"/><p class="id_title">Star Plushies</p></td></tr></table>
<div id="id_front_top_meta">
</div>
</div><!--#id_front_top-->
<div id="id_front_main_holder">
<div id="id_front_left">
<div id="id_front_left_title">
<h2>3d Art Latest</h2>
</div><!--#id_front_left_title-->
<div class="id_latest_posts">
<h3>Getting Started in 3d Art for free</h3>
<span>
<p>You want to create 3d art on the PC or Mac? This is a quick guide on how to achieve this for free.</p>
</span>
</div><!--id_latest_posts-->
<div id="id_front_left_meta">
</div>
</div><!--#id_front_left-->
<div id="id_front_right">
<div id="id_front_right_title">
<h2>Software Latest</h2>
</div><!--#id_front_right_title-->
<div class="id_latest_posts">
<h3>Poser Files Database</h3>
<p>Poser Files Database is designed to aid in the cataloging of content for Poser, DazStudio, Vue, and other similar 3D tools. It can be used simply as a way to find a particular file or to provide detailed information about all products in one location.</p>
<h3>File Renamer</h3>
<p>FileRenamer is a simple batch file renaming utility.</p>
<h3>Database Documenter</h3>
<p>Database Documenter generates easy-to-read and detailed documentation for SQL Server 2000/2005 databases with a few simple clicks.</p>
</div><!--id_latest_posts-->
<div id="id_front_right_meta">
</div>
</div><!--#id_front_right-->
</div><!--#id_front_main_holder-->
</div><!--#id_front_main-->
<div class="clear"></div>
The CSS that applies is as follows:
#id_front_main
{
text-align: center;
width: 100%;
}
#id_front_top
{
width: 100%;
background: url(images/fcover.jpg);
background-repeat: repeat-y;
}
#id_front_top_title
{
width: 100%;
background: url(images/ftop.jpg);
background-repeat: no-repeat;
height: 70px;
}
#id_front_top_meta
{
background: url(images/fmeta.jpg);
height: 31px;
padding-top: 4px;
}
#id_front_main_holder
{
width: 100%;
margin: 0 0 0 0;
padding: 0 0 0 0;
}
#id_front_left
{
width: 45%;
float: left;
/*background: url(images/flcover.jpg);
background-repeat: repeat-y;*/
background: white;
margin-bottom: 5px;
margin-top: 10px;
padding: 0 0 0 0;
}
#id_front_right
{
width: 45%;
float: right;
background: url(images/flcover.jpg);
background-repeat: repeat-y;
margin-bottom: 5px;
margin-top: 10px;
padding: 0 0 0 0;
}
#id_front_left_title, #id_front_right_title
{
width: 100%;
background: url(images/fltop.jpg);
background-repeat: no-repeat;
height: 70px;
}
#id_front_left_meta, #id_front_right_meta
{
background: url(images/flmeta.jpg);
height: 31px;
padding-top: 4px;
}
#id_front_main h2, #id_front_left h2, #id_front_right h2
{
background: transparent;
font: 24px Georgia,century gothic, Arial, sans-serif;
font-weight:normal;
padding-top: 10px;
padding-bottom: 5px;
}
#id_front_left p, #id_front_right p
{
padding: 0 10px 0 10px;
text-align: left;
}
James :-)
The whitespace is caused by the top-margin of the h2 in the boxes. To solve it:
#id_front_main h2, #id_front_left h2, #id_front_right h2 {
...
margin-top: 0;
}
It is always a good idea to reset the styles you are using to avoid these kind of problems when looking at your site in different browsers. There are standard reset style-sheets that can help you with that like:
http://meyerweb.com/eric/tools/css/reset/
Even we faced the similar type of issue.
If you are showing one div at a time, then you can use the below solution:
document.getElementById('myDiv').style.display = 'none';
to the div which is larger in size than the current div shown.
This really works well with IE10 webkit, Chrome Webkit and Safari Webkit.
Cheers,
Ankit