CSS has more properties for styling the text. The margin property sets an element's margins, and it has the following properties:
If the margin property has four values: 10px 5px 15px 20px, then it is assigned to the top margin as 10px, the right margin is 5px, the bottom margin is 15px, and the left margin is 20px. If the margin property has three values: 10px 5px 15px, then the value is moved to the top margin is 10px, right, and left margins are 5px, and the bottom margin is 15px. When the margin property has two values: margin: 10px and 5px, top and bottom margins are 10px, and right and left margins are 5px. If the margin property has one value: for example, 10px, then all four margins are 10px. Note that Negative values are allowed.
A strong tag is used to highlight the particular text. The tag br is an empty tag, and it is used to give a single line break between the sentences.
Here is an example of how to style regular (untagged) HTML text with CSS:
Preview of the output that you will get on running this code from your IDE.
<section style="margin-left: 12px;"> <strong>This is Indented with margin</strong> <br> Lorem consectetur mollit proident ad quis commodo pariatur ullamco mollit eiusmod cupidatat amet fugiat. </section> <br> <br> <br> <section> <strong>This is unindented</strong> <br> Lorem consectetur mollit proident ad quis commodo pariatur ullamco mollit eiusmod cupidatat amet fugiat. </section>
Follow the steps carefully to get the output easily.
- Download and Install VS Code on your Desktop.
- Open the VS Code and install Live Server from Extensions.
- Open the new file and save as filename.html.
- Copy the code using the "Copy" button above, and paste it into your html file.
- Click Go live button in the bottom right corner to get the output.
I hope you found this useful. I have added version information in the following sections.
I found this code snippet by searching for ' Style regular (untagged) HTML text with CSS' in kandi. You can try any such use case!
I tested this solution in the following versions. Be mindful of changes when working with other versions.
- The solution is created in VS Code 1.73.1 version.
- Live Server v5.7.9
Using this solution, we are able to style regular (untagged) HTML text using CSS with simple steps. This process also facilities an easy way to use, hassle-free method to create a hands-on working version of code which would help us to style HTML text.