Center Image Collapses when floated; Prev / Nxt Arrows Also Collapsing - css

I'm having a problem with my center button (image) collapsing on itself; it is not showing the image (width: 200px) in all of it's glory. Also, for some reason, my previous and next arrows are not showing up properly either (only 2px by 20px, as opposed to the full image). I'd truly appreciate any insight because I've been battling with this for a few hours now; I'm sure it's human error because it happens in "The Big 4" (IE, Chrome, FF and Opera). Also, I attached an image to help clearly illustrate the issue...
My HTML is as follows:
<div class="excerpt">
...
<div class="buttons">
The Challenge
The Solution
Our Expertise
</div><!-- end .buttons -->
<div class="pagination">
1
2
3
4
5
</div><!-- end .pagination -->
</div><!-- end #rotator -->
The CSS for the above is as follows:
#rotator .excerpt {
float: left;
width: 320px;
margin: 0 0 0 40px;
}
#rotator .buttons {
text-align: center;
font-size: 20px;
clear: both;
padding-top: 15px;
width: 100%;
}
#rotator .button {
width: 200px;
height: 40px;
background-image: url(images/btn.gif);
background-repeat: no-repeat;
padding: 3px 0 0 0;
text-indent: -20px;
}
#rotator .button.active {
background-image: url(images/active-btn.gif);
background-repeat: no-repeat;
}
#rotator .button.right {
margin-right: -5px;
}
#rotator .pagination {
clear: both;
text-align: center;
font-size: 1.2em;
font-weight: bold;
padding-top: 10px;
width: 100%;
}
#rotator .pagination a.prev {
height: 30px;
width: 30px;
text-indent: -9999px;
background-image: url(images/page-left.png);
background-repeat: no-repeat;
margin-right: 10px;
}
#rotator .pagination a.next {
height: 30px;
width: 30px;
text-indent: -9999px;
background-image: url(images/page-right.png);
background-repeat: no-repeat;
margin-left: 10px;
}

#joe; a in an inline tag not a block tag & inline tag is not take any height, width & vertical margin & padding. So, define display:block in your prev & next anchor button.
CSS:
#rotator .pagination a.prev,
#rotator .pagination a.next{
display:block;
}

Related

How to align vertical elements as horizontal elements and shift to right side of the screen using CSS?

I am working on a plugin and need to align some social buttons to right side using CSS. But instead of showing in a line (horizontally) the buttons are showing vertically. Here's the code for that.
<div class= "sc1"><div class= "sc2"><span>Connect with us:</span>
<div class= "sc3"><div class="facebook-icon"></div>
<div class="twitter-icon"></div>
<div class="google-icon"></div>
<div class="instagram-icon"></div></div></div></div>
Now the CSS
.sc1 {
margin: 5px 0px;
background-color: #3498DB;
display: inline-block;
padding: 8px 10px;
width: 100%;
}
.sc2{
float: right;
color: white;
}
.sc3 {
float: right;
}
.sc3 .facebook-icon {
background-image: url(images/social-connections-icons.png);
height: 32px !important;
width: 32px;
background-position: 0 0;
/*float: right;*/
}
.sc3 .twitter-icon {
background-image: url(images/social-connections-icons.png);
height: 32px !important;
width: 32px;
background-position: -32px 0px;
/*float: right;*/
}
.sc3 .google-icon {
background-image: url(images/social-connections-icons.png);
height: 32px !important;
width: 32px;
background-position: -125px 0px;
/*float: right;*/
}
.sc3 .instagram-icon {
background-image: url(images/social-connections-icons.png);
height: 32px !important;
width: 32px;
background-position: -63px 0px;
/*float: right;*/
}
But after this the code final result is showing as
Here's the picture
I have also uploaded complete code on GitHub, in case someone wants to look at the complete code. Here it is.
You can add display: flex; to your .sc3 class:
.sc3 {
display: flex;
}
This will make all the icons align horizontally.

CSS; images and text, float

