Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

(OT) CSS Codes

by domjoel (Initiate)
on Jun 07, 2009 at 10:54 UTC ( #769253=perlquestion: print w/replies, xml ) Need Help??

domjoel has asked for the wisdom of the Perl Monks concerning the following question:

I'm new with this and I really appreciate any help from you guys. I am using a site that utilizes CSS codes and I need to add a source code from google analytics. I have HTML codes and I dont know how to convert it to CSS ones. Any hints?

Replies are listed 'Best First'.
Installing Google Analytics tracking code
by Your Mother (Archbishop) on Jun 07, 2009 at 17:07 UTC
Re: (OT) CSS Codes
by JavaFan (Canon) on Jun 07, 2009 at 12:06 UTC
    You mention HTML and CSS, but this site is about Perl. Beside the fact that HTML markup ought to be used for semantics1, and CSS for presentation (and hence, there's generally2 no translation from one to the other), what kind of answer do you expect here?

    1. Ought to. Nowadays, HTML documents are just collections of DIV and SPAN elements, completely unreadable without the stylesheet. A sad regression of the state of a dozen years ago.
    2. Generally I said. Don't bother mentioning the counter examples. I know about them, otherwise, I would have omit the word "generally".
      HTML markup ought to be used for semantics1, and CSS for presentation (and hence, there's generally2 no translation from one to the other)

      Something of a strange thing to say, and only makes sense if you ignore the entire history of HTML.

      HTML has a <font> element. For many years, in HTML 1, 2 and 3 it was used to set fonts. Now it's deprecated in HTML 4, but it still works and you can translate between the font tag and a CSS font declaration perfectly well.



      Nobody says perl looks like line-noise any more
      kids today don't know what line-noise IS ...
      A reply falls below the community's threshold of quality. You may see it by logging in.
Re: (OT) CSS Codes
by Anneq (Vicar) on Jun 07, 2009 at 12:52 UTC

    Google for "CSS tutorial", "HTML tutorial", "CSS Reference", and "HTML Reference". Also you might consider buying "CSS The Missing Manual".

    Hope that helps,

    Anne

Re: (OT) CSS Codes
by Bloodnok (Vicar) on Jun 07, 2009 at 12:24 UTC
    Do you really mean convert CSS to HTML, or maybe you mean embed CSS markup within HTML ?

    Whilst both are meta-languages, as JavaFan has previously pointed out, they aren't directly compatible (and thus open to translation) in the general case...

    A user level that continues to overstate my experience :-))
Re: (OT) CSS Codes
by cjcollier (Novice) on Jun 07, 2009 at 19:18 UTC
    sure. put your css codes in a <style> element in the <html>...<head> section, for instance:
    <html> <head> <style> span { color: black; } </style> <title>My title</title> </head> <body> <span>this should be black or something</span> </body> </html>

      Redefining span this way makes about as much sense as redefining (just to get a little perl into this) print to mean foreach.

      <span> has a legitimate use -- to make a part of a markup element different from the rest. For example:

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:/ +/www.w3.org/TR/html4/loose.dtd"> <html> <head> <style type="text/css"> span { color: red; } blockquote{ margin-left: 6em; margin-right: 8em; font-style: italic } .red { color: red; background-color:transparent; } .b { font-weight: bold; color: green; background-color:#dddddd; } .black { color: black; background-color: #aaaaff; width: 8em; max-width:8em; text-align:center; } foobar { color: blue; background-color: transparent; font-size: 1.8em; font-style: italic; } .foobar { color: blue; background-color: red; font-size: 1.8em; font-style: italic; } </style> <title>My title</title> </head> <body> <p><span>this should be red... and it is, because browsers will genera +lly allow this abuse.</span> But a decent validator (CSS specific or +html/css) will tell you something like this:</p> <blockquote>The &quot;span&quot; tag has no attributes. Attributes are + normally used with the &quot;span&quot; element to provide functiona +lity.</blockquote> <p>Normal text. <span>red text</span> and back to normal.</p> <p><span class="b">And this bold, green and with a grey background.</s +pan></p> <p class="black">Black</p> <p class="span">Red? Not today! <foobar> ...because span is NOT a clas +s.</foobar> However, turning again to our validator:</p> <blockquote>The &quot;foobar&quot; is not a recognized element in this + selector. Is it misspelled?</blockquote> <p>Well, no, but while it works, there's no guarantee that it will tom +orrow ... or even today, in some browsers.</p> <p>dot_foobar (or even id foobar) would be a valid selector... used li +ke this: <span class="foobar">text rendered as spec'ed by dot_foobar< +/span></p> </body> </html>

      So if you're going to give advice on css, please do so with good advice; that is, with a decent respect for standards.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://769253]
Approved by wfsp
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2022-05-23 02:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (81 votes). Check out past polls.

    Notices?