Showing posts with label css. Show all posts
Showing posts with label css. Show all posts

Sunday, November 4, 2012

css how to center a table?


how to center using css
MORE IMPORTANTLY,
css how to center a table?

container div, and table within.

<div id="price">
<table class="class-table-center">


/*** Center table in its container: .class ***/
table.class-table-center { /*** How to center align table in its container div. ***/
margin: auto;
}



http://webdesign.about.com/od/tables/qt/tiptablecenter.htm
http://www.granneman.com/webdev/coding/css/centertables/

http://www.w3.org/Style/Examples/007/center.en.html

CENTERING THINGS

A common task for CSS is to center text or images. In fact, there are three kinds of centering:


This small paragraph is vertically centered.

DIV.container {
    min-height: 10em;
    display: table-cell;
    vertical-align: middle }
...
<DIV class="container">
  <P>This small paragraph is vertically centered.
</DIV>













Saturday, November 3, 2012

CSS background, height, to solve clipped apple icon bottom.

Scenario: To show bottom truncated apple icon, you looked at background: background-image, background-position... but what really helped was height.

You also looked at css baseline text-bottom, but as long as height was too short, the apple image is clipped at the bottom, or top.

background-position: x px y px , for different use, only indicates where in th background-image's sprite list do you want to start displaying as top left corner.
starting position of a background image.



css for background - Google Search
http://www.w3schools.com/css/css_background.asp
http://www.w3schools.com/cssref/css3_pr_background.asp
http://www.tizag.com/cssT/background.php
For the shorthand:

When using the shorthand property the order of the property values is:
  • background-color
  • background-image
  • background-repeat
  • background-attachment
  • background-position

http://www.w3schools.com/cssref/pr_background-position.asp

Definition and Usage

The background-position property sets the starting position of a background image.
Note: For this to work in Firefox and Opera, the background-attachment property must be set to "fixed".








CSS Learnt how to directly override styles, for the specific buttons/blocks that you want to edit.

Practical learning of specificity encountered in CSS, today.

The Impact:
Learnt how to directly override styles, for the specific buttons/blocks that you want to edit.

The idea is just like in VB6 or C#, Windows Forms, you just set the styles directly on and for the elements/widgets that you want the style to be, and you copy all the widgets, they get the styles,

unlike CSS, which inherits from the top.. or from somewhere. From a long obscure chain. Ugh.

But anyway:


form input.smallrounded[type="submit"] { [[form input.largerounded[type="submit"] EXCEPT ... ln476]]
form input.largesquared[type="submit"]

form input.activedisabled[type="submit"] {ln476 activedisabled
    background-color: #EDEDED;
add color: #FFFFFF;
}


    border: 2px solid #FFFFFF;
    border-radius: 16px 16px 16px 16px;
    color: #FFFFFF;
    height: 34px;
}ln450 color for product box btn text 'Install'

form input.active[type="submit"] {
    background-color: #FF0000;
}ln472 bkgnd color for all buttons 'please try again', 'product box btn'

<input class="largerounded active" type="submit" value="Ok">
form input.largerounded[type="submit"] {
    border: 2px solid #FFFFFF;
    color: #FFFFFF;
    height: 48px;
}ln444 color for one button 'please try again' , [cancel btn, install thisdevice anotherdevice]
form input.largerounded[type="submit"] {
    border: 2px solid #FFFFFF;
    color: #FFFFFF;
    height: 48px;
}ln444 proceed,cancel : DON'T CHANGE





form input.smallrounded[type="submit"] {
    border: 2px solid #FFFFFF;
    border-radius: 16px 16px 16px 16px;
    color: #FFFFFF;
    height: 34px;
}ln450 smallrounded 'add' new device name

form input.largesquared[type="submit"] {
    border: 2px solid #FFFFFF;
    border-radius: 0 0 0 0;
    color: #FFFFFF;
    height: 48px;
}ln462 square big existing device name



AJAX PRODUCTBOX
class=" .product-box-button {
    background-color: #{{color_1}};
add color: #{{button_text_color}};
}

AJAX INSTALL TO THIS DEVICE?
class=" .install-to-device-button {
    background-color: #{{color_1}};
color: #{{button_text_color}};
}

