473,598 Members | 3,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5479
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.ber keley.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.ber keley.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
4220
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 HREF="http://www.familytreedna.com/surname_join.asp?code=Q17978" STYLE="TEXT-DECORATION: NONE;"> <FONT COLOR="RED" FACE="COPPERPLATE GOTHIC BOLD">Right Here</FONT></A></BUTTON></CENTER></P>
32
3381
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: 12pt} <p class="bold pink medium">bold pink medium sized text</p>
5
6272
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 previously typed data is gone. Originally there was a datagrid full of data and a textbox. Using the browser back button it works. Using a Button and coding:
8
161645
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 me up when I need to read the data back. When I run into this problem using Excel interactively I simply change the cell Number format from "General" to "Text", but I haven't been able to figure out how to do this using VB.NET. Here is a code...
22
130095
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 document and closes it with the following code: <body onload="window.print(); window.close();"> This works correctly (or at least the way I expect it to work under MS Internet Explorer, but it cuases Netscape to "crash"
37
4175
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 required for a screen reader (text to speech) for accessibility, to help the reader software use the correct presentation method (e.g. correct language module).
0
1267
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 all seem to be using Internet Explorer 6.0. Is the "Font-Bold" style dependent on some sort of browser setting? If so, where do I find this setting?
2
12190
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
4282
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 form tag as you can see in the aspx file. Is there any other reason for this error? Thanks for help
14
4346
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 into the URL string on a refresh of the form page. I am very green on CF and CFM files and have this code below; I need to help for the error messages to "pop up" in a new window or display on the body of the page so anyone filling out the form knows...
0
7899
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
8397
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...
1
8050
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
8264
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...
0
5438
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
3897
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
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2412
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
1
1504
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.