How to add equal padding between buttons? - css

http://buttonspace.com/
I want to put equal space between the 4 buttons at the top, but I'm having trouble. At first the "social-buttons" id was in a DIV floating left, but that caused the slider to get pushed to the right.
So I changed everything to and now the padding style doesn't seem to have any effect.
I then tried adding "display: inline-block;" since I read that from another StackOverflow question but that didn't help.
Here's the current code (ignore the PHP):
<!-- Social Buttons -->
<span id="social-buttons">
<fb:like href="<?php echo $url; ?>" send="false" layout="box_count" width="60" show_faces="false" font="verdana" class="fb-like"></fb:like>
Tweet<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
<g:plusone size="tall" callback="callback" href="<?php echo $url; ?>" class="google-plus-one"></g:plusone>
<script src="http://www.stumbleupon.com/hostedbadge.php?s=5&r=<?php echo $url; ?>"></script>
</span>
<!-- End Social Buttons -->
#social-buttons { display: inline-block; padding: 0 0 0 100px; }
.fb-like { padding: 3px 0 0 0; border:none; overflow:hidden; width:60px; height:90px; }
.twitter-share-button { padding: 6px 0 0 0; }
.google-plus-one { display: inline-block; padding: 0 0 0 10px; }
Any ideas? Ideally I want the best suggestion to not only space the buttons evenly, but to use proper code for putting the buttons on that header bar in the first place ;) I'm sure my code could use lots of improvement.

Updated:
Something like this:
http://jsfiddle.net/MjFmN/1/
#social-buttons div,
#social-buttons iframe {
float:left !important;
display:inline-block !important;
margin:0 10px 0 0 !important;
border:none;
overflow:hidden;
}
.fb-like {
width:50px!important;
}
Please note that the Google+ button doesn't appear in the Fiddle. I did test it with the actual Google+ html that the script generates and it appears to work for me on Firefox8, Window 7.
You can leave the HTML you have like it is now for this to work.
Another edit:
Just tried it in IE9, for some reason the FaceBook button displays in my local language causing the width to change and thus you only see part of the image ( overflow:hidden and all that ). If you can force a language setting on the FaceBook button this is solvable, but I have no experience with it to say if that is or isn't possible.
http://forum.developers.facebook.net/viewtopic.php?id=58989 seems to have some tips on how to do that.

This is not really the answer, but might help a bit down the road:
No block elements in inline elements (you have the and inside it some divs etc. make it a div).
Validation:
try fixing the validation (though most of it is probably the fb stuff):
http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fbuttonspace.com%2F
Try reducing the problem to the bare minimum. Eg. make a page with just the header part in it. and remove as much html as you can, with the error still there. then try to fix it from there. sometimes it's hard to see if the problem is really an issue from some faulty css/html before it.
The different boxes are styled differently (or at least they have different classes etc.) Try unifying it. Thought maybe the boxes are made with some javascript (I'm not sure, I haven't used thoses boxes before)?
Try doing this, with just some colored divs and see if you can make them be padded properly, then switch to the social buttons one by one.
I hope this can help you get started.
Edit: I think the problem is the FB button... try removing that or looking at the .fb_iframe_widget class there.

Related

Z-Index does not work on my Magento Theme

i have a problem with z-index on my webpage, i need move shopping bottons to the top -100px but when i try it the button loose the actions not work anymore, i try to use z-index: 99999 but not work too, i need some help! here my page link limitx.panamerik.net
----IMAGES-----
This is the real image:
I need make this:
You're using top value in negative that means there could be problems with the followings:
the parent div is set to overflow:hidden; and don't show the element i.e. hide the element going behind the parent div. (remove overflow:hidden from the parent)
z-index value is not working? You didn't explicitly declared the position. (set position:relative or absolute)
UPDATE: After looking at your screen shots again I realized that you want to display the button to the right of the product images. I'm not sure if this is a good idea, because this theme is meant to be responsive.
But if you really, really, really want to do this then you may try to add the following <CSS> to your custom.css file:
#media only screen and (min-width: 768px) {
.products-grid .actions {
margin: 0;
position: absolute;
top: 100px;
right: -25px;
}
.owl-wrapper {
z-index: 1;
}
.slider-arrows1 .owl-controls .owl-buttons .owl-prev, .slider-arrows1 .owl-controls .owl-buttons .owl-next {
z-index: 2;
}
}
This will work as you can see in the screen shot below, when hovering the button.
I have added #media only screen and (min-width: 768px) because of the responsive nature of the theme. Otherwise, when the browser viewport gets smaller, the buttons would overlap the image. You may want to play a little with this setting and should test it on some mobile devices too.
To learn more about this see this question.
EDIT: I'll leave my original answer below, just in case this may
helpful to someone else in the future...
I see that you use Infortis Ultimo theme, which is a great choice. I don't think you should use <CSS> to move the button. It is better to move the entire <div class="actions"></div> to the top.
The result will look like this:
You can do this by making some changes to the following file:
app/design/frontend/ultimo/default/template/catalog/product/list.phtml
Somewhere around lines 273 to 289 (depending on the themes version) you will find the code for this:
<div class="actions clearer<?php echo $actionsClasses; ?>">
....
</div> <!-- end: actions -->
Note: It is best to first copy the entire list.phtml file to your own sub-theme
and make the changes there.
In your sub-themes list.phtml file just cut the section I mentioned above and move it up to somewhere around line 216 of the file.
Paste it right after the beginning of the <list class="item"> element and before the <div class="product-image-wrapper"....>, just like this:
<li class="item">
<!-- PUT THE CODE HERE -->
<div class="product-image-wrapper" style="max-width:<?php echo $imgWidth; ?>px;">
Also don't forget to add this in your custom.css style sheet:
.products-grid .actions {
margin: 0 0 10px;
}
This should do the trick for you!

