Vertical alignment of Images inside DIV - css

I am retrieving a bulk images through response and I need to arrange them inside a div tag and all the images are placing one below the other but I need to arrange them vertical (i.e. side by side)
So how do I do that?
And I followed this tutorial but I can arrange only text?
http://phrogz.net/CSS/vertical-align/index.html
Can anyone suggest me the right way?
Here is my code:
$('#showfilelist').append("<div id=" + file.id + "><a href='uploads/" +
file.target_name + "' target='_blank' rel='gallery'><img src='thumbs/" +
file.target_name + "' border='0'/></a> </div>");
Here is what I'm getting the result
Plupload Css:
/*
Plupload
------------------------------------------------------------------- */
.plupload_button {cursor: pointer;}
.plupload_wrapper {
font: normal 11px Verdana,sans-serif;
width: 100%;
}
.plupload .plupload_container input {width: 98%;}
.plupload .plupload_filelist_footer {border-width: 1px 0 0 0}
.plupload .plupload_filelist_header {border-width: 0 0 1px 0}
div.plupload .plupload_file {border-width: 0 0 1px 0}
div.plupload div.plupload_header {border-width: 0 0 1px 0; position: relative;}
.plupload_file .ui-icon {
cursor:pointer;
}
.plupload_header_content {
background-image: url('../img/plupload.png');
background-repeat: no-repeat;
background-position: 8px center;
min-height: 56px;
padding-left: 60px;
position:relative;
}
.plupload_header_content_bw {background-image: url('../img/plupload-bw.png');}
.plupload_header_title {
font: normal 18px sans-serif;
padding: 6px 0 3px;
}
.plupload_header_text {font: normal 12px sans-serif;}
.plupload_filelist,
.plupload_filelist_content {
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
-moz-user-select:none;
-webkit-user-select:none;
user-select:none;
}
.plupload_cell {padding: 8px 6px;}
.plupload_file {
border-left: none;
border-right: none;
}
.plupload .ui-sortable-helper,
.plupload .ui-sortable .plupload_file {
cursor:move;
}
.plupload_scroll {
max-height: 180px;
min-height: 168px;
_height: 168px;
overflow-y: auto;
}
.plupload_file_size, .plupload_file_status {text-align: right;}
.plupload_file_size, .plupload_file_status {width: 52px;}
.plupload_file_action {width: 16px;}
.plupload_file_name {
overflow: hidden;
padding-left: 10px;
}
.plupload_file_rename {
width:95%;
}
.plupload_progress {width: 60px;}
.plupload_progress_container {padding: 1px;}
/* Floats */
.plupload_right {float: right;}
.plupload_left {float: left;}
.plupload_clear,.plupload_clearer {clear: both;}
.plupload_clearer, .plupload_progress_bar {
display: block;
font-size: 0;
line-height: 0;
}
.plupload_clearer {height: 0;}
/* Misc */
.plupload_hidden {display: none;}
.plupload_droptext {
background: transparent;
text-align: center;
vertical-align: middle;
border: 0;
line-height: 165px;
}
.plupload_buttons, .plupload_upload_status {float: left}
.plupload_message {
position: absolute;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
}
.plupload_message p {
padding:0.7em;
margin:0;
}
.plupload_message strong {
font-weight: bold;
}
plupload_message i {
font-style: italic;
}
.plupload_message p span.ui-icon {
float: left;
margin-right: 0.3em;
}
.plupload_header_content .ui-state-error,
.plupload_header_content .ui-state-highlight {
border:none;
}
.plupload_message_close {
position:absolute;
top:5px;
right:5px;
cursor:pointer;
}
.plupload .ui-sortable-placeholder {
height:35px;
}

I believe what you want is float: left; on your images.
Functioning example: http://jsfiddle.net/NeMDZ/2/ (Try moving the middle divider. Flexible layout is optional.)
The basic CSS:
div.imgContain {
overflow:hidden; /* Only necessary if you need to style the containing box.
Forces box to expand to content's height. */
}
div.imgContain img {
float:left;
}
All the other CSS is optional. Style at will.

img {
display: inline-box;
}
The images will set in the same line as long they fit there. Be very careful with padding and margin values.

Images are block-level elements by default, so you will need float: left on your images (or whatever element your image is contained in) if you want them to be side-by-side. If you want to start a new line, create a spacer element like:
.spacer {
clear: both;
}
and then add <div class="spacer"></div> where you want to break a line of images and start a new one. You may need other attributes on your spacer to work in old browsers.

