I have a small doubt in CSS style sheets
what is use of float tag in css?
and why it using ???
please reply me

Recommended Answers

All 6 Replies

Hi sreein,

This is the way I understand it, If you don't want to use relative positioning. Float would be your next bet. I use it mainly for layouts. But people do use it for images as well.

Here a nice little article on it, that explains it in a lot more depth and detail I ever could.

Click here

All the best.

Float tells the browser whether to make the text flow to the left or the right of an object.

Float tells the browser whether to make the text flow to the left or the right of an object.

i think that's the reverse of float. float makes elements "float" in the surrounding elements--to the left or right of those elements. the other elements (like text) just wrap around the floated element (like in word when you set the text wrapping around something).

you need to watch out though: floated elements take up no vertical space, you need to plan for that, usually by using the clear tag (which stops elements from floating to the left/right/both sides of an element.

also, using float is way easier than relative positioning. the only thing you need to watch out for is floated elements not taking up space.

Float is to make the elements float left, right, or neither.

What is the use of * in CSS

It is called a universal rule in CSS. Let's say you have,

* {
    padding: 0;
    margin: 0;

Now every HTML element on the page will have a padding and margin of 0, and is often used to reset the default padding and margin created by the browser. This can be used with other CSS stylings too.

Regards, Arkinder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.