how to: dynamic div width according to gallery content - css

http://portfolio.curiouslucious.com/?page_id=8
I'm trying to create a horizontal scrolling gallery (with a edited wordpress theme)
Currently, I have the nextGen Gallery plugin which manages all my images.
Right now, the only way I can get the images to display next to each other and scroll horizontally is to set the gallery width to something massive - 10000px
/* ----------- Gallery style -------------*/
.ngg-galleryoverview {
overflow: hidden;
margin-top: 10px;
width:10000px;
overflow: hidden;
clear:both;
display:inline-block !important;
}
/* ----------- Gallery style -------------*/
is there a way I can make the width change dynamically dependent on the number of images?
here is the stylesheet.css code
/* Blocks */
#container { width:1000px; margin:25px 60px; }
#left-box { float:left; width:270px; margin-right:65px; }
#sidebar { float:right; text-align:right; }
#sidebar ul { text-align:right; list-style:none; }
#sidebar h3 { font-size:1em; }
#sidebar small { font-size:0.7em; font-family:Arial, Helvetica, sans-serif; }
#author_note { font-size:0.85em; width:220px; padding:5px; border:1px solid #CDCDCD; float:right; text-align:right; }
#notes { width:600px; float:left; margin-top:20px; overflow-x:auto; overflow-y:hidden; height:500px; display:inline-block;}
#notes h1 { font-size:1.6em; font-weight:normal; margin:0; padding:0; }
#logo { float:right; margin-top:30px; }
#navigation { clear:right;float:right; width:270px; text-align:right; }
.copyright { margin-top:40px; color:#999999; }
.copyright a { color:#666666; text-decoration:underline; }
.copyright .theme { font-size:0.7em; font-family:Arial, Helvetica, sans-serif; }
.copyright .theme a { color:#999; text-decoration:none; }
.pages { margin-top:80px; font-size:1.1em; font-weight:200; }
.pages li { margin-top:5px; font-size:0.9em; }
.categories { margin-top:45px; font-size:0.85em; }
.links { margin-top:45px; font-size:0.85em; }
.navigation { margin-bottom:50px; font-size:0.85em; }
I'd prefer to avoid javascript if possible as I know I'm going to have huge issues implementing it. But any help would be appreciated.
Thank you!!

If you don't need to support IE7, then you can apply...
.theContent {
display: table;
}
.ngg-galleryoverview {
display: table-row;
float: none;
}
ngg-gallery-thumbnail-box {
display: table-cell;
float: none;
}
Then it will show up as you want to. There will still be some issues, but I'm sure you can take it from there.

I don't think what you're trying to do is possible with pure CSS. I whipped up a custom jQuery plugin that should work with your code.
Demo: http://jsfiddle.net/wdm954/KHT32/4/
I made this so it sets the dimensions dynamically based on the image with the greatest height and the sum of the width of all the images plus the margin-right (so you can add some space between them).
jQuery plugin code...
EDIT :: Fixes!
#scrollGal {
overflow-x: scroll;
overflow-y: hidden;
border: 1px solid black;
padding: 15px;
}
#scrollGal img {
float: left;
margin: 0px;
padding: 0px;
}
#scrollGal div {
margin: 0px;
padding: 0px;
}
#notes {
overflow-x: visible;
overflow-y: visible;
}
EDIT: Remove the "scrollGal" div from your HTML. Replace the JS with the following (the new code will wrap the appropriate div with the scrollGal div)...
(function( $ ){
$.fn.scrollGal = function() {
return this.each(function() {
$(this).wrap('<div id="scrollGal" />');
$sg = $(this).parent();
var obj = $(this).find('img');
var arr = $.makeArray(obj);
var w = 0, ww = 0, h = 0;
$.each(arr, function(i, val) {
w += $(this).width();
w += (parseInt($(this).css('marginRight')));
// find greatest width
var nw = $(this).width();
if (nw > ww) ww = nw;
// find greatest height
var nh = $(this).height();
if (nh > h) h = nh;
});
$sg.width(ww);
$sg.height(h);
$sg.children('div').width(w);
});
};
})( jQuery );
$('#ngg-gallery-1-8').scrollGal();

Related

Different css style for browser between sizes

