HTML DOM propriété Style clair
Définition et utilisation
ensembles de propriété clairs ou renvoie la position de l'élément par rapport à des objets flottants.
grammaire
Définition des propriétés claires:
Object.style.clear="none|left|right|both|inherit"
Retour attributs clairs:
Object.style.clear
值 | 描述 |
---|---|
none | 默认。允许浮动对象出现在元素两侧。 |
left | 不允许浮动对象出现在元素的左侧。 |
right | 不允许浮动对象出现在元素的右侧。 |
both | 不允许浮动对象出现在元素的左侧或右侧。 |
inherit | clear 属性的值应该从父元素继承。 |
support du navigateur
Tous les principaux navigateurs sont pris en charge par la propriété claire.
Note: IE7 et les versions antérieures ne supportent pas la valeur "inherit".IE8 ne fournit DOCTYPE! Supporté "inherit". soutien IE9 "inherit".
Exemples
Exemples
Ne laissez pas les objets flottants apparaissent à gauche du texte:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Titre> Ce tutoriel (w3big.com) </ title>
<Style type = "text / css">
img {
float: left;
}
</ Style>
<Script>
fonction displayResult () {
document.getElementById ( "p1") style.clear = "left" .;
}
</ Script>
</ Head>
<Body>
<Img src = "w3javascript.gif" width = hauteur "100" = "132">
<P id = "p1"> Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. </ P>
<Input type = "button" onclick = "displayResult ()" value = "text est laissée flottante">
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Titre> Ce tutoriel (w3big.com) </ title>
<Style type = "text / css">
img {
float: left;
}
</ Style>
<Script>
fonction displayResult () {
document.getElementById ( "p1") style.clear = "left" .;
}
</ Script>
</ Head>
<Body>
<Img src = "w3javascript.gif" width = hauteur "100" = "132">
<P id = "p1"> Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. Ceci est un texte. </ P>
<Input type = "button" onclick = "displayResult ()" value = "text est laissée flottante">
</ Body>
</ Html>
Essayez »
style Objets