css overflow

Another excellent Edublogs.org weblog

Backgrounds In CSS: Everything You Need To Know « in the power endow Free Stock Photo Image Gallery

september 5th, 2009 · Ongar viðmerkingar
Uncategorized




Background repeatBy defile, when you drop an simulacrum, the simulacrum is repeated both horizontally and vertically until the undiminished constituent is filled. This may be what you necessitate, but on occasion you necessitate an simulacrum to be displayed put at the unchanged era or to be tiled in put anyone aiming. The admissible values (and their results) are as follows:
background-repeat: repeat; /* The defile value. Will tile the simulacrum in both directions.

*/
background-repeat: no-repeat; /* No tiling. */
background-repeat: repeat-x; /* Tiles horizontally (i.e. The simulacrum inclination be occupied put at the unchanged era. along the x-axis) */
background-repeat: repeat-y; /* Tiles vertically (i.e. along the y-axis) */
background-repeat: inherit; /* Uses the unchanged background-repeat quiddity of the element’s originator. */
Background positionThe background-position quiddity controls where a training simulacrum is located in an constituent.
In the examples below, we participate in drop a training simulacrum and are using the background-position quiddity to inhibit it.

The swindle with background-position is that you are in actuality specifying where the top-left corner of the simulacrum inclination be positioned, to the point to the top-left corner of the constituent. We participate in also drop background-repeat to no-repeat. The measurements are all in pixels. The pre-eminent digit is the x-axis establish (horizontal) and the instant is the y-axis establish (vertical). */
background-position: 0 0; /* i.e.
/* Example 1: defile. Top-left corner of constituent.

*/
/* Example 2: over the simulacrum to the healthy. */
background-position: 75px 0;
/* Example 3: over the simulacrum to the left side. */
background-position: 0 100px;
The simulacrum can be drop to any establish you like. */
background-position: -75px 0;
/* Example 4: over the simulacrum down.
The background-position quiddity also works with other values, keywords and percentages, which can be serviceable, signally when an element’s impact is not drop in pixels.
The keywords are self-explanatory.

For the x-axis:
left
center
right
And with a prospect the y-axis:
top
center
bottom
Their unorganized is specifically like that of the pixels values, x-axis value pre-eminent, and y-axis value instant, as so:
background-position: foremost right;
Percentage values are nearly the same. This makes more nous in an instance. The utensils to recall here is that when you cite a part, the browser sets the neck of the woods of the simulacrum at that part to align with that part of the constituent. Let’s roughly you cite the following:
background-position: 100% 50%;
This goes 100% of the scheme across the simulacrum (i.e. the very much right-hand edge) and 100% of the scheme across the constituent (remember, the starting dot is eternally the top-left corner), and the two underscore up there. It then goes 50% of the scheme down the simulacrum and 50% of the scheme down the constituent to underscore up there.

The smiley brazenly is aligned as it would be if it was drop to healthy center. The come to pass is that the simulacrum is aligned to the healthy of the constituent and specifically half-way down it.
Background attachmentThe background-attachment quiddity determines what happens to an simulacrum when the buyer scrolls the leaf. The three at one’s disposal properties are scroll, secured and become heir to. Inherit guilelessly tells the constituent to on the background-attachment quiddity of its originator. The prospect anchorage is the cut up of your browser that displays the Web leaf (think of it like your browser but without all the toolbars).

To penetrate background-attachment decently, we sine qua non to pre-eminent mull over of how the leaf and prospect anchorage interact. The prospect anchorage is drop in its establish and not in any degree moves.
When you scroll down a Web leaf, the prospect anchorage does not over.

Instead, the purport of the leaf scrolls upward. Now, when we drop background-attachment:scroll;, we are letting the cat out of the bag the training that when the constituent scrolls, the training forced to scroll with it. This makes it quality as if the prospect anchorage is scrolling down the leaf. In simpler terms, the training sticks to the constituent. This is the defile milieu with a prospect background-attachment.
Let’s probe an instance to give eminence to it clearer:
background-image: url(test-image.jpg);
background-position: 0 0;
background-repeat: no-repeat;
background-attachment: scroll;
As we scroll down the leaf, the training scrolls up until it disappears.

not scroll with the purport.
But when we drop the background-attachment to secured, we are letting the cat out of the bag the browser that when the buyer scrolls down the leaf, the training should loiter secured where it is — i.e.
Let’s demonstrate this with another instance:
background-image: url(test-image.jpg);
background-position: 0 100%;
background-repeat: no-repeat;
background-attachment: fixed;
We participate in scrolled down the leaf here, but the simulacrum remains unmistakable.
The prime utensils to note anyway is that the training simulacrum put appears in areas where its originator constituent reaches.

Even but the simulacrum is positioned to the point to the prospect anchorage, it inclination not champaign if it’s originator constituent is not unmistakable. In this anyone, we participate in aligned the simulacrum to the bottom-left of the prospect anchorage. This can be shown with another instance. But put the be put on ice of the simulacrum in house of correction the constituent is unmistakable.

background-image: url(test-image.jpg);
background-position: 0 100%;
background-repeat: no-repeat;
background-attachment: fixed;
Part of the simulacrum has been edited below inferior because it begins greatest of the constituent.
The Background Shorthand PropertyInstead of composition dated all of these rules each era, we can be a pump of together them into a put govern.
background-color: transparent;
background-image: url(image.jpg);
background-position: 50% 0 ;
background-attachment: scroll;
background-repeat: repeat-y;
. It takes the following appearance:
background:

For instance, the following rules.

could be combined into the following put underscore:
background: ingenuous url(image.jpg) 50% 0 scroll repeat-y;
And you don’t participate in to cite every value. If you below inferior a quiddity dated, its defile value is occupied a substitute alternatively. For instance, the underscore at behind has the unchanged productivity as:
background: url(image.jpg) 50% 0 repeat-y;
Common Uses Of Backgrounds
Aside from their clear throw away of making elements more captivating, backgrounds can be occupied with a prospect other purposes. If the lengths are divers, then the training of anyone of the columns inclination be shorter than the training of the other, spoiling your fancy.

Faux Columns
When using the CSS quiddity of arrange to establish layout elements, ensuring that two (or more) columns are the unchanged amount can be burdensome.
Faux columns is a very much uncontrived training swindle that was pre-eminent written up on A List Apart. The apprehension is uncontrived: a substitute alternatively of applying a disunite training with a prospect each column, turn b be enough after anyone training simulacrum to the originator constituent of the columns with that simulacrum containing the designs with a prospect each column.
Text Replacement
Our alternative of fonts on the Web is very much circumscribed. An easier colloidal solution that works on any browser is to mull over up an simulacrum of the extract in the font you necessitate and throw away it as the training a substitute alternatively. We could acreage a change drill fonts life using tools such as sIFR, but they force users to participate in JavaScript enabled.

This scheme, the extract stationary appears in the markup with a prospect search engines and security readers, but browsers inclination exhibit your preferred font.

Create a free edublog to get your own comment avatar (and more!)