Very new to CSS, so apologies if this is simple beyond belief.
I am currently working on a page for class. There is a section where icons (coffee, music notes, food and a waiter) need to be floated above their respective headings. I have tried floating and clearing various elements. I hope I am just overlooking something simple!
I cannot edit the HTML in any way or I will receive a zero on the assignment, and I am only allowed to use CSS.
I am having trouble posting the code, so I hope it is okay to share the links.
HTML
https://github.com/melonysmith/dws1/blob/gh-pages/DWS1-Practical/index.html
CSS
https://github.com/melonysmith/dws1/blob/gh-pages/DWS1-Practical/css/styles.css
Any and all help and suggestions are welcome and very much appreciated!
EDIT: HTML and CSS posted.
I did get the icons to center above their headings, but I cannot seem to figure out how to get the "promo" section to center to the rest of the page, including the icons, headers and paragraphs.
<!-- begin promo -->
<section id="promo">
<div id="promo-first-col" class="promo-col">
<h3 id="coffee">Imported Coffee</h3>
<p>Checkout our various tyes of imported coffee.</p>
</div>
<div class="promo-col">
<h3 id="music">Great Music</h3>
<p>Our DJs will entertain you like never before.</p>
</div>
<div class="promo-col">
<h3 id="food">Finest Cuisine</h3>
<p>From Italian to Tex-Mex, you will find all types of food</p>
</div>
<div class="promo-col">
<h3 id="service">Nice Staff</h3>
<p>You will never forget our smile and professional attitude. </p>
</div>
</section>
<!-- end promo -->
#promo {
display: inline-block;
width: 100%;
background-color: #fff;
display: inline-block;
padding-bottom: 50px;
margin: 0 auto;
}
#promo p {
background-color: #fff;
width: 255px;
text-align: center;
margin: 0 auto;
}
#promo h3 {
background-color: #fff;
width: 255px;
text-align: center;
padding-top: 80px;
margin: 0 0 50px 0;
}
.promo-first-col {
display: inline-block;
background-color: #fff;
text-align: center;
width: 255px;
margin: 0 auto;
padding-top: 20px;
}
.promo-col {
display: inline-block;
background-color: #fff;
text-align: center;
width: 255px;
margin:0 auto;
padding-top: 20px;
}
#coffee {
float: left;
width: 255px;
background: #fff;
background-image: url("../images/ico_coffee.png");
background-position: center top;
line-height: 25px;
background-repeat: no-repeat;
text-align: center;
padding-top: 10px;
padding-right: 30px;
float: left;
}
#music {
float: left;
width: 255px;
background: #fff;
line-height: 25px;
background-image: url("../images/ico_music.png");
background-position: center top;
background-repeat: no-repeat;
text-align: center;
padding-top: 10px;
padding-right: 30px;
float: left;
}
#food {
float: left;
width: 255px;
background: #fff;
line-height: 25px;
background-image: url("../images/ico_food.png");
background-position: center top;
background-repeat: no-repeat;
text-align: center;
padding-right: 30px;
float: left;
}
#service {
float: left;
width: 255px;
background: #fff;
line-height: 25px;
background-image: url("../images/ico_service.png");
background-position: center top;
background-repeat: no-repeat;
text-align: center;
padding-top: 10px;
padding-right: 30px;
float: left;
clear: both;
}
.clear {
clear: both;
}
EDIT 2: Going to try and attempt to post a snippet. I'm new here, forgive my awkwardness!
All of the images, headers and paragraphs should be next to each other in a line with the image above the heading and the heading above the paragraph. That part I have figured out. Might need more code to explain, but this entire "promo" div is sitting to the left of the rest of the page, which is centered.
#promo {
display: inline-block;
width: 100%;
background-color: #fff;
display: inline-block;
padding-bottom: 50px;
margin: 0 auto;
}
#promo p {
background-color: #fff;
width: 255px;
text-align: center;
margin: 0 auto;
}
#promo h3 {
background-color: #fff;
width: 255px;
text-align: center;
padding-top: 80px;
margin: 0 0 50px 0;
}
.promo-first-col {
display: inline-block;
background-color: #fff;
text-align: center;
width: 255px;
margin: 0 auto;
padding-top: 20px;
}
.promo-col {
display: inline-block;
background-color: #fff;
text-align: center;
width: 255px;
margin:0 auto;
padding-top: 20px;
}
#coffee {
float: left;
width: 255px;
background: #fff;
background-image: url("http://melonysmith.github.io/dws/DWS1-Practical/images/ico_coffee.png");
background-position: center top;
line-height: 25px;
background-repeat: no-repeat;
text-align: center;
padding-top: 10px;
padding-right: 30px;
float: left;
}
#music {
float: left;
width: 255px;
background: #fff;
line-height: 25px;
background-image: url("http://melonysmith.github.io/dws/DWS1-Practical/images/ico_music.png");
background-position: center top;
background-repeat: no-repeat;
text-align: center;
padding-top: 10px;
padding-right: 30px;
float: left;
}
#food {
float: left;
width: 255px;
background: #fff;
line-height: 25px;
background-image: url("http://melonysmith.github.io/dws/DWS1-Practical/images/ico_food.png");
background-position: center top;
background-repeat: no-repeat;
text-align: center;
padding-right: 30px;
float: left;
}
#service {
float: left;
width: 255px;
background: #fff;
line-height: 25px;
background-image: url("http://melonysmith.github.io/dws/DWS1-Practical/images/ico_service.png");
background-position: center top;
background-repeat: no-repeat;
text-align: center;
padding-top: 10px;
padding-right: 30px;
float: left;
clear: both;
}
.clear {
clear: both;
}
<!-- begin promo -->
<section id="promo">
<div id="promo-first-col" class="promo-col">
<h3 id="coffee">Imported Coffee</h3>
<p>Checkout our various tyes of imported coffee.</p>
</div>
<div class="promo-col">
<h3 id="music">Great Music</h3>
<p>Our DJs will entertain you like never before.</p>
</div>
<div class="promo-col">
<h3 id="food">Finest Cuisine</h3>
<p>From Italian to Tex-Mex, you will find all types of food</p>
</div>
<div class="promo-col">
<h3 id="service">Nice Staff</h3>
<p>You will never forget our smile and professional attitude.</p>
</div>
</section>
<!-- end promo -->
Create two container divs: one containing the coffee div and the cuisine div, and the other containing the other two divs. Set the container on the left to
float: left;
and the other to
float: right;
There are now several ways you can go about this. One way would be to set both containers a
width: 50%
and for the contained two divs in each column/container
text-align: center;
OR
You could simply give them the float properties and then set margin-left on the left one and margin-right on the right one, and play around with the margins a bit until you get them where you want them.
Hope that helps!

