473,910 Members | 4,188 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Eric Meyer on CSS question

Hi,

This line is straight from page 82 of "Eric Meyer on CSS":

td#main {background: #FFD; color: black; border: 2px solid #797;
border-width: 2px 2px 2px 1px; }

Isn't it redundant to have "2px" in the border rule when you have an
explicit border-width rule? What am I missing?
Jamie
Jul 20 '05 #1
7 1775
On Fri, 23 Jul 2004, Jamie wrote:
td#main {background: #FFD; color: black; border: 2px solid #797;
border-width: 2px 2px 2px 1px; }

Isn't it redundant to have "2px" in the border rule when you have an
explicit border-width rule? What am I missing?


The shortcomings of some earlier browser versions, I think.

In other contexts it might be an issue of specificity, but I can't see
how that would be operative here.
Jul 20 '05 #2
"Jamie" <en***********@ yahoo.com> wrote in message
news:88******** ************@br oadviewnet.net. ..
Hi,

This line is straight from page 82 of "Eric Meyer on CSS":

td#main {background: #FFD; color: black; border: 2px solid #797;
border-width: 2px 2px 2px 1px; }

Isn't it redundant to have "2px" in the border rule when you have an
explicit border-width rule? What am I missing?


The specs require that the width be specified if you use border, and do not
allow you set different widths for different sides.
Jul 20 '05 #3
Jamie <en***********@ yahoo.com> wrote:
td#main {background: #FFD; color: black; border: 2px solid #797;
border-width: 2px 2px 2px 1px; }

Isn't it redundant to have "2px" in the border rule when you have an
explicit border-width rule? What am I missing?


The shorthand requires all three values.

Without the shorthand the code fragment would have looked like this:

td#main {background: #FFD; color: black; border-width: 2px 2px 2px 1px;
border-style: solid; border-color: #797; }

The first saved 17 bytes.

Perhaps Eric is the frugal type :)

--
Spartanicus
Jul 20 '05 #4
> The shorthand requires all three values.

Shouldn't the CSS validator pick that up then? I didn't know it mattered...
Should I bother changing all of my border definitions [where I didn't state
the width] then? Is it a big deal?
Jul 20 '05 #5
> The shorthand requires all three values.

Reading through the [2.1] specs, I don't think that's accurate... but,
correct me if I'm wrong.

This is an example taken from
http://www.w3.org/TR/CSS21/box.html#border-properties

You may need to scroll down to 'border'

<code>

p { border: solid red }
p {
border-top: solid red;
border-right: solid red;
border-bottom: solid red;
border-left: solid red
}

</code>

And,

<quote>
This is a shorthand property for setting the width, style, and color of the
top, right, bottom, and left border of a box.

Example(s):
h1 { border-bottom: thick solid red }
The above rule will set the width, style, and color of the border below the
H1 element. Omitted values are set to their initial values. Since the
following rule does not specify a border color, the border will have the
color specified by the 'color' property:

H1 { border-bottom: thick solid }
</quote>

Thus, the shorthand doesn't require all three values. Again, correct me if
I'm misinterpreting this.

Jul 20 '05 #6
*Jamie* <en***********@ yahoo.com>:

td#main {/*...*/ border: 2px solid #797; border-width: 2px 2px 2px 1px; }

Isn't it redundant to have "2px" in the border rule when you have an
explicit border-width rule?


Yes, I would write it like this:

border: 2px solid #797; border-left-width: 1px;

Note that

border-width: 2px 2px 2px 1px; border: 2px solid #797;

wouldn't work as desired, because all four borders would be 2px.
Some UAs may also make borders 'medium' wide for

border-width: 2px 2px 2px 1px; border: solid #797;

but AFAIK that would be wrong, although 'medium' is the initial value for
'border-(top|right|bott om|left)-width' and (most) shorthand properties
reset to initial if no explicit values are given. They would be right if
those rules were not in the same ruleset, i.e.

foo {border-width: 2px 2px 2px 1px;}
* foo {border: solid #797;}

I'm not totally sure about that, so CMIIW, please!

--
"The squeaking wheel doesn't always get the grease.
Sometimes it gets replaced."
Vic Gold
Jul 20 '05 #7
"e n | c k m a" <bo*@marley.com > wrote:
The shorthand requires all three values.


Reading through the [2.1] specs, I don't think that's accurate... but,
correct me if I'm wrong.


You are right, thanks for the correction.

The border shorthand takes one, two or three values, when specifying one
or two the other properties are set to their initial value.

--
Spartanicus
Jul 20 '05 #8

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

Similar topics

0
1320
by: kayodeok | last post by:
Nice Take on Selectors from Eric Meyer Appropriate Selections http://www.meyerweb.com/eric/thoughts/200312.html#t20031211 -- Kayode Okeyode http://www.kayodeok.co.uk/weblog/ http://www.kayodeok.btinternet.co.uk/favorites/webdesign.htm
7
6804
by: Jamie | last post by:
Hi everyone, Meyer on p. 91 of "Eric Meyer on CSS" says that link styles must be added in LVHA order (link, visited, hover, active) or link styles will stop working. Why is that? Is there an automatic inheritance from Link --> Visited --> Hover --> Active? Thanks, Jamie
2
1741
by: ChChanges | last post by:
Hi - I am going to buy a few books on CSS by Eric Meyer - I see that he is one of the leaders in CSS... Could somebody give me their opinion about the newer book 'More Eric Meyer on CSS' ? How does it compare to the original book 'Eric Meyer on CSS: Mastering the Language of Web Design' ? Which one is preferred?
9
1935
by: Don Kim | last post by:
In Meyer's EC++, Item 13, he offers this code snippet: template<class T> class Array { public: Array(int lowBound, int highBound); .... private: vector<T> data;
55
3523
by: Cindy | last post by:
Hello!! I'm new at access and there's is an article by Arvin Meyer for beginners that is references in Google Groups but I can't seem to find the original post with the article's URL. Does anyone know where I can find that article, or why the thread appears to be missing from the archives? Here's the link: ...
9
1350
by: Alan Silver | last post by:
Hello, In an attempt to get my head around this CSS business, I have been reading Eric Meyer's two "on CSS" books. All seems clear and sensible, but I have a question which the good folks here might be able to answer. I thought that one of the great benefits of CSS was to allow you to mark up the document so that the semantic meaning was clear, and then use the CSS for display. In a couple of projects (one in each book), EM has HTML...
0
1360
by: martin | last post by:
Hello, ... so I got this function http://www.datastrat.com/Code/MultipleEmail.txt from Arvin Meyer (thank you! :-) ) but how to make this work? Now I understand I have to copy the code into the code of the form. On this form I make a button. The code of the button can be accessed as well.
0
10037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11055
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10541
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8099
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
5939
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6142
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4776
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
4337
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.