I have a stylesheet for when #media screen and (max-width:639px)
When it is above 639px, it refers to my default CSS code which is what I want. But there are two elements I want to hide when the screen is below 667px.
In other words, when the screen is between 639px and 667px, I want the default CSS to show with two elements removed from it using .class{display:none}.
I tried min-width:666px, max-width:667px and several other variations but I can't get it to work.
Here's my blog:
Here's my css file: Link
body {
background-color:#CEDEAF;
color:#111530;
font-size:16px;
overflow-y:scroll;
margin:auto;
font-family:'Noto Sans', Arial, sans-serif;
line-height:2;
letter-spacing:1px
}
img, iframe {
border:none;
max-height:100%;
max-width:100%;
display:inline-block;
vertical-align:top;
padding:.75%
}
header {
text-align:center
}
a {
text-decoration:none;
color:#C33125
}
a:hover {
text-decoration:none;
color:#111530
}
h1, footer a {
color:#111530
}
footer a:hover {
color:#C33125
}
a:hover img {
opacity:.8
}
hr {
border:none;
height:1px;
background-color:#ddd
}
header img {
position:relative;
padding:0;
margin:auto;
nopin:nopin
}
.follow {
position:absolute;
top:.5%;
right:0;
margin-right:3%
}
#main {
margin:0 auto;
background-color:#fff;
width:95%
}
#Blog1 {
padding:1%
}
h1 {
margin:0;
font-size:1.3em;
text-transform:uppercase;
text-align:center;
margin-bottom:1%
}
.homelist {
text-align:center;
margin-top:-.75%
}
.homelist img {
width:30%
}
.left img {
float:left;
margin-right:20px
}
.center, .videopost, .breadcrumb, footer {
display:block;
text-align:center
}
.videopost img {
width:1px;
position:absolute
}
ul {
list-style-position:inside
}
.staticpagelist ul, .imagetextlist ul {
margin-left:-40px
}
.staticpagelist ul li, .imagetextlist ul li {
display:inline-block;
text-decoration:none;
padding:1.5%;
text-align:center;
vertical-align:top;
font-size:.8em;
width:30%
}
.staticpagelist ul li {
font-size:.85em;
font-weight:700
}
.sub {
margin:1% auto;
font-weight:700;
text-transform:uppercase;
padding:.75%;
border-top:1px solid #ddd;
border-bottom:1px solid #ddd
}
.hcard, .hcard a {
color:#aaa
}
.hcard, footer {
font-size:.7em;
font-weight:700
}
.breadcrumb {
font-size:.8em
}
.menu {
text-align:center;
font-weight:700;
padding-bottom:.5%
}
.related-posts-widget ul {
height:250px;
overflow:hidden
}
.related-posts-widget ul li {
width:13%
}
footer {
margin:1%
}
#media screen and (max-width:639px) {
h1, .sub {
font-size:.9em
}
header img, .homelist img, iframe {
width:90%
}
#main {
width:98%
}
.mobilesquish img, .staticpagelist ul li {
width:47%
}
.breadcrumb {
margin-bottom:2%
}
.follow, .related-posts-widget, .hcard, .remove {
display:none
}
}
Try this
#media screen and (min-width: 639px) and (max-width: 667px) {
//css here display: none
}
use following code
#media screen and (min-width: 639px) and (max-width: 667px) {
//css here display: none
}
#media screen and (max-width: 639px){
//write Css for screen less than 639px
}

How do I make this entire search box smaller?