Related

Make page responsive using only CSS

I'm working on a project for a payments company and they require the use of an external page in order to collect payment information.
The only modifications that you can make to this page are supplying a custom CSS file.
There is no meta view port tag on the page, if I add one manually to my browser it works exactly how I want it to, however there is no way to add it to their page since it is controlled by a huge payment company not willing to make any changes.
Is there any way around this? I've tried using the #media tag to my css to change zoom based on screen size since that seems to help, but it doesn't take when I add it to my CSS.
#import url('https://fonts.googleapis.com/css?family=Roboto:300,400,700');
html{
background-color: #2c3745;
}
.PageBody{margin: auto; margin-top: 10px; border-radius: 5px; background-color: white; padding: 30px; max-width: 600px;font-family: 'Roboto', sans-serif;height: auto;min-height: auto;}
.PageContent{ width: auto;color: #000000;margin-left: auto;margin-right: auto;font-size: 14px; }
.ErrorBackground{ border: 1px solid #C79595 !important;background-color: #FAF2F2 !important; }
.ErrorMessage{ margin-bottom: 10px;border: 1px solid #DB9494; padding: 9px 10px 10px 35px; background-color: #FAF2F2;background-image: url("../images/Error.png"); background-position: 10px 10px;background-repeat: no-repeat;border-radius: 4px;-moz-border-radius: 4px;-webkit-border-radius: 4px; }
.RequiredField{color: red;font-size: 13px;float: right;margin-left: 5px;}
.FieldSet{border: 0px solid #D3D3D3;padding: 0;margin-bottom: 0;border-radius: 4px;-moz-border-radius: 4px;-webkit-border-radius: 4px;}
.Legend{padding-left: 0;padding-right: 7px;color: #A3A3A3;display: none;}
.Label{ display: inline-block;padding: 3px 0px 3px 0px;width: 320px;vertical-align: top; }
.TextBox{width: 100%;height: 38px;border: 1px solid #d8d8d8;padding: 0;font-size: 14px;border-radius: 3px;-moz-border-radius: 3px;-webkit-border-radius: 3px;}
.DropDown{width: 300px;height: 40px;border: 1px solid #d8d8d8;padding: 3px;font-size: 14px;border-radius: 2px;-moz-border-radius: 2px;-webkit-border-radius: 2px;}
.LabelColon{padding-left: 3px;display: none;}
.hppFrame {width: 100%;}
.FieldSetOrder{display: none;}
/* IE8, 9 and 10 Specific Styles */
#media screen\0 {
.LegendIe{ display: inline-block;position: relative;top: -20px;left: -3px;background-color: #FFFFFF; }
}
#media screen and (max-width: 648px) {
/* .FieldSet {width: 100%;}*/
.FieldSetOrder .FormRow {margin: 0;}
.FormRightColumn input {width: 100%!important;}
.FormLeftColumn {text-align: left!important;line-height: 23px;}
.Label {width: 100%;}
.FormRightColumn {width: 97%;}
.FormRow {
width: 100%!important;
margin: 0;
}
.FormExpDateMonthField {width: 144px!important;}
.FormExpDateYearField {
width: 145px!important;
}
}
#media screen and (min-width: 649px) {
.FormRightColumn {
width: 62%;
}
.FormRow {
width: 100%;
}
.FormRightColumn input {width: 100%!important;}
}
#btnSubmit {
background-color: #5C9DEC;
color: white;
border: none;
}
#btnCancel {
border: 1px;
color: black;
background-color: white;
border: none;
}
.button {
border-radius: 3px;
margin-top: 10px;
height: 30px;
width: 90px
}
.PageHeader{}
.PageFooter{}
.FormContainer{}
.FieldSetOrder{}
.LegendOrder{}
.FieldsetCreditCard{}
.LegendCreditCard{}
.FieldsetBillingInfo{}
.LegendBillingInfo{}
.FormRow{margin: 0;width: 100%;}
.FormLeftColumn{width: auto;display: inline-block;white-space: nowrap;text-align: left;vertical-align: top;margin-right: 8px;padding-top: 4px;color: #707070;font-weight: bold;clear: both;display: table;font-size: 13px;margin-bottom: 7px;margin-top: 10px;}
.FormRightColumn{/* display: inline-block; */vertical-align: middle;}
.FormAmount{}
.FormAmountLabel{}
.FormAmountValue{}
.FormAmountField{
font-weight: bold;
}
.FormInvoice{}
.FormInvoiceLabel{}
.FormInvoiceValue{}
.FormInvoiceField{}
.FormComment1{}
.FormComment1Label{}
.FormComment1Value{}
.FormComment1Field{}
.FormComment2{}
.FormComment2Label{margin-bottom: 7px;}
.FormComment2Value{margin-bottom: 7px;}
.FormComment2Field{}
.FormName{}
.FormNameLabel{}
.FormNameLabel1{color: #BEBEBE;font-weight: normal;font-style: italic;}
.FormNameValue{}
.FormNameField{}
.FormCardNumber{}
.FormCardNumberLabel{}
.FormCardNumberValue{}
.FormCardNumberField{}
.FormExpDate{}
.FormExpDateLabel{}
.FormExpDateValue{}
.FormExpDateMonthField{width: 177px;}
.FormExpDateYearField{width: 178px;}
.FormCvv{}
.FormCvvLabel{}
.FormCvvValue{}
.FormCvvField{ width: 95px; }
.FormDescription{
display: none;
}
.FormDescriptionLabel{}
.FormDescriptionValue{}
.FormDescriptionField{}
.FormAddress1{}
.FormAddress1Label{}
.FormAddress1Value{}
.FormAddress1Field{}
.FormAddress2{}
.FormAddress2Label{}
.FormAddress2Value{}
.FormAddress2Field{}
.FormCity{}
.FormCityLabel{}
.FormCityValue{}
.FormCityField{}
.FormState{}
.FormStateLabel{}
.FormStateValue{}
.FormStateField{}
.FormStateDropDown{}
.FormZip{}
.FormZipLabel{}
.FormZipValue{}
.FormZipField{ width: 95px; }
.FormCountry{}
.FormCountryLabel{}
.FormCountryValue{}
.FormCountryField{}
.FormBankAccountType{}
.FormBankAccountTypeLabel{}
.FormBankAccountValue{}
.FormRadioButtonField{}
.FormBankAccountNumber{}
.FormBankAccountNumberLabel{}
.BankAccountNumberNumberValue{}
.FormBankAccountNumberField{}
.FormBankRoutingNumber{}
.FormBankRoutingNumberLabel{}
.BankRoutingNumberNumberValue{}
.FormBankRoutingNumberField{}
.AcceptOnlyNumbers{}
.input-validation-error { }
.field-validation-error { display: table }
.field-validation-valid { display: none }
.validation-summary-errors { display: none }
.validation-summary-valid { display: none }
.FormBankAccountValue input[type="radio" i] {
width: 20px !important;
height: 10px;
}
.FormBankAccountValue label {
width: 50%;
float: left;
margin: 5px 0;
}
You have to find the CSS elements which are preventing the page from responding in the vanilla HTML and overwrite them in your CSS file.

How can i center the slideshow in my website to be in the center of the screen?

I have this css style code:
/* null margins and padding to give good cross-browser baseline */
html,body,address,blockquote,div,
form,fieldset,caption,
h1,h2,h3,h4,h5,h6,
hr,ul,li,ol,ul,dd,dt,dl,
table,tr,td,th,p,img {
margin:0;
padding:0;
}
img,fieldset {
border:none;
}
hr {
display:none;
/*
HR in my code are for semantic breaks in topic/section, NOT
style/presenation, so hide them from screen.css users
*/
}
#media (max-width:600px) {
* {
-webkit-text-size-adjust:none;
-moz-text-size-adjust:none;
-ms-text-size-adjust:none;
}
}
body {
font:normal 85%/150% "segoe ui",helvetica,sans-serif;
background-image: url("CB1.html");
//position:fixed; //(relative, absolute, static*)
//top: 120px;
//left: 120px;
//bottom: 120px;
width: 960px; margin: 0 auto;
}
.ss_scripted img {
display:none;
}
.ss_scripted .ss_show {
display: block;
}
#slideShow img {
margin:0 auto;
}
#slideCounter {
text-align:center;
padding:0.25em 1em;
font:bold 200%/120% consolas,courier,monospace;
color:#C00;
}
#slideControls {
width:512px;
padding:0.5em 0;
margin:0 auto;
}
#slideControls a {
float:left;
padding:0.25em 0.6em;
text-decoration:none;
color:#000;
background:#EEE;
border:2px solid #666;
-webkit-border-radius:1em;
-moz-border-radius:1em;
border-radius:1em;
-webkit-box-shadow:
inset 0 -0.5em 1em rgba(0,0,0,0.3),
0 0 1px #000;
-moz-box-shadow:
inset 0 -0.5em 1em rgba(0,0,0,0.3),
0 0 1px #000;
box-shadow:
inset 0 -0.5em 1em rgba(0,0,0,0.3),
0 0 1px #000;
}
#slideControls a:active,
#slideControls a:focus,
#slideControls a:hover {
background:#FFF;
}
#slideControls .next {
float:right;
}
I changed the part in the body:
body {
font:normal 85%/150% "segoe ui",helvetica,sans-serif;
background-image: url("CB1.html");
//position:fixed; //(relative, absolute, static*)
//top: 120px;
//left: 120px;
//bottom: 120px;
width: 960px; margin: 0 auto;
}
Unmarked 3 lines and added the width and margin 0 auto
If i was using this 3 lines without the width and margin then the slideshow was displaying in the left bottom.
Now the slideshow is displaying in the middle top. But i want it to be in the screen center not middle top:
Middle Top
What should i change/add ?
Try this:
<div id="slides">
<--! slider here -->
</div>
#slides{
margin-right: auto;
margin-left: auto;
display: block
}
I am going to assume your middle part is 300px width and 300px height.
body {
font:normal 85%/150% "segoe ui",helvetica,sans-serif;
background-image: url("CB1.html");
position:fixed;
top: 50%;
left: 50%;
margin-top:-150px; /* 50% of the exact height */
margin-left:-150px; /* 50% of the exact width */
}
You can use div tags for styling..
Below I have used the attribute style and set the margin from top...
For example,
<div style="margin-top:200px">Your slideshow content </div>