How to overlap a image in responsive slider?

I need to overlap image of logo 20px down in a responsive slider. The image of logo must come at front and the responsive slider must be back. Please view live at: http://www.pahari.com.np
**HTML PART:**
<div id="top_banner"> <div id="logo"><img src="image/logo.jpg"> </div> </div>
<div id="slider_bg"> <?php include_once("slider.php"); ?> </div>
<div id="menu_bg"> </div>
<div id="content_bg"> <div id="content"> </div> </div>
**CSS PART:**
<style>
#top_banner{
width: 1000px;
height: 106px;
margin: auto;
}
#logo{
width: 362px;
background: url(images/logo.jpg) no-repeat;
height: 106px;
float: left;
}
#slider_bg{
float: left;
height: 380px;
}
#menu_bg{
background: #B1BB34;
height: 30px;
}
#content_bg{
background: #A562B1;
height: 180px;
margin-top: 25px;
}
#content{
background: url("image/bg.jpg") no-repeat;
width: 1000px;
margin: auto;
height: 180px;
margin-top: 25px;
}
<style>
The easiest way is to position your slider1_container with a negative value for top and adding a negative z-index. ex.:
top:-2em;
z-index:-1
Hope this help!
I would wrap the top banner in another div and work with absolute positioning. Please note that I have taken only part of your code for display purposes on fiddle. You will need to add this to your site accordingly.
Check this out: http://jsfiddle.net/3Z2JZ/
CSS
body{
background: url(images/bg.jpg) #FFFFFF repeat-x;
font: normal 12px verdana;
color: #9C9C9C;
margin: 0;
padding: 0;
}
#top_banner_wrap {
position: absolute;
width: 100%;
}
#top_banner{
position: relative;
width: 1000px;
height: 106px;
margin: auto;
}
#logo{
width: 362px;
background: url(images/logo.jpg) no-repeat;
height: 106px;
float: left;
}
#slider_bg{
float: left;
width: 100%;
height: 380px;
background-color: red;
margin-top: 86px;
}
use
#logo {
position: relative;
z-index:100;
}
for the logo element and it will stay on top of the slider element.z-index should be highest number defined.