White-space right hand side of the page

I uploaded the WordPress few days ago and found out that the one on local host and the one on the website www.noteid.com are different.
The one on the website has the white-space on the right hand side:
So I did test it with my theme and the one that WP has: Twenty-Fourteen
All the others theme work fine but two of those.
It seem like: html { overflow-x: hidden } work but I want to find what cause the problem. I took 2 days do the research and feel like nothing work out.
Can anyone help me to point out what happening to my website?
Thank in advance.
This is CSS: http://jsfiddle.net/n9zqygcj/
The reason this is happening is that the #footer width is 105% of the page.
You need to change:
#footer {
padding-left:0;
}
#colophon {
margin-left:5%
}
So that the footer isn't longer than it should be.
EDIT:
Here is the updated CSS.
http://jsfiddle.net/n9zqygcj/2/
The <a> tag which is wrapped around the <div id="footer"> should be assigned a class, for e.g. <a href="#" class="footerlink"> and then the following styles should be added to inside your stylesheet:
.footerlink {
display: block;
width: 100%;
overflow: hidden;
}
Apart from this, also add the following style to your stylesheet:
.metaslider {
overflow: hidden;
}
Hopefully this will eliminate the problem of extra white space on the right side which you're facing on your website.

Div floating left, another inline to the right

I have a feeling that this is the most fundamental of questions, and after 5 years of messing about with CSS, I should know the answer to it.
I have two divs with classes of pane-node-field-imageown and pane-node-field-short-place-intro. They are at the top of my page which is wrapped in a div with class burr-flipped-content-inner.
HTML
<div class="burr-flipped-content-inner burr-flipped-content-region-inner panel-panel-inner">
<div class="panel-pane pane-entity-field pane-node-field-imageown">
<div class="panel-separator"></div>
<div class="panel-pane pane-entity-field pane-node-field-short-place-intro">
<div class="panel-separator"></div>
<div class="panel-pane pane-vtiews-panes pane-og-nodes-panel-pane-2">
</div>
With the div that has the pane-node-field-imageown class, I would like to float it to the left.
CSS
.pane-node-field-imageown
{
float:left;
display: inline-block;
}
I added the inline-block value as it seems to best suit. The problem is getting the pane-node-field-short-place-intro div to sit nicely to the right of the first block. It seems to want to hide behind it (although my text seems to sit ok). The only way I can get the desired behaviour is with this CSS to the second block:
.pane-node-field-short-place-intro {
display: table;
padding: 0 10px;
}
.pane-node-field-short-place-intro .pane-content {
background: none repeat scroll 0 0 #444444;
padding:10px;
}
This doesn't feel right. My page can be viewed here for reference.
You could just do this:
.pane-node-field-short-place-intro {
padding: 3px 5px 0 20px;
overflow: hidden;
}
jsFiddle - CSS Floats
http://jsfiddle.net/kn9RE/9/
CSS Normalize - Be sure to make the the FIRST referenced style sheet
http://necolas.github.io/normalize.css/
First off, you are over-engineering your front-end markup. I say this because your current markup resembles "Div Spaghetti". I would start by evaluating your html code as a whole, remove all CSS and get a solid feel for the structure of your page. Although there are easy ways to go-about resolving this issue, its always best to analyze your code and ask yourself "can this be done with less markup?". Don't jump to take the easy way out, you will often end up with a code-base full of poor habits.
If you must use your existing HTML, you could apply a band-aid to your problem like so;
.pane-node-field-imageown
{
float:left;
}
.pane-node-field-short-place-intro
{
max-width: 660px;
float:left;
padding: 10px 5px 0 15px;
}
.field-item even
{
}
This should get you started, if you have any questions Please feel free to message me.

Images have gap between them

