/    Sign up×
Community /Pin to ProfileBookmark

i have this css:

div{
font-size:1px;
width:1px;
height:1px;
background-color:#3355ff;
}

on this html:

<div></div>.

My problem is that on IE it makes a 1 by 2 pixels div. Not less. Now you probably think: why do i need font-size:1px inside the div. Well it’s because IE keeps the size of the div bigger than the size of the text… I figured. So can anybody pls help me make a 1×1 px div? Or at least tell me a way to paint only a pixel of a div, and then find out what color is a specific pixel in that div..

10x a lot!!

to post a comment
CSS

1 Comments(s)

Copy linkTweet thisAlerts:
@cootheadMar 02.2009 — Hi there piramyd,

and a warm welcome to these forums. ?

IE7 will display a 1px by 1px div if the document has a [b]full dtd[/b].

IE6 will not play ball at all with the div but will show a 1px by 1px border as this example will show...
[color=navy]
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;meta http-equiv="Content-Style-Type" content="text/css"&gt;

&lt;title&gt;&lt;/title&gt;

&lt;style type="text/css"&gt;
div{
font-size:1px;
width:1px;
height:1px;
background-color:#35f;
}
&lt;/style&gt;

&lt;!--[if IE 6]&gt;
&lt;style type="text/css"&gt;
div{
background-color:transparent;
border-bottom:1px solid #35f;
}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div&gt;&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
[/color]

[i]coothead[/i]
×

Success!

Help @piramyd spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...