Posts adjust Size and location. CSS - html

I am having an issue making an HTML page where I put posts of images of different sizes. Image width needs to be the same and height will be different. When the top post image is a smaller height I want the lower post image to move up to cover the blank space. You can better understand by looking at the below images:
This is what I made
(Check links of images please)
http://i.stack.imgur.com/An2ca.png
This is what I want
http://i.stack.imgur.com/dQzFH.png
I hope you can understand now.
My CSS code is below:
.posts{
width:80%;
max-width:951px;
min-height:990px;
border:0px solid black;
float:right;
margin-left:10px;
}
.post{
width:300px;
min-height:100px;
float:left;
margin-left:10px;
margin-top:10px;
border:0px solid green;
vertical-align:text-top !important;
}
.post img{
width:100%;
max-width:290px;
height:auto;
transition:all 1s ease;
opacity:1.0;
}
.post img:hover{
opacity:0.7;
}

I recommend that you look first at the basics of what Flexbox does for you by going here: Flexbox. That aside you can try to play around by setting your image holding classes to use display: flex. Fair warning, if you do care about cross browser functionality, make sure flex is supported for the audience you're trying to capture. You can look here: can I use.
There are JS Libraries as suggested by the community (see your comments) that will leverage such functionality for you. I also will say that while these libraries may be robust, they will work as long as they achieve the functionality you desire, so take time to explore Masonry and Isotope to see if these provide a solution for you.
I also recently found a good read regarding Flex Box:
A Visual Guide to CSS3 Flexbox Properties box that you may find interesting and hopefully useful as well :)
Otherwise let us know, we will try to continue to help you if you need more assistance.

Related

how can i eliminate whitespace between navbar and main background div?

hoping you can help. It's been a long time since I've coded without frameworks and such so I am purposely using vanilla html and css as a refresher.
I have begun building a quick website prototype, and I cannot for the life of me figure out why there is whitespace underneath the navbar element and my background section, despite creating css rules specifically for a full viewport background. I want the background section to start directly after the navbar.
Note: In testing, it appears the styling issue is tied to the html and body element rules. I could set the color to match with my background section, but somehow I feel that might cause other problems later..or at least it feels like cheating. Is there another possible solution? Most importantly, WHY is this happening given the css rules I have set? Everything appears to be in order, and inspecting elements has not helped, unless I have overlooked something important.
I can get everything else functioning fine, but I prefer to build in chunks, so the example below will look messy.
Apologies for any sloppiness in my coding. I am primarily a graphic designer.
html, body {
margin:0px;
padding:0px;
border:0px;
background-color:white;
}
Full Codepen here:http://codepen.io/J_Davis/pen/RGLVPv
Thanks!
You can also set the margin-top of class bigBG to -20px;
like this:
.bigBG {
background:#FF5733;
min-height:100vh;
margin-top:-20px;
padding:0px;
}
Happy coding!
Add to your wrapper this props:
display: flex;
flex-direction: column;
It should look like this:
#wrapper {
display: flex;
flex-direction: column;
margin:0px;
padding:0px;
border:0px;
}
Here you have it working
Happy new year!!!

White bar bottom of webpage? Creating first site, from scratch for upcoming trip.

I was wondering if anyone could help with a problem I'm having on the site I'm creating for my upcoming travel plans. I have been following a Udemy web coding class, and know the basics of html, and css. Enough to make this website. If there's any tips or constructive criticism on my code I'd greatly appreciate it.
http://www.daltoninjapan.com is the live site. It seems to be at the bottom of all three pages and I think it might have something to do with either a Script, or my "TOP" button. Thanks.
Your question is poorly structured, but I think I deciphered what do you want to do. Instead of:
#topbutton {
float:right;
align:bottom-right;
width:45px;
height:45px;
background-color:gray;
border-radius:5px;
margin:10px 10px 40px 10px;
}
use this
#topbutton {
position:fixed;
bottom:0px;
right:0px;
width:45px;
height:45px;
background-color:gray;
border-radius:5px;
margin:10px 10px 40px 10px;
}
position:fixed will ensure that element is always at the same position and it takes the element out of flow. You can learn more about element positioning here: https://developer.mozilla.org/en-US/docs/Web/CSS/position.

