473,326 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

div.float versus .float

Hello,

I was reading an article and I can't figure something. I have:

div.float {
float: left;
}

And the HTML:

<div class="float">
<p>caption 1</p>
</div>

What is the difference of having:

div.float {
float: left;
}

or just

..float {
float: left;
}

Thanks,
Miguel

Nov 26 '06 #1
3 3741
Els
shapper wrote:
Hello,

I was reading an article and I can't figure something. I have:

div.float {
float: left;
}

And the HTML:

<div class="float">
<p>caption 1</p>
</div>

What is the difference of having:

div.float {
float: left;
}

or just

.float {
float: left;
}
As long as you only have one type of element with class="float", there
is no difference. If you'd have a div with class="float" and also
another element with that class, for instance <p class="float">, then
there would be a big difference :-)

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Nov 26 '06 #2
Ah,

got it. That might come handy. :-)

Thanks,
Miguel

Els wrote:
shapper wrote:
Hello,

I was reading an article and I can't figure something. I have:

div.float {
float: left;
}

And the HTML:

<div class="float">
<p>caption 1</p>
</div>

What is the difference of having:

div.float {
float: left;
}

or just

.float {
float: left;
}

As long as you only have one type of element with class="float", there
is no difference. If you'd have a div with class="float" and also
another element with that class, for instance <p class="float">, then
there would be a big difference :-)

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Nov 26 '06 #3
Els wrote:
shapper wrote:
>What is the difference of having:

div.float {
float: left;
}

or just

.float {
float: left;
}

As long as you only have one type of element with class="float", there
is no difference. If you'd have a div with class="float" and also
another element with that class, for instance <p class="float">, then
there would be a big difference :-)

Furthermore, div.float is more specific than .float. Selector
specificity impacts on the cascade order:
http://www.w3.org/TR/CSS21/cascade.html#cascading-order

David
Stardate 6904.7
Nov 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Stan Brown | last post by:
I've been thinking about float-ing a span versus float-ing a div, and the same for absolute positioning. When what is floated or positioned is a short chunk of text, I don't see any _visual_...
34
by: Xah Lee | last post by:
i have a very simple html doc using the following style: <style type="text/css"> ..x-note {background-color:#afeeee; margin:1ex; padding:1ex; float:right; line-height:130%; width:60ex;...
4
by: Jim West | last post by:
Both int a; std::complex<float> b; std::complex<float> c = static_cast<float>(a)*b; and int a; std::complex<float> b;
14
by: Glen Able | last post by:
Should it be possible to create a custom class, 'Float', which would behave as a drop-in replacement for the builtin float type? As mentioned in another thread, I once tried this in rather a...
9
by: Henri Sivonen | last post by:
URL: http://hsivonen.iki.fi/france-2005/ On the page, markup looks like this: <p class="imgpara"><a href="..."><img src="..." alt="..." height="..." width="..."></a>Caption 1</p> <p...
2
by: nicholas | last post by:
I have a webform that inserts product data in an sql database. The price field is of the type "float". On my web form, if I insert for example 12,2 in the price field => OK But if I insert 12.2 I...
10
by: abdul_n_khan | last post by:
I have a basic question related to datatype conversion. I am multiplying currency to float datatype. fltInterestRate=1.23333; curAmount = 91000000; curInterestAmount = curAmount *...
5
by: Peter Hansen | last post by:
I'm investigating a puzzling problem involving an attempt to generate a constant containing an (IEEE 754) "infinity" value. (I understand that special float values are a "platform-dependent...
9
by: Lie | last post by:
I've noticed some oddly inconsistent behavior with int and float: Python 2.5.1 (r251:54863, Mar 7 2008, 03:39:23) on linux2 -345 works, but Traceback (most recent call last): File...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.