I'm using a Wordpress theme with a MLS search box however the search box is too large for my client and they want us to reduce the size of this entire search box. I've been playing with it but to no avail. Any suggestions?
Site is http://shouldirentorbuyahome.com/
}
/*-------------------------------------
4.3 Advance Search
-------------------------------------*/
.advance-search-block { background:#F2F2F2; padding:5px 0 10px; position:relative; }
.advance-search-block label { display:block; font-weight:200; font-size:12px; color:#384042; margin-bottom:10px; }
.advance-search-block ul { width: 80%; }
.advance-search-block ul li { float:left; margin-right:15px; margin-bottom:15px; }
.advance-search-block input[type='text'] { font-size:10px; color:#777; padding:8px 8px 9px; width:75px; border:1px solid #E1E1E1; }
.advance-search-block select.small, .advance-search-block a.small { width:150px !important; }
.advance-search-block input[type='submit'] { background:#445064; color:#FFF; padding:8px 11px; font-size:12px; font-weight:200; cursor:pointer; }
.advance-search-block input[type='submit']:hover { background:#344053; }
.search-title { position:absolute; top:0px; }
.search-title h4 { background:#445064; padding:18px 25px; font-size:12px; font-weight:200; float:left; color:#FFF; margin-bottom:0; }
.search-title span { float:left; display:block; background:#88C354; color:#FFF; font-size:12px; padding:18px 20px; }
.advance-search-block.advance-search-block-page { background:none; padding:0; margin-top:-200px; }
.advance-search-block.advance-search-block-page .inside { background:#dcecce; background:rgba(220,236,206,0.8); padding:30px 30px 0; width:1020px; }
.advance-search-block.advance-search-block-page ul li { margin-right:15px; }
.advance-search-block.advance-search-block-page input[type="text"] { width:150px; }
.advance-search-block.advance-search-block-page .search-title { position:relative; top:0; }
.advance-search-block.advance-search-block-page .search-title h4 { background:none; padding:0; font-size:12px; color:#384042; }
.advance-search-block.advance-search-block-page .search-title span {
background:#445064; padding:4px 8px; margin-right:15px; border-radius:50%; -webkit-border-radius:50%; -moz-border-radius:50%;
}
You have
.advance-search-block.advance-search-block-page input[type="text"] { width:150px; }
Can't you just change the width of this element to something not as wide?
Suggest
.advance-search-block.advance-search-block-page input[type="text"] { width:60%; }
Give that a shot and I'm sure you know in wordpress you will need to manually update your styles.css.
If i'm not wrong you are talking about that blue button?
Your blue submit button has a div and it has a class 'dsidx-search-button search-form' with width of 1020px !important , reduce it to 250px !important as per your requirement.

background image transparency concern using div and css

Hi guys i'm using CSS and i'm still learning div in replace of Table and rows. I'm wondering whenever i attached a background image without background just plain image (transparent background) how come it shows a white background on the website outlook even though its background in photoshop is transparent? how do i remove the white background? please direct me to the right track. Thanks
i tried background-color:transparent; it's not working :(
This is my output image used on css div baclground-image http://postimg.org/image/75t1jgqk3/
THis is the view of image having transparent background in Photoshop http://postimg.org/image/o1jddulcx/
here's my css and html code http://jsfiddle.net/XpCmb/
#charset "utf-8";
/* CSS Document */
body
{
margin:0px;
padding:0px;
}
#container
{
padding:30px;
min-width:1024px;
min-height:768px;
background:#d8e0eb;
border:0px;
margin:0px;
}
#container2
{
width:1000px;
height:730px;
background-color:#FFF;
padding-top:25px;
padding-bottom:15px;
}
#wrapper
{
min-width:800;
min-height:600px;
}
#header
{
width:900px;
height:120px;
background-color:violet;
}
#menubar
{
background-color:#FFF;
width:452px;
height:30px;
padding-top:5px;
padding-bottom:5px;
text-decoration: none;
float:;
}
#content
{
width:1000px;
height:40px;
background-color:#f9f2e0;
}
#contentbody
{
width:1000px;
height:auto;
padding-top:50px;
margin-left:0;
margin-right:0;
background-color:#f9f2e0; /*baclground of content holder body */
padding-bottom:100px; /*adjust the space bottom of content holder text */
}
#contentbodytext
{
margin-left:50px;
text-align:left;
}
ul
{
list-style-type:none;
padding:0;
margin:0;
display:inline;
}
li
{
list-style-type:none;
background-color:#;
border-right:1px solid #CCC;
float:left;
padding-left:30px; /*adjust space of menu text to each other*/
padding-right:30px;
padding-top:8px;
padding-bottom:8px;
}
a:link
{
text-decoration:none;
} /* unvisited link */
a:visited {text-decoration:none;
} /* visited link */
li:hover
{
background-color:#ffd640;
}
ul#mcolor li:hover > a
{
background-color:#ffd640; <!-- sets all link color when hovering to yellow -->
}
ul#mcolor li.active a
{
color: rgb(25, 25, 25);
background-color: #ffd640;
}
#mcolor li.active {
background: none repeat scroll 0 0 #ffd640 !important;
}
/*FOLLOWS ARE MISCELLENEOUS LIKE DIVS image holder etc. */
/*ul:hover li
{
opacity: 0.5;
}
ul li:hover
{
opacity: 1;
}
nk */
#image1
{
padding-left:50px;
float:left;
}
#p1a
{
padding-left:350px;
}
#introductiona
{
padding-right:50px;
text-align:justify;
text-align:justify;
}
#p1
{
margin-left:50px;
text-align:left;
margin-top:70px;
}
#bulletin
{
float:left;
margin-left:10px;
background-image:url(bulletinboard.jpg);
background-size:550px 260px;
background-repeat:no-repeat;
width:550px;
height:260px;
background-color:#f9f2e0;
}
Your image is saved as a jpg, which does not save transparency. Save your image as a PNG or a GIF with transparency and you should fix your problem.

Styling for Mobile; "Choose File" Button Too Small in iOS 6

I'm currently working on styling a couple of simple form pages originally written in ASP.NET for mobile. I'm using media detection in CSS3 to determine if the device is mobile, and if it is, I basically make everything look bigger. This has worked so far in most of the phones I've tested, but in iOS6, the "choose file" button stubbornly refuses to get bigger like every other element. I've tried styling it by its ID or just through all inputs, and while I can change the color or the font, the size never changes. How can I make the choose file button look bigger?
My CSS page:
#import url(master.css);
/* --- page wrapper --- */
#wrapper { width:80%; margin:auto; max-width:1200px; position:relative; border:1px solid #000; background-color:#000; }
#main { width:100%; height:100%; border-bottom:1px solid #000; }
#content { height:100%; background-color:#CDCCCC; padding: 20px 50px 20px 50px; }
#login { text-align:center; }
#upload { padding:10px; }
#list { display: inline; width: auto; height: auto; }
#logoutButton { display: inline; float: right; }
#guidelines {
text-align:justify;
}
#flash {
padding: 20px;
}
#media only screen and (max-width: 720px), only screen and (max-device-width: 720px) {
#logoutButton {
display: inline;
float: right;
}
#guidelines {
background-image:url(http://cite.nwmissouri.edu/PhotoContest_MobileApp/transparentbg4androidwidthbug.png);
background-repeat:repeat;
text-align:inherit;
height:100%;
background-color:#CDCCCC;
}
#hwrapper {
width:initial;
}
#contentum {
height: 100%;
width:inherit;
background-color:#CDCCCC;
text-align:inherit;
font-size:40px;
padding-right: 5px;
}
input {
font-size:40px;
height:inherit;
width:inherit;
}
select {
font-size:40px;
height:auto;
width:inherit;
}
#upload {
font-size: 40px;
text-align: start;
height: 100%;
width: 100%;
padding-right: 12px;
}
#wrapper {
width:inherit;
height:inherit;
margin:auto;
position:inherit;
border:1px solid #000;
background-color:#000;
overflow:scroll;
}
li {
font-size: 40px;
text-align: start;
}
}
If I understand, you want the file upload (<input type="file"/>) button to display larger?
You should be able to use the following (non-standard) psuedo-element selector for WebKit:
input[type="file"]::-webkit-file-upload-button {
/* add styles here, such as width, height etc. */
}
You can do the same in IE10 using (a similarly non-standard):
input[type="file"]::-ms-browse {
/* add styles here, such as width, height etc. */
}

