Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the benefit of not using float:right?

I have two divs in my website,one is left side and other is right side. But client said don't use float:right.So i used margin:left What is the plus point of not using float:right? margin-left or float:right, or am I wrong? Please help me.

#left
{
float:left;
width:200px;
}
#right
{
float:right;
width:200px;
}

or

#left
    {
    float:left;
    width:200px;
    }
    #right
    {
    margin-left:250px;
    width:200px;
    }
like image 474
Prashobh Avatar asked Dec 12 '22 23:12

Prashobh


1 Answers

I imagine it is to do with the order of the markup. In principle, you should write all your markup first, so it makes sense without any css, and then add css rules afterwards.

If you need to move your markup around to satisfy the css conditions, you might be damaging the search-engine-optimisation, accessibility, or readability and clear structure of your code.

If you float something right, sometimes you need to put the element first in the markup, even though it appears visually second.

This is of course speculation, and as Marcus Aurelius wrote about in his book meditations - it is more or less a waste of time trying to understand another person (in this case your client) as you can never truly succeed, only fool yourself into thinking you fully understand them and their motivations. Instead, you should concern yourself with making sure your own motivations, and actions are correct - so make sure you know when and when not ot float things left or right (which you are on the path to doing now), and reveal these truths to your client.

like image 179
Billy Moon Avatar answered Dec 27 '22 20:12

Billy Moon