css - How to set float for every element inside a div at once wihout specfiying float for every element inside? -
how set float right every element inside div?
i want give float inside elements not parent div?
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>sandbox</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type="text/css" media="screen"> body { background-color: #000; font: 16px helvetica, arial; color: #fff; } div {border:2px solid red;height:50px} {border:2px solid blue;margin:10px} </style> </head> <body> <div> <a>hello js bin</a> <a>from js bin</a> </div> </body> </html>
you can target children of element using *
selector, in example, add:
div * { float: right; }
note float children , children, if had nested content it's not want, in case want:
div > * { float: right; }
however, >
direct descendant selector isn't supported in older versions of ie (and possibly other browsers?).
Comments
Post a Comment