Forums

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
    Posts
  • #45637

    Hi,

    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?

    #139223
    Paulie_D
    Member

    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.

    #139226

    @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?

    #139227
    Paulie_D
    Member

    Click events require JS don’t they?

    #139229

    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.

    #139230
    Paulie_D
    Member

    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.

    https://css-tricks.com/the-checkbox-hack/

    #139232

    I’ll try that! :) thanks

    #139239
    Htmlmainiac
    Member

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

    #139248
    Paulie_D
    Member

    @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.

    #139320
    CrocoDillon
    Participant

    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)

    #139327
    PicnicTutorials
    Participant

    Here is how to use the input hack shown in some detail. http://www.websitecodetutorials.com/code/css/simple-css3-accordion.php. 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.