Making two DIVs the same height - css

I would like to have the #textblock div to have at the same hight as #brevillestandard div.
CSS:
#textblock {
width: 260px;
border: 1px solid #999999;
padding: 0 5px;
float: right;
font-size: 95%;
background-color: #FEF4CC;
}
#brevillestandard {
padding: 8px 0 0 5px;
height: 80px;
Width: 61%;
border: 1px solid #999999;
float: left;
margin: 5px 5px 5px 0;
}

The answer is literally in the question.
You're giving #brevillestandard a height of 80px.
Add:
height: 80px;
to any other elements you want to be the same height.

Are they not the same height when you set the height in the CSS for both of them?
Perhaps it's the different padding that is causing the difference in their appearance?
If you make the CSS identical, do the two divs look the same? That might be one place to start. Or apply the same CSS class to both, and see if they look the same then.

Related

CSS Borders and border-radius for text

I came across this trick when I wanted to feature some headline text. I love the look of it as was wondering if there was a way to have the ends point up.
.pagebreaker {
padding: 10px;
margin-bottom: -5px;
border-top: 4px solid #f6d241;
border-radius: 35px;
}
ref Image:
I've tried negative border-radius and negative padding. Is there something I am missing here? Or is this something that can't be done?
Thanks.
Use border-bottom
.pagebreaker {
padding: 10px;
margin-bottom: -5px;
border-bottom: 4px solid #f6d241;
border-radius: 35px;
width: 300px;
height: 10px;
}
<div class="pagebreaker"></div>

Why won't my negative margins go above a certain area?

Here is the jsfiddle for reference: http://jsfiddle.net/4devvjyv/1/
I'm trying to get the "Section" box to go above the gray line so that it looks like the "Section" box is centered around the line. But negative margins are not pushing the box above the line.
.divider {
margin-top: 6px;
border-top: 2px solid gray;
font-size: 10px;
position: relative;
}
.divider-text {
position: relative;
border: 1px solid black;
background-color: white;
display: inline-block;
padding: 0px 5px;
margin-top: -200px;
}
The divider is the line, and the divider-text is the "Section" box. I put a margin-top of 6px for the divider just so I wouldn't mess up the spacing between the two content because I would like the "Section" box to be 6px above the line and 8px below the line.
Does anyone know why it's not working? I tried playing around with a negative left margin and the "Section" box behaved as it should.
Updated your jsfiddle
Use top: -20px instead of margin-top:-200px. I've use -20px because -200px will float way high and cannot be seen.
.divider-text {
position: relative;
border: 1px solid black;
background-color: white;
display: inline-block;
padding: 0px 5px;
top: -20px;
}
another solution would be
.divider-text {
position: absolute;
border: 1px solid black;
background-color: white;
display: inline-block;
padding: 0px 5px;
margin: -20px; // making it center.
}
releasing the element from it's parent element (position: absolute) will make the element float, does following the negative margin.
The element is still under its parent element so any floating styles will not go beyond its parent element unless you free it by, float, position:absolute, or display:block. But display block does not actually release the element from its parent but moves it to the next. -- need anyone's input on this though.

Four boxes side-by-side with css

I want to make four equal boxes with 10 small (thumb) boxes in each. How can this be done with css? Here is the image of what is the goal.
So far I have the left column box
.left_column{
margin-top: 10px;
width: 150px;
float: left;
border:2px solid #ccc;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
text-align: left;
padding: 10px;
font-size: 14px;
background-color: #f0f0f0;
color: #888;
}
.left_column p {
text-align: center;
border-bottom: 1px solid #ccc;
font-size: 20px;
}
.left_column a {
text-decoration: none;
margin-left: 10px;
}
edit:
Here is the Fiddle
You could create a container for each of the boxes with a fixed width and then put the thumbnails inside. If you use float: left; on the container boxes then they will move depending on the window size.
I can just suggest to use flex box.
It has only support for newer browsers but its actually totally easy to use and its responsive. Here is a small explanation:
http://css-tricks.com/snippets/css/a-guide-to-flexbox/
The inner content could be simple created then by float:left; and display: inline-block;
Here is an example on jsfiddle:
http://jsfiddle.net/fpuwk7dL/

Display two rows of six columns and have them shrink