CSS Horizontal sub menu - IE 6,7 both dont working, tried with whatever hover

I'm not expert about css menus. But I know basic system to make css menu.
I used this system before and works, but this time it is not working.
The site is http://www.uniethos.com. Please check this site
This menu works with all other latest Browsers. But not with IE 6 & 7. I know IE6 don't support hover except anchor. So before I was using Whatever Hover. But this time it is not working and even with IE7. I don't know why its happening. May be there could be some problem with my css. Please check the css.
If you don't have IE 6 or 7 installed you can run one from http://spoon.net/browsers/. Require to install one plugin.
The CSS I'm using for the menu is
.glossymenu{
background: #B4B3B3;
height: 30px;
width: 100%;
padding: 0;
margin: 0;
display:inline-block;
position:relative;
}
.glossymenu ul
{
list-style: none;
padding: 0px;
margin: 0;
padding-left: 0px;
}
.glossymenu li ul
{
display:none;
position:absolute;
width: 80%;
top:30px;
left:0px;
background-color:#5B0C10;
border:0px;
z-index: 99;
}
.glossymenu li li a
{
padding: 0px 10px 0px 10px;
}
.glossymenu li li a:hover
{
background : #871016;
}
.glossymenu li{
float:left;
padding: 0;
}
.glossymenu li a{
float: left;
display:block;
position:relative;
color:#FFF;
text-decoration: none;
font-family: sans-serif;
font-size: 13px;
font-weight: bold;
padding:0 0 0 16px; /*Padding to accomodate left tab image. Do not change*/
height: 30px;
line-height: 30px;
text-align: center;
cursor: pointer;
}
.glossymenu li a b{
float: left;
display: block;
padding: 0 24px 0 8px; /*Padding of menu items*/
}
.glossymenu li.current a, .glossymenu li a:hover{
color: #FFF;
background: #5B0C10;
background-position: left;
text-decoration: none;
}
.glossymenu li a:visited{
text-decoration: none;
}
.glossymenu ul li:hover ul
{
display: block;
}
Well I didn't found the problem. But I fixed the menu with custom Javascript code.
sfHover = function() {
var sfEls = document.getElementById("glossymenu").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" over";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" over\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
People those are also facing the same problem may find this helpfull.
Thanks.
Ofcourse whatever:hover is best. But I don't know why that was not working.
If you face the same problem, you can use this javascript. But you have to understand the code.
sfHover = function() {
// You may have to change the "glossymenu" id with your one
var sfEls = document.getElementById("glossymenu").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" over";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" over\\b"), "");
}
} } if (window.attachEvent) window.attachEvent("onload", sfHover);
In my case, I have a div id named "glossymenu". You have to change this with your id.
And also have to declare another CSS class named "over".
In my case -
.glossymenu li:hover ul, .glossymenu li.over ul
{
display: block;
}
This is enough for one level dropdown menu. You don't need whatever:hover if its ok with you.

Resources