random text with html+css only (without PHP, javascript, java or any other language)

Posted on 2008-11-07
Last Modified: 2012-05-05
it is possible just with HTML + CSS to make such thing?
Lets say i give text "aaa", "bbb", "ccc".
And it should one time write "aaa", another time "ccc', and so on random. :)
This should be done with CSS + HTML only.
Is that possible? :)
Question by:fikitifikitifak
    LVL 8

    Accepted Solution

    No it isn't
    LVL 82

    Assisted Solution

    >>This should be done with CSS + HTML only. Is that possible? :)
    No. Neither of them are able "manipulate" elements. You need to use scripting for that.

    Author Comment

    hm, will wait for more answers, maybe someone knows :D
    and if not possible, maybe with css3 will be possible?
    LVL 82

    Expert Comment

    >>hm, will wait for more answers,
    In the mean time, I suggest you rething your strategy :)
    LVL 82

    Expert Comment

    I meant:
    .. rethink ...
    LVL 30

    Expert Comment

    Not possible
    LVL 1

    Expert Comment

    not possible without scripting i think you should use javascript
    LVL 42

    Expert Comment

    by:David S.
    You would have to use JavaScript or a server-side language, e.g. PHP, to do that.
    LVL 3

    Expert Comment

    Why "just" HTML and CSS?  With only a little Javascript you can do it, and I can't imagine a situation where Javascripting is not possible while CSS3 is.  Modern browsers are capable of JS, and yes, theoretically someone might switch it off but no, practically no one will.

    So, are you SURE you need a solution without even Javascript?
    HTML and CSS3 are not for that.  If you could get just one random number somehow, you could position a very long random string with CSS to only show a (random) part of it, which would look like "wow, it's another text every time" - but obviously it's not. If you can find a calculated value in CSS3 that represents milliseconds (I'm not aware of anything like that) then maybe, MAYBE, after p*ssing some blood, you could achieve the desired effect.  Worth it? :) Probably not.

    So how'bout a good <script> ... </script> tag in body, which makes it a breeze to do it?
    LVL 1

    Expert Comment

    I think the original poster maybe does not realize that javascript code can be placed inside html, so that he can get his desired result easily.

    Here's some code, try pasting it into your html.

    <script language="JavaScript">
    var r_text = new Array ();
    r_text[0] = "All the leaves are brown";
    r_text[1] = "And the sky is grey";
    r_text[2] = "I've been for a walk";
    r_text[3] = "On a winter's day";
    r_text[4] = "I'd be safe and warm";
    r_text[5] = "If I was in L.A.";
    r_text[6] = "California dreaming, On such a winter's day";
    var i = Math.floor(7*Math.random())

    Open in new window

    However, if you are trying to do something fancy on a site like which disables javascript, then you can forget it.
    The javascript is disabled so that people can't hack your account... its a good thing.
    Forget about random text with just html and css, it can't be done.
    LVL 70

    Expert Comment

    by:Jason C. Levine
    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Android App Development

    This course will involve creating widgets, customize list view, grid view, spinners, etc. Creating applications using audio, video, and SQLite database. Ending with publication on Google Play.

    "I want to put my photos online, but I don't want them stolen.  What settings should I use?" When You Put Photos Online First and foremost, any digital file published on the WWW can be copied, stored, modified, retransmitted, etc.  Remember Naps…
    CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
    In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now