CSS centering my slideshow in the header

I have been trying to center the slider that I have inside the header. The header and the whole container is neatly centered, with just margin: 0 auto; Then I tried to include a slideshow inside the header, and tried by many ways to place it correctly. Yes, I succeeded for my own configuration by using position:aboslute and then playing with coordinates, but that will not work for the rest of the world.
The site (under construction) is www.hrcprojectconsulting.com
Since you ll be able to see all the CSS stuff, do you know how in heaven that can be positioned? I tried all margin combinations but I am kind out of options that I could think of.
A good news is that Internet Explorer 10 is also available now for Windows 7 so, CSS3 stuff and html5 placeholders work so I ll never code for backwards things anymore.
Note: if you happen to see everything ok, this is because you have the same kind of monitor and resolution than I do.
thank you
The code for the slider:
<style type="text/css" media="screen">
#slider {
width: 960px; /* important to be same as image width */
height: 150px; /* important to be same as image height */
position: relative; /* important */
overflow: hidden; /* important */
}
#sliderContent {
width: 960px; /* important to be same as image width or wider */
position: absolute;
top: 125px;
left:265px;
margin-left: 0;
}
.sliderImage {
float: left;
position: relative;
display: none;
}
.sliderImage span {
position: absolute;
font: 10px/15px Arial, Helvetica, sans-serif;
padding: 10px 13px;
width: 384px;
background-color: #000;
filter: alpha(opacity=70);
-moz-opacity: 0.7;
-khtml-opacity: 0.7;
opacity: 0.7;
color: #fff;
display: none;
}
The code for my homepage:
<style type = "text/css">
::selection{ background-color: #E13300; color: white; }
::-moz-selection {background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
body{
background:url('../assets/uploads/miweb/gradient2.png');
background-repeat:repeat-x;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
margin:0;
padding:0;
line-height: 1.5em;
}
b{font-size: 110%;}
em{color: red;}
#maincontainer{
width: 960px; /*Width of main container*/
margin: 0 auto; /*Center container on page*/
}
#topsection{
background: url("../jq185/css/start/images/ui-bg_gloss-wave_75_2191c0_500x100.png") repeat-x scroll 50% 50% #2191C0;
height: 300px; /*Height of top section*/
}
This is because the ul has a default padding. You will have to set the padding for your ul#sliderContent to 0:
#sliderContent {
padding:0;
margin:0;
}
Then you should remove the position: absolute from your stylesheet.
To place the sliderContent at the bottom you could do like this:
#topsection {
position: relative;
}
#slider {
position: absolute;
bottom: 0;
}
#sliderContent {
padding: 0;
margin: 0;
}

