Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>General concept is that CSS should get applied appropriately for HTML elements, if they match the given CSS selectors. Even if you add them dynamically via AJAX.</p> <p>I would recommend making sure you CSS is bullet proof. I think that might be the first pain point your having. If you have a list of news items, setup an HTML list like such:</p> <pre><code>&lt;ul id="news"&gt; &lt;li&gt;&lt;!-- News Block 1 --&gt;&lt;/li&gt; &lt;li&gt;&lt;!-- News Block 2 --&gt;&lt;/li&gt; &lt;li&gt;&lt;!-- ... --&gt;&lt;/li&gt; &lt;li&gt;&lt;!-- News Block N --&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>In each news "block", you can structure some HTML as as needed. For example:</p> <pre><code>&lt;li&gt; &lt;h2&gt;News title 1&lt;/h2&gt; &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.&lt;/p&gt; &lt;p&gt;Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.&lt;/p&gt; &lt;a href="#" class="read-more"&gt;Read More about News 1&lt;/a&gt; &lt;/li&gt; </code></pre> <p>Then, you can just style up that "News Block" for all blocks.</p> <pre><code>#news h2{ font-weight:600; font-family:Arial, Sans-Serif; } #news .read-more{ text-decoration:none; color:#FF00FF; } </code></pre> <p>From there, all you need to do is fetch and format your data with JavaScript/AJAX and append the LI "Block". Using jQuery can help make this easy. </p> <p>Here's some rough pseduo-code:</p> <pre><code>// get news items from AJAX var newsList = $.ajax().getNews(10); // loop through all new news items for(i=0;i&lt;newsList.size;i++) { // get a formatted LI block var block = formatNewsBlock(newsList[i]); // append news block to end of news list $('#news').append(block); } </code></pre> <p>A good structure to this can help make things easier to implement.</p> <p>I hope that helps some!</p> <p>Cheers!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload