How would I go about having placeholder divs that are then “overwritten” later with PHP?


Tags: php,html,css

Problem :

Some clarification:

I want to have 6 placeholder divs for strikes, so to speak, in a game.

So like [ ] [ ] [ ] [ ] [ ] [ ].

Which will be white squares with a black border.

After they make a bad guess, I want the first div to be overwritten with a red box holding the guess. Basically the above, but fully red and a number in the middle. ex: [9]

How would I go about doing this with PHP/CSS/HTML? I'm totally used to echo statements, so I was thinking about echoing each one out. But if I had divs there to begin with, it would just go after them, not overwrite.

I was thinking something along the lines of background images, at least in concept (not actual images) where the new guesses just go overtop the old ones. Would that be the best way?



Solution :

PHP completes all data at DOM complete. To update the DOM in real time, you can either use Ajax or your own JS block, node.js, etc.


    CSS Howto..

    How to iterate over node var in Primefaces tree to set icons in CSS class from DB

    HTML5/CSS3 how to expand an anchor element to fit full size of it's li parent

    How to remove the blue border around ImageMap control in the Internet Explorer?

    How to use jQuery to detect loaded background image after inserting out CSS

    How to achieve this CSS layout? [closed]

    How can I fix my CSS/HTML that uses input:checked, to prevent radio button movement?

    How do I set a cell background colour based on its contents using PHP after reading values from MySQL?

    How to make Zig Zag borders using CSS? [closed]

    How can I get a left-navigation column to fill the entire left side of the middle of a webpage using CSS?

    How to create full height content section with fixed header and footer in CSS with scrollbar hidden if not required [closed]

    How to remap CSS shortcut key in Mac Bluefish text editor

    how to setup css value for “-webkit-transform” in the “animate” method? [duplicate]

    Div style in css, how to start under then button

    Showing images conditionally

    How to toggle div and up-down arrow heads using css only

    How to create vertical ruler in CSS/html?

    Hide/show block with CSS

    How to float menu list elements

    How to make elements appear one by one using css animation

    sidebar is under the openlayers map how to set css

    How to change image size when nested in

    tag

    How to animate all except one feature with CSS

    How to edit horizantal drop down menu

    How to assign CSS to mobile page in asp.net

    How to change label color with html and CSS without js?

    How to select list item by its contents?

    How to change html background dynamically

    How to implement fade-in and other effects using CSS

    How to align social like buttons next to copyright text inside footer?

    How to show the text overflow after showing two lines in the div using css?