class=" .install-to-device-cancel-button {
    background-color: #BFBFBF;
color: #FFFFFF;
}

/*AJAX SELECT DEVICE*/
class=" .large-squared-devicename-button {
    background-color: #{{color_1}};
color: #{{button_text_color}};
}

class=" .small-rounded-addnewdevice-button { NO CHANGES.
    background-color: #EDEDED;
color: #FFFFFF;
}

/*ERROR*/
class=" .error-ok-button {
    background-color: #{{color_1}};
color: #{{button_text_color}};
}









OKAY ALREADY:
/*AJAX PRODUCTBOX*/
/*
form input.active[type="submit"]*/

form.provision input.product-box-button {
    background-color: #008000;
color: #FF6820;
}

/*AJAX INSTALL TO THIS DEVICE?*/

div.centeredbuttons input.install-to-device-button {
    background-color: #FF6820;
color: #008000;
}

form.close_lb input.install-to-device-cancel-button {
    background-color: #000000;
color: #FF0000;
}

/*AJAX SELECT DEVICE*/
div.centeredbuttons input.large-squared-devicename-button {
    background-color: #DE2EF1;
color: #001EFF;
}


css baseline

css baseline

http://www.w3schools.com/cssref/pr_pos_vertical-align.asp

CSS vertical-align Property


img
{
vertical-align:text-top;
}



text-bottomThe bottom of the element is aligned with the bottom of the parent element's font




Thursday, November 1, 2012

CSS defaults, CSS user-agent defaults (you reset these globally/localized.)


1
Names of defaults:
overflow: hidden;

white-space: normal;
text-overflow: clip;


2
"show user-agent CSS" in FireBug. can't turn off this styles from within firebug,
have to either
1. use a global css reset sheet
2. or localized override, for example, p margin.









Ultimate CSS Cheat Sheet


http://www.addedbytes.com/cheat-sheets/css-cheat-sheet/

Given the number of possible selectors in CSS, it is no wonder some people often become confused. Mixing up ID and Class selectors is easy enough, without throwing sibling, child, attribute and language selectors into the mix. This section of the cheat sheet lists selectors and shows which element(s) those selectors would apply to.


Pseudo-selectors are used when defining styles for elements that either do not exist, or are in a particular state. This section lists various of the pseudo-selectors.
Please note - I have left the :before and :after pseudo-selectors off this list, as I felt generated content was too complex to add to this sheet and still define in a way that made that area of the sheet usable.

http://slodive.com/freebies/css-cheat-sheets/

Saturday, September 29, 2012

JqueryUImobile: Why can't see bkgnd image from the CSS for body tag

Why can't see bkgnd image from the CSS for body tag,
or for large container level tag,

or even bkgnd-color = #ff0000; red ???

like so







#div_body {
    background: url("static/bg-body.jpg") repeat scroll 0 0 transparent !important;


}


This doesn't work (#div_body) because the div only as big as its child divs and content
if all the child divs fitted in, they will all be over the bkground.

consider putting it to body tag instead?
Try verify with firebug...


ROOT CAUSE:
Commenting out this line

<!--        <script src="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script> -->

will allow the background: image you set in your CSS to not be overriden by the one from the JS.
The purpose of the JS is to keep your images resized to the mobile screen's view.

If you comment out the JS, you'll get the background you want and specified,
but your image(s) will be full width, horiz scrollbar out of the mobile device's width.



Because, therefore.






GENERAL RULE OF THUMB/SOLUTION:
If you know for sure something will happen some way, when you do raw html/css,
and it doesn't come out as expected,
comment out all framework css and js. Especially the js.

Then you know it's the framework you are using, clobbering your stuff.

Rather xxx yyyyy than to find out these kind of time wasting problems.









Styling Divs.


What you can put to a div are these

style="margin:0 -15px; background: url(static/bg-header-subpage.gif); padding-bottom: 10px;"


  • margins on the left and right; negative means that your contents will be hidden past the left and right edge of the page



  • padding bottom: means that an img tag inside this div will not fill up to the inner bottom boundary of this div



  1. you give a background to this div, rather than an img tag;
  2. this is like a background for the whole html page in olden days
  3. your imgs, and text, will be put on top of this bkground.