Custom graphical border on DIV with CSS

Ok, so this is a problem that has been nagging me for a while and I've seen a few good and bad solutions to it. But what is the best solution, and what is the pitfalls, drawbacks and big "No, Nos".
What I want is to create dynamic, flexible DIV-blocks with a custom graphical border. For example a DIV-box with shadows, but not necessarily shadows.
UPDATED:
As, #Jeroen stated bellow in a comment, I am not only asking for "the best way to make shadows". Any crazy custom graphical border.
I know there are some solutions with CSS3 (box-shadow, border-image and border-radius), but it is not 100% cross-browser, specially not if you have to work with one or two versions old browsers.
Example image of what i want to achieve:
or
The example above is actually done with one method I use frequently. It does the job and it does meet all the requirements.
It adapts to different sized DIV-blocks.
It uses custom graphics.
It works cross-browser and versions.
It is pretty easy and fast to apply.
It is JavaScript free, 100% CSS/HTML.
...but of course there are a few cons:
It requires 8 images.
It requires 8 extra DIV-blocks with no real content.
Not very pretty in the source.
HTML DIV-block example:
<div class="flowBox">
<h1>Header 1</h1>
Vivamus tincidun...
<div class="border_t"></div>
<div class="border_b"></div>
<div class="border_l"></div>
<div class="border_r"></div>
<div class="border_br"></div>
<div class="border_bl"></div>
<div class="border_tr"></div>
<div class="border_tl"></div>
</div>
CSS example:
<style type="text/css">
<!--
.flowBox {
background:#FFFFFF;
margin:10px;
float:left;
padding:10px;
width:250px;
position:relative;
}
.border_t {
background:url(border_t.png) repeat-x;
position:absolute;
top:-2px; left:0;
width:100%;
height:2px;
}
.border_b {
background:url(border_b.png) repeat-x;
position:absolute;
bottom:-6px; left:0;
width:100%;
height:6px;
}
.border_l {
background:url(border_l.png) repeat-y;
position:absolute;
top:0; left:-3px;
width:3px;
height:100%;
}
.border_r {
background:url(border_r.png) repeat-y;
position:absolute;
top:0; right:-6px;
width:6px;
height:100%;
}
.border_br {
background:url(border_br.png);
position:absolute;
bottom:-6px; right:-6px;
width:6px;
height:6px;
}
.border_bl {
background:url(border_bl.png);
position:absolute;
bottom:-6px; left:-3px;
width:3px;
height:6px;
}
.border_tr {
background:url(border_tr.png);
position:absolute;
top:-2px; right:-5px;
width:5px;
height:2px;
}
.border_tl {
background:url(border_tl.png);
position:absolute;
top:-2px; left:-2px;
width:2px;
height:2px;
}
-->
</style>
As you can see, it perhaps isn't an optimal solution.
But is there a better way?
UPDATED: There is support for shadows in most browsers and versions, even if it is not one standard. Source using css-shadow: http://pastebin.com/LZHUQRW9
But my question relates not only to shadows.
Full source code: http://pastebin.com/wxFS2PHr
Have a look at http://css3pie.com
This will allow you to use CSS 3 elements in older browsers and should hopefully help to keep your markup cleaner.
You could also include some additional logic which will use CSS 3 for browsers that support it, and revert back to the CSS Pie functionality for other browsers.
You could try something like this: http://robertnyman.com/2010/03/16/drop-shadow-with-css-for-all-web-browsers/
I think there are many more libraries - JavaScript, .htc things, whatever... - to achieve the same.
Edit: I think you won't get around using 8 different pictures. But you could write a javascript that adds the required DIVs on the fly e.g. for each DIV with class border.
That would clean up your HTML markup - but the DOM remains complex..
Perhaps this article on css-tricks using border-image is what you're looking for? The interactive demo it links to seems to do what you ask for.
Of course this solution is only available in browsers that support css3 border-image. The demo above did work for me in FF and Chrome, but not in IE9. According to the Modernizr documentation it can be used to add support for border-image, but I haven't tried that for myself. Should that work then this would give you a relatively clean solution.

