The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Toggle using CSS only with Dynamic DIV ID using PHP

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • #45637


    I am trying to create a piece of code, which generates Content dynamically using PHP.

    Here is the code I can explain:


    I want to fetch the content in DESCRIPTION.
    The DIV with a dynamic ID(using PHP), needs to expand and collapse. I donot want to use JAVASCRIPT or JQUERY for this.

    How do I go about making it work using only CSS, PHP and HTML?


    Are you adding content based on an interaction or will it already exist in the DOM and just be shown?

    I suspect it’s the former and you’ll need JS to perform the insertion.

    CSS can’t insert actual content into a page…just style what is already there.


    @Paulie_D: The content will be fetched when the page loads. There are multiple divs on the page, which have different content. Each of the Div will show/hide the content only if the +/- is clicked. At the moment only the first DIV collapses or expands. If i click on any other div,it expands the content of First DIV only.

    My senior doesnt want me to use JS for various standards that we need to follow.
    How do I go about it then?


    Click events require JS don’t they?


    I so agree! I had created this entire thing with a JS toggle. But my senior asked me to change the same. :( concerns wrt the 508 compliance or JS disabled browsers.


    I think there is something you can do called a “checkbox hack” but I’m not sure it’s going to have the functionality you require.


    I’ll try that! :) thanks


    Your senior I a bit silly because on about 0.1% of browser have js off defenetly check out the checkbox hack


    @Htmkmainiac That may be so but the reason was given.

    >concerns wrt the 508 compliance or JS disabled browsers

    Only a small percentage of users require accessibilty concerns but that’s no reason to ignore them.


    I think it’s more between 1 and 2% depending on country etc. Percentage of IE7 is lower than that and people still make websites for IE7 (I do, for the fun of it)


    Here is how to use the input hack shown in some detail. Currently it’s coded as a accordian. With css you can make it look however you wish. The php is a complete seperate issue.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘CSS’ is closed to new topics and replies.