473,382 Members | 1,717 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,382 software developers and data experts.

inline selectors? style="li {font-weight:bold;}" ?

In posting to a blog, I would like to bold every list item (<li>).
Because I cannot influence the <head>...</head> section of the HTML
document, I can neither add a <style>...</style> block, nor reference an
external style sheet. Is there a way to accomplish this using the "style"
attribute and/or using div or span tags?

I want to do something like this:

<!-- desired application of css !-->
<div style="li {font-weight: bold;}">
...
<p>something</p>
<ul>
<li>foo</li>
<li>bar</li>
</ul>
</div>

I know that the following works, but it's useless, since if I were to do
it this way, I might as well use the <b> tag, and I get none of the
advantages of style sheets (namely, the ability to change the relevant
style in one place and have everything suddenly change appropriately):

<!-- useless application of css !-->
<ul>
<li style="font-weight: bold;">foo</li>
<li style="font-weight: bold;">bar</li>
</ul>

<!-- equivalent html - i thought we'd moved beyond this !-->
<ul>
<li><b>foo</b></li>
<li><b>bar</b></li>
</ul>

Also, what is the pertinent jargon in which this question is best and
most succinctly expressed?

thanks,
Tobin
--
Department of Physics, University of Rochester, Rochester NY 14627-0171
http://web.pas.rochester.edu/~tobin/

Apr 25 '06 #1
5 5463
Tobin Fricke wrote:
In posting to a blog, I would like to bold every list item (<li>).
Because I cannot influence the <head>...</head> section of the HTML
document, I can neither add a <style>...</style> block, nor reference an
external style sheet. Is there a way to accomplish this using the "style"
attribute and/or using div or span tags?


No. The closest you could get would be to use JavaScript to dynamically
alter the stylesheet (or loop through all the items and set inline style on
them).

This wouldn't be a very nice solution. You'd be better off getting the
ability to change the main stylesheet.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Apr 25 '06 #2
On Tue, 25 Apr 2006 12:50:25 -0700, Tobin Fricke
<fr****@ocf.berkeley.edu> wrote:
In posting to a blog, I would like to bold every list item (<li>).
Because I cannot influence the <head>...</head> section of the HTML
document, I can neither add a <style>...</style> block,


Add a <style ... >...</style> element to the _<body>_ of the page.

It's bad and it's wrong, but it works (for quite useful levels of
"works"). It also allows you to use a:hover as a selector, which you
can't do with inline styles.
Apr 25 '06 #3
Tobin Fricke wrote:
In posting to a blog, I would like to bold every list item (<li>).
Because I cannot influence the <head>...</head> section of the HTML
document, I can neither add a <style>...</style> block, nor reference an
external style sheet.


Sounds like you need a new blog. ;)

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Apr 26 '06 #4
On Tue, 25 Apr 2006 12:50:25 -0700, Tobin Fricke
<fr****@ocf.berkeley.edu> wrote:
In posting to a blog, I would like to bold every list item (<li>).
Because I cannot influence the <head>...</head> section of the HTML
document, I can neither add a <style>...</style> block,
It's not clear to me whether you are talking about your own blog or
someone else's. If you are posting to someone else's you are in any case
at the mercy of what they permit, and we can hardly offer any advice.
You should be happy to be able to do this:
<!-- equivalent html - i thought we'd moved beyond this !-->
<ul>
<li><b>foo</b></li>
<li><b>bar</b></li>
</ul>


If OTOH it's your own blog, you should get better software where you
*can* control the contents of the head section. There are enough open
source CMS's out there.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Apr 26 '06 #5
Tobin Fricke wrote:
<div style="li {font-weight: bold;}">


This is technically allowed, simply because the spec doesn't really
specify the exact syntax of the style attribute. The following draft
was published by the W3C:

http://www.w3.org/TR/css-style-attr

However, most browsers only support the syntax used in example 1.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Apr 29 '06 #6

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

Similar topics

3
by: Hodad | last post by:
I would like to adapt, as much as possible, the appearance and color red of the font in this button: <P><CENTER><BUTTON VALUE="SUBMIT"><A...
32
by: Will Hartung | last post by:
Can someone clarify that multiple classes in the "class" attribute are ok and "legal" and not some fluke? So, I can do: ..pink {color: pink} ..bold {font-weight: bold} ..medium {font-size:...
5
by: Tmuld | last post by:
Hello, How do I return to a page using response.redirect - keeping the state value? Right now I have a back button - on pressing it - it send the user back to WebForm1.aspx - but all the...
8
by: John Brock | last post by:
I am creating an Excel workbook using VB.NET, and have run into a problem. Excel at times insists on reformatting data that I enter into cells, e.g., converting "01234" to "1234", and this screws...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
37
by: Jan Wagner | last post by:
Hi, can't figure this one out, what's the CSS way to specify the language? In HTML it would be simply an lang="xx" attribute, or XHTML xml:lang="xx", but, how about in CSS? This would be...
0
by: Altemir | last post by:
I have a datagrid in an .aspx page that contains some columns using the "Font=Bold" inline style. The problem is that some users' browsers aren't displaying the bold font while others are. We...
2
by: r_ahimsa_m | last post by:
Hello, I am learning CSS and other WWW technologies. In the folowing definition italic doesn't work: h2 { color: Brown; text-decoration: italic; }
2
by: André | last post by:
Hi, i get sometimes an very unexpected error: "A form tag with runat=server must exist on the Page to use SetFocus() or the Focus property" at line: If j = 1 Then txta(i).Focus() There is a...
14
by: confusedfusion | last post by:
Not sure how many form submissions that have been lost over the years before I started but the company has a contact form that the required fields when validation fails the error message is going...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.