473,786 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3755
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
10944
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_ difference between the two. What I want to do is float (or position) a revision date at the right margin of a line that also has some text left justified. I tried earlier to do this and failed utterly in MSIE 4. But I was using span not div, and...
34
2620
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; clear:both;} p {line-height:130%; width:70ex;} </style> typically, the <p> is main text of novels, and in between is <div class=x-note>...</div> that are annotations floating on the right side.
4
5039
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
2723
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 hurry to try and catch some floating point naughtiness, but was stumped in various places. Is there a fundamental obstacle to doing this? thanks, G.A.
9
2973
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 class="imgpara"><a href="..."><img src="..."
2
2233
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 get an error. Now the problem is that if I use the decimal-key (=dot) on my numeric path, it inserts a "." instead of a "," So I have to use the comma from outside the numeric path. I have several computers, and all do the same.
10
2437
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 * fltInterestRate curInterestAmount should have 112233030
5
4199
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 accident" etc...) The issue appears possibly to point to a bug in the Python compiler, with it producing inconsistent results. I'm using "Python 2.4.2 (#67, Sep 28 2005, 12:41:11) on win32". This code sometimes produces a float of 1.0, sometimes...
9
1517
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 "<stdin>", line 1, in <module>
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10169
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.