Define Height of Each Row in CSS Grid Container

George John
Updated on 04-Jul-2020 06:35:02

150 Views

Use the grid-template-rows property to define the number of rows in CSS Grid Layout.ExampleYou can try to run the following code to set a number of rows.Live Demo                    .container {             display: grid;             background-color: gray;             grid-template-rows: 120px 90px 100px;             padding: 20px;             grid-gap: 20px;          }          .container > div {             background-color: yellow;             border: 2px solid gray;             padding: 35px;             font-size: 30px;             text-align: center;          }                     Game Board                1          2          3          4          5          6          

Decode JSON Object in Java

raja
Updated on 04-Jul-2020 06:27:24

3K+ Views

A JSON is a lightweight, text-based and language-independent data exchange format. A JSON can represent two structured types like objects and arrays. We can decode a JSON object using JSONObject and JSONArray from json.simple API. A JSONObject works as a java.util.Map whereas JSONArray works as a java.util.List.In the below example, we can decode a JSON object.Exampleimport org.json.simple.*; import org.json.simple.parser.*; public class JSONDecodingTest {    public static void main(String[] args) {       JSONParser parser = new JSONParser();       String str = "[ 0 , {\"1\" : { \"2\" : {\"3\" : {\"4\" : [5, { \"6\" : { \"7\" : 8 } } ] } ... Read More

Use CSS max-width Property for Responsive Video Player

Nishtha Thakur
Updated on 04-Jul-2020 06:18:01

574 Views

You can try to run the following code to use a max-width property to make your video player responsive −ExampleLive Demo                          video {             max-width: 100%;             height: auto;          }                                                     To check the effect, you need to resize the browser.    

Role of CSS flex-direction Property: row-reverse Value

George John
Updated on 04-Jul-2020 06:17:28

191 Views

Use the flex-direction property with row value to set the flex-items horizontally, from right to left.ExampleYou can try to run the following code to implement the row-reverse value −Live Demo                    .mycontainer {             display: flex;             flex-direction: row-reverse;             background-color: orange;          }          .mycontainer > div {             background-color: white;             text-align: center;             line-height: 40px;             font-size: 25px;             width: 100px;             margin: 5px;          }                     Quiz                Q1          Q2          Q3          Q4          Q5          Q6          

Position Text to Top Left on an Image with CSS

Smita Kapse
Updated on 04-Jul-2020 06:16:38

1K+ Views

To position text to top left, use the left and top property. You can try to run the following code to position text to left position on an image −ExampleLive Demo                    .box {             position: relative;          }          img {             width: 100%;             height: auto;             opacity: 0.6;          }          .direction {             position: absolute;             top: 10px;             left: 19px;             font-size: 13px;          }                     Heading One       Below image has text in the top left:                          Top Left Corner          

Usage of CSS align-content Property with flex-start Value

Krantik Chavan
Updated on 04-Jul-2020 06:16:07

153 Views

Use the align-content property with value flex-start to set the flex lines in the beginning.ExampleYou can try to run the following code to implement the flex-start value −Live Demo                    .mycontainer {             display: flex;             height: 200px;             background-color: blue;             align-content: flex-start;             flex-wrap: wrap;          }          .mycontainer > div {             background-color: orange;             text-align: center;             line-height: 60px;             font-size: 30px;             width: 100px;             margin: 5px;          }                     Queue                Q1          Q2          Q3          Q4          Q5          Q6          Q7          Q8          

Achieve Responsiveness for Background Image with CSS

Anvi Jain
Updated on 04-Jul-2020 06:10:57

200 Views

You can try to run the following code to achieve responsiveness for background image with CSS −ExampleLive Demo                          div {             width: 100%;             height: 300px;             border: 2px dashed blue;             background-image: url('https://www.tutorialspoint.com/python/images/python-data-science.jpg');             background-repeat: no-repeat;             background-size: contain;          }                     To check the effect, you need to resize the browser.          

Encode JSON Object in Java

raja
Updated on 04-Jul-2020 05:58:28

3K+ Views

A JSONObject is a subclass of java.util.HashMap where no order is provided. We can also use the strict ordering of elements as well with the help of the JSONValue.toJSONString(map) method i.e. by the implementation of java.util.LinkedHashMap.We can encode a JSON object in the below two examples.Example import java.util.*; import org.json.simple.JSONObject; public class JSONEncodingTest {    public static void main(String[] args) {       Map dataMap = new HashMap();       dataMap.put("Name", "Adithya");       dataMap.put("Age", new Integer(25));       dataMap.put("Salary", new Double(25000.00));       dataMap.put("Employee Id", new Integer(115));       dataMap.put("Company", "TutorialsPoint");       JSONObject ... Read More

Convert Map to JSON Object in Java

raja
Updated on 04-Jul-2020 05:51:35

9K+ Views

The JSON is a lightweight, text-based and language-independent data exchange format. The JSON can represent two structured types like objects and arrays. An object is an unordered collection of key/value pairs and an array is an ordered sequence of values. We can convert a Map to JSON object using the toJSONString() method(static) of org.json.simple.JSONValue. It has two important static methods: writeJSONString() method to encode an object into JSON text and write it out, escape() method to escape the special characters and escape quotes,  \, /, \r, , \b, \f, \t.Exampleimport java.util.*; import org.json.simple.JSONValue; public class ConvertMapJSONTest {    public static void main(String[] args) {       ... Read More

Merge Two JSON Objects in Java

raja
Updated on 04-Jul-2020 05:40:36

17K+ Views

A JSON is a lightweight data-interchange format and the format of JSON is a key with value pair. The JSONObject can parse a text from a String to produce a map-like object and supports java.util.Map interface. We can use org.json.simple.JSONObject to merge two JSON objects in Java.We can merge two JSON objects using the putAll() method (inherited from interface java.util.Map) in the below program.Exampleimport java.util.Date; import org.json.simple.JSONObject; public class MergeJsonObjectsTest {    public static void main(String[] args) {       JSONObject jsonObj = new JSONObject(); // first json object       jsonObj.put("Name", "Adithya");       jsonObj.put("Age", 25);     ... Read More

Advertisements