I have a some images that I need to line up without any gaps. I can get them fine in jsFiddle, see http://jsfiddle.net/QZLSf/2/
But on the actual SharePoint site the images have a gap between them, kind of like http://jsfiddle.net/QZLSf/1/
I have checked with FireBug and the images, and links, have all the properties they should have, but I can't get rid of that gap.
What could I be missing?
EDIT: I know that the second link has footerlinks defined as a class, but I was just using that to illustrate the problem I'm having. That's not what my actual code is.
EDIT: EDIT: Ok guys there seems to be a misunderstanding as to what I am asking here. I know HOW to get the required result, just that it isn't working on the SharePoint site. I just need advice on what might be wrong as everything that should work isn't working.
Remove the whitespace/line breaks between images.
Demo: http://jsfiddle.net/QZLSf/12/
Just posted this solution elsewhere and think it's the same thing.. is your Sharepoint implementation putting the <img> elements on separate lines in the HTML?
In your fiddle you have them all on one line.. if that's the difference then I'm afraid it's natural behaviour for inline elements (space between words).. there are hacks out there that involve HTML comments or removing the spacing or splitting the img tags, but if you can't have (or don't want) an HTML workaround - then something like this should work
CSS:
div {word-spacing: -4px; background: #eee; border: 1px solid #000; width: 600px;}
div p {word-spacing: 0;}
HTML
<div>
<img src="http://dummyimage.com/150x50/dad/fff" alt="my mini thing" />
<img src="http://dummyimage.com/150x50/000/fff" alt="my mini thing" />
<img src="http://dummyimage.com/150x50/dad/fff" alt="my mini thing" />
<img src="http://dummyimage.com/150x50/000/fff" alt="my mini thing" />
<p>the div containing these images and text has it's word-spacing set to -4px which removes the default whitespace</p>
<p>but then you want some text with normal spacing reset the word-spacing to 0 on the <p> elements, which is the default</p>
</div>
this is your code:
#footerlinks a, #footerlinks img{
but footerlinks is class not an id, so use this:
.footerlinks a, .footerlinks img{
ways to skin cats...
http://jsfiddle.net/eCSYt/45/
Update for bazmegakapa:
Sorry assumed the code was pretty easy to follow and I just presented it as an alternative way to approach it..
The gaps were caused by the white space in the HTML formatting - which is significant. By setting the font-size to 1px (actually 0 would be better if it is supported xbrowser) the white space is too small to render. In a real page you may also need to zero the line-height as well.
I used text-align to centre the text just to show an alternative method... and it has the advantage that you don't need to know the total width of the images
That's just the way it is. You have to set the margin-left to -4px
.footerlinks img {
margin-left: -4px;
}
.footerlinks img:first-child {
margin-left: 0px;
}
Demo: http://jsfiddle.net/QZLSf/11/
EDIT: This solution is more correct. I fixed the margin on the first child.

Why doesn't dynamically generated content change the height of containing div?

I am writing a footer div that displays info from the database. The footer has a different background color than the rest of the page, and will have a height that depends on how much content the database throws to it. When I generate the content with php and call for a border around the footer div, the content appears and is, let's say, 400px high, but the div border appears as a 1px high rectangle at the top of the div.
How do I get the height to auto-fit the content?
<div id="footer">
<?php
$an_array=array();
$tasks=mysql_query("select stuff from the db");
while($row=mysql_fetch_assoc($tasks)){
extract($taskrow);
$an_array[]=$task;
}
$an_array=array_chunk($an_array,4);
foreach($an_array as $dtkey=>$dtval){
echo "<dl>";
foreach($dtval as $dtvkey=>$dtvval){
echo "<dt>".$dtvval."</dt>";
}
echo "</dl>";
}
?>
</div>
This is what I get. The area below the red border should be filled with a color.
border image http://www.kevtrout.com/tortus/div.png
By popular demand, here is the css:
#footer{
border-top: 10px solid #d8d8d8;
background:#5b5b5b;
/*overflow:auto;*///Added this after seeing your answers, it worked
}
dl.tr{
width: 255px;
height:160px;
background: #5b5b5b;
margin:0px;
float:left;
padding: 10px;
}
dt.tr{
font-weight: normal;
font-size: 14px;
color: #d8d8d8;
line-height: 28px;
}
edit: I am using firefox on a mac
Check your footer CSS... if you have overflow set to anything but auto/scroll, then the DIV won't grow.
If not try using something other than DL/DT since DT's are inline elements, they won't push your div to fit content.*
e.g. just try using a DIV instead, if the footer grows, you have your answer.
(note: I revised order of suggestions)
*(I realize spec-wise, that this Shouldn't be an issue, but there wasn't an indication of which browsers this was occuring in, thus I would not be at all surprised if IE was rendering differently than expected for example)
Without seeing the CSS, my guess would be that your <dl>s are floated to get them side-by-side. The containing <div> then won't expand to contain them. If this is the case adding a clear:both; before the final </div> should fix it, like this:
<div style='clear:both;'></div>
The browser doesn't care if your content is generated by PHP or comes from a static HTML file.
The issue will most likely be in your CSS. Either the content you put in the footer has positioning properties (like float:left or position:absolute) that place them "outside" the div or the div has a fixed size and/or overflow properties set.
I'd suggest posting your CSS file here or (if it's too large) put it up somewhere where we can take a look. The finished HTML (you could just save a static copy of the output if your system isn't online yet) wouldn't hurt either.
By the way, your use of the <dl> element is wrong: you are missing the <dd> element. Items in the definition list always consist of one definition term and one or more definitions (which, in your code, are missing).
Also, rather than using <div style='clear:both;'></div> as suggested by Steve, I'd suggest explicitly stating the height of your <dt> elements. This way, the floats don't have to be cleared.

Resources