Why is the rendering of this CSS such a problem for IE 6?

I am rendering a small menu in the upper right-hand corner of a web site. There will always be a "Banner" graphic across the top of the page (1024x80 pixels) and the menu must render on top of it. In IE 7, IE 8, FireFox and Safari, the menu looks fine. In IE 6, however, the menu does appear sometimes and fails to appear at other times with no discernable pattern. In the CSS shown below, I placed the "z-index" in the class definitions after reading that this was a fix for some CSS problems of this type in IE 6. However, there is still no joy in Renderville. ANY help will be appreciated!
Here is the CSS defined for the page, the header and the menu:
Div.XPage { background-color: White; position:relative; width:1024px; border-left:1px solid #a4a4b1; border-right:1px solid #a4a4b1; margin:auto; text-align:left; z-index:10; }
Div.XHeader { background-color: White; clear:both; padding:0px; margin:0px; z-index:2; }
Div.XTopMenu { position:absolute; left:810px; top: 0px; width:214px; height:16px; background-color:#333333; z-index:3; }
Div.XTopMenuItem { width:70px; height:14px; margin-bottom:3px; text-align:center; float:left; }
Div.XTopMenuItem a { color: White; font-size:smaller; }
Here is the HTML that uses these CSS classes:
<div class="XPage">
<div class="XHeader">
<a href='/Home.aspx'><img src="/images/Header.png" alt="Banner Graphic" border="0" width="1024" height="80" /></a>
</div>
<div class="XTopMenu">
<div class='XTopMenuItem'><a href='/Home.aspx'>Home</a></div>
<div class='XTopMenuItem'><a href='/Calendar.aspx'>Calendar</a></div>
<div class='XTopMenuItem'><a href='/Logout.aspx'>Log Out</a></div>
</div>
...
</div>
IE6 has issues with z-indexing. In IE6 z-index is only respected for siblings.
Things I'd try:
Reverse the order of menu and header in the html
Give the header a negative z-index
Give the menu a more significant lead on z-index than the header, say z-index:999.
Failing those you could try giving IE6 a different header image that didn't cover up where you want the menu to go. In many cases I've strived for IE6 to have degraded support, it's an ancient browser and has way too many problems. So if it's an option I'd consider letting it have a slightly different appearance. Of course that may not be up to you.
z-index only works on positioned
elements (position:absolute,
position:relative, or position:fixed).
You do not have these on Div.XHeader thus that z-index is being ignored completely.
Read more about z-index on w3schools
No directly useful info, I'm afraid, just another suggestion in case you're sufficiently desparate:
Google has managed to solve this problem, and many more, in GWT. Hold off on the downvotes, please - I'm not sugesting rewriting the app in GWT. I am, however, recommending to look at their code. In their implementation of various components, they have sections, sometimes whole classes, dedicated to working around particular quirks in WebKit, Opera, IE6... Their code is very clear and well commented, often including not just "what" but also "why".
How effective this approach is will depend on how good you are at zeroing in on relevant code (in Java), understanding it and moving the implementation of the essentials to your own code.
Why z-index 10 for the Page? It's supposed to be way in the background, right? Could you try setting its index to 0 or 1?

Footer knocked out by 1px in IE6

Heres the link:
DAMNIE6TOHELL
As you can see if viewed in glorious 'IE6-o-color', the footer is shifting 1px over to the left.
I'm struggling to find a fix for this, I've whittled it down to a bare minimum of HTML.
Is it something to do with haslayout perhaps? Any help much appreciated.
This looks like it's a case of the IE6 1px jog which can be solved by a few different fixes.
You will only want to apply these fixes to IE6, using your favourite method (conditional comments, star html hack, whatever). You could
apply background position to #container_bottom
container_bottom { background-position:1px 0; }
apply a left margin or padding to #container_bottom
container_bottom { margin-left:1px; }
or float #container_bottom to the left and give it a width
container_bottom { float:left; width:800px; }
Any of those seemed to work for me.
Add
background-position: 50% top;
to the css of container_bottom.
It works for me with IE Developer toolbar, but it's on a IE6 Virtual machine, so I'm not sure about real world results