I'm try to display two rows of six columns and have them shrink when the browser window shrinks. The original css displays number of columns depending on the image size, each image floating left, so for different screen sizes I end up with large spaces.
.ngg-albumoverview {
overflow: hidden;
margin-top: 1px;
margin-left: 0px;
width: 100%;
clear:both;
display:block !important;
}
.ngg-album {
float:left;
height: 100%;
padding: 0px;
margin-bottom: 0px;
border: 0px solid #fff;
}
/* IE6 will ignore this , again I hate IE6 */
/* See also http://www.sitepoint.com/article/browser-specific-css-hacks */
html>body .ngg-album {
overflow:hidden;
padding: 0px;
margin-bottom: 0px;
border: 0px solid #cccccc;
}
.ngg-album {
overflow: hidden;
padding: 0px;
margin-bottom: 0px;
border: 0px solid #cccccc;
}
.ngg-albumtitle {
text-align: left;
font-weight: bold;
margin:0px;
padding:0px;
font-size: 1.4em;
margin-bottom: 0px;
}
.ngg-thumbnail {
float: left;
margin-bottom: 10px;
margin-right: 2px;
text-align: center;
font-weight:bold;
background-color:#0F0F0F;
-webkit-border-radius: 0px 0px 8px 8px;
-moz-border-radius: 0px 0px 8px 8px;
border-radius: 0px 0px 8px 8px
}
.ngg-thumbnail img {
background-color:#A9A9A9;
border:0px solid #1D1D1D;
display:block;
margin:4px 0px 4px 5px;
padding:4px;
position:relative;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
width:200px;
}
.more {
width: 100%;
background-color:#0F0F0F;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px
}
.ngg-thumbnail:hover {
background-color: #333333;
}
.ngg-thumbnail img:hover {
background-color: #FFFFFF;
}
.more:hover {
background-color: #333333;
}
.ngg-description {
text-align: center;
}
When I add this css to .ngg-albumoverview it displays six columns ok and shrinks them, but the second image is placed under the first, instead of alongside, with the third image alongside the first.
columns:100px 6;
-webkit-columns:100px 6; /* Safari and Chrome */
-moz-columns:100px 6; /* Firefox */
CSS columns are just segregations of the page and flow the same as the rest of the page. Your images are laid out like this:
[1][3][5]
[2][4][6]
because the flow of a page goes top to bottom and expands as necessary depending on element widths.
Your images will not be in the order you want unless you remove the columns and replace it with a responsive grid. If you want the images to appear like:
[1][2][3]
[4][5][6]
you need to adjust your .ngg-thumbnail widths to be a percentage (that incorporates the margin, border and padding spacing in between and adds up close to 100% between 3 of them), float them to the left and give your .ngg-thumbnail img a max-width: 100%; and height: auto;. Be sure to float the .ngg-thumbnail parent element and not the img or they will be removed from the document flow and not line up with the grid unless you perfectly size everything (and you don't want that).
Almost forgot - make sure you add a clear: left; on the 4th image if your widths don't add up to 100% so it starts on a new line by default. You can select the 4th image with:
.ngg-thumbnail img:nth-of-type(4);
Here is a good resource for you if you'd like an enjoyable way to learn more about this.

Two divs not aligning

I am not able to align my div named #time horizontally with another div named .content.
Click here for a live version of the website - https://dl.dropbox.com/u/73176512/InteractiveGuide/index.html
The time div is not aligning with the content div. Code can be viewed by right clicking and viewing source. Or I can paste it here if requested.
I am floating the #time div right.
Change your code with this,
.upper {
border-radius: 20px 20px 20px 20px;
float: left;
min-width: 1048px;
padding: 10px 0;
}
.content {
background-color: #FFF9EC;
border: 1px solid white;
border-radius: 20px 20px 20px 20px;
box-shadow: 5px 5px 10px 5px gray;
float: left;
margin: 10px 0;
min-width: 1024px;
padding: 10px;
}
Thanks...
Please remove padding Left and Right form .content
Thanks
Safder Jaffri
here is the solution enjoy just give your upper class min-width to 1070px
.upper
{
float:left;
padding: 10px;
border-radius: 20px 20px 20px 20px;
min-width: 1070px;
}
Add a negative right margin to #time, this way:
#time {
margin-right: -40px;
}
Give the #time div a margin-right of -22px (I just eyeballed this so check for sure)

Resources