Drupal css causing multiple div's next to each other to have image wrapping

I have a page which I am quite happy with the layout of the design: http://dev.twoggle.com/
Then I put this into a Drupal theme and it inserted some extra div's inbetween and I am struggling to figure out how to get my original look back! : dev2.parkingmadeeasy.com.au
the ser_text_right class, when I hover over it using Firebug's page element inspect tool, seems to be overlapping with ser_image_left class - I'm not sure why this is happening.
Below is the css which is causing my problems (when combined with Drupal's output that is).
I'd like to move the entire ser_text_right class upwards, but not sure how?
Many thanks for any help,
Gvanto
/*
=======================================================================
services-prov
=======================================================================
*/
.services-pro {
background: none repeat scroll 0 0 #f3f3f3;
border: 1px solid #A2A1A1;
border-radius: 5px 5px 5px 5px;
float:left;
width:998px;
}
.services-pro .ser {
float: left;
margin: 0;
padding: 10px;
width: 47%;
}
.services-pro .ser img {
margin: 0px 10px 10px;
padding: 0;
}
.services-pro .ser .ser_image_left {
float: left;
height: 100px;
}
.services-pro .ser .ser_text_right {
padding:0;
}
.services-pro .ser .ser_text_right h4 {
padding: 3px 0 0px;
font-weight:bold;
font-size:14px;
}
.services-pro .ser .ser_text_right p {
color: #000;
margin: 0;
padding: 2px;
font-size:14px;
}
Add this to your CSS:
#block-views-home-slideshow-block { width: 400px; float:right; }
Of course you can change the width to whatever width your images are.

CSS Beginner Question – the header didnt adopt the assigned color

I hope you can help my with a exercise I have been stacking. I am wondering why the header is not appears in blue - as I actually have assigned: Please not the header area. I have assigned color "blue". BUt I have tried any color as well. The header keeps white
This is the CSS Code. (HTML is ok according to Dreamwaver)
Thanks a lot!
Best regards from Berlin, Germany.
* {
margin: 0;
padding: 0;
}
body {
background-color: #eeeeee;
font: 1.1em/1.3em Georgia, "Times New Roman", Times, serif;
/*1.1em/1.3 typischer Code für: Schriftgröße 1.1em und Zeilenhöhe 1.3em*/
}
h1, h2, h3 {
padding: 0.7em 0;
}
p {
padding: 0.3em 0;
}
/*-------- CONTAINER POSITION (#CONTAINER)----------*/
#container {
margin: 1em 6%;
background-color:#ffffff;
border:1px solid #1166cc;
}
/*-------- TOP AREA POSITION (#HEADER)----------*/
#header {
background-color: blue;
}
#header h1 {
color: white;
float: left;
width: 65%;
padding: 0.5em 2%;
}
#header form {
padding: 0.4em 1%;
float: right;
background-color: #77aadd;
width: 20%;
margin: 0.5em;
}
#header input {
padding:5px;
background-color: #ffffff;
border: 2px solid;
font-size: 1em;
color: #999999;
width: 70%;
}
/*-------- CONTAINER NAVIGATION POSITION (#NAVBAR)----------*/
#navbar {
clear:both;
background-color:#77aadd;
padding: 0.1em;
}
#navbar ul {
padding: 0.6em;
}
#navbar li {
display:inline;
list-style:none;
}
#navbar li a {
padding: 0.3em;
color: #fafafa;
}
/*-------- CONTENT POSITION (#CONTENT)----------*/
#content {
float: left;
width: 65%;
padding: 0.5em 3%;
}
/*-------- INFOBAR DESIGN (#SIDEBAR)----------*/
#sidebar {
float:right;
padding: 0.5em 3%;
font-size: 0.95em;
background-color:#cceeff;
width: 23%;
}
/*-------- FOOTER POSITION (#FOOTER)----------*/
#footer {
clear:both;
background-color:#5599dd;
text-align: right;
color: white;
}
#footer p {
padding: 0.5em;
}
Use firebug to debug it.
Select the elemnt (with the arrow icon) then see the CSS style panel. It will tell you all css styles and where they were defined for the element.
Double check your use of ID's and Classes.
Make sure your Header container has a height value (Use Firebug). If you are using floating elements in your Header, remember to place <div style='clear:both'></div> just before closing Header Container.
Add position, width and height to #header, for example:
#header {
background-color: blue;
position: absolute;
width: 80%;
height: 20%;
}
If you don't, the browser have no way of knowing how big #header is supposed to be.
Also, use http://validator.w3.org to check that your code is OK. It's much more reliable than Dreamweaver. At least Dreamweaver 8, that I'm using; later versions may be better.
By the way, if you're learning HTML, CSS or one of several other computer languages, http://www.w3schools.com is a great resource.

Resources