css content goes out of div

Hi I have page http://rygol.cz/qlife/ and when Iam zooming out the content goes out of his div. If i you height: auto; or height: 100% its ok but leftcolumn is smaller then right, clear doesnt help me.
Have anybody some idea how to fix it?
#leftcolumn {
color: #333;
background: #fff;
background-image:url("./images/corner.png");
background-repeat:no-repeat;
padding: 10px;
height: 800px;
width: 244px;
float: left;
}
#rightcolumn {
float: right;
color: #333;
background: #fff;
padding: 10px;
height: 800px;
width: 638px;
display: inline;
margin-bottom: 10px;
}
If you need that extra space between header and the content you should just go ahead and place the #leftcolumn and #rightcolumn in an additional wrapper container with the background-color set and have the #container without the background-color set.
HTML structure:
<div id="container">
<div id="header"></div>
<div id="content-wrapper">
<div id="leftcolumn"></div>
<div id="rightcolumn"></div>
</div>
</div>
And CSS:
#container {
margin: 0 auto;
width: 922px;
}
#header {
color: #333;
background: #fff;
width: 902px;
padding: 10px;
margin-bottom: 10px;
height: 200px;
}
#content-wrapper {
background-color: #fff;
min-height: 1px;
overflow: hidden; /* clear hack :) */
}
#leftcolumn {
color: #333;
background: #fff;
background-image: url("./images/corner.png");
background-repeat: no-repeat;
padding: 10px;
width: 244px;
float: left;
}
#rightcolumn {
float: right;
color: #333;
background: #fff;
padding: 10px;
width: 638px;
margin-bottom: 10px;
}
Remove the height declarations in the columns. You could also use overflow-y: scroll though I would stick to removing the heights. Another thing to consider is that people generally don't zoom out that far anyway: the text becomes impossible to read at the zoom level it breaks at (chrome v24).
If you want equal height columns have the shorter column floated to one side then set position: relative and top: 0; bottom: 0; then set the other column to have overflow: hidden; to 'clear' the float. Note: the floated column should come first in the markup for this to work.

background image disappears when position relative used in firefox

So I'm trying to add a badge to the top right corner of a site I'm doing some work on. z-index works to float the object above the page content but each time i try to use position relative the background image disappears only position absolute shows the image. I don't really want to use absolute as the image needs to be positioned on the right hand side of the sites menu bar not the right hand side of the viewport.
Any thoughts or advice appreciated
<div class="badge-box">
Book Now!
</div>
<div id="header">
<img src="images/pixel.gif" width="378" height="31" alt="Welcome to Gwynfryn Farm Cottages" />
</div>
<div id="main-menu">
<div>
Home
Our Cottages
Bed & Breakfast
Price Guide
Location & Local Attractions
News & Special Offers
Contact Us
</div>
</div>
.badge-box {
width: 1030px;
margin-left: auto;
margin-right: auto;
border: 0px solid red;
}
.badge {
background: url(../images/badge.png) 0px 0px no-repeat;
width: 148px;
height: 148px;
text-indent: -10000px;
position: relative;
z-index: 999;
}
#header {
width: 960px;
height: 40px;
margin-left:auto;
margin-right:auto;
margin-top:20px;
padding: 20px 0px 0px 20px;
background: #58564f url(../images/header-top-background.png);
}
#main-menu {
width: 980px;
margin-left: auto;
margin-right: auto;
height: 35px;
/*background: red;*/
background: #58564f url(../images/header-bottom-background.png);
font-family: Georgia, "Times New Roman", Times, serif;
}
#main-menu div {
width: 776px;
height: 35px;
margin-left: auto;
margin-right: auto;
background: blue;
}
#main-menu div a {
display: block;
float: left;
padding: 5px 10px 0px 10px;
height: 30px;
color: #FFFFFF;
font-size: 1.2em;
text-align: center;
background: green;
}
#main-menu div a:hover {
background-color: #333333;
}
unless you do a display:block on that .badge class, a lot of the styles you have defined won't take effect as it defaults to inline. maybe that is all you need to get started.
i am not sure what is the effect you are trying to achieve. can you post a png/jpeg of the mock-up?

Resources