Create a stylish layout by utilizing the power of CSS and P tags to

I want to create columns using a p tag. Since the content is being generated by a content manager, it's wrapped inside a box within a p element.

I'm unable to add multiple divs for creating columns; as mentioned earlier, the content is placed inside a p element.

Is there an alternative CSS solution to achieve this?

NOTE: I am looking to create columns similar to those seen in magazines or newspapers.

Answer №1

Have you experimented with adjusting the CSS properties of the p element to set a specific width and float it?

For example, try something similar to this:

p {
   width: 300px;
   float: left;
   margin-left: 10px;
}

Hopefully that helps spark some ideas :)

Answer №2

If you're looking to explore CSS Multi-column Layout Module, check out this resource. You can also visit caniuse.com/#search=column for more information on multi-column features. If you prefer a more traditional approach, you can achieve a similar effect using the following code:

p.column {
    float:left;
    width : (100 / nbr of columns)%
    /* 33.3% for 3 columns */
} 

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I need to modify the ng-style attribute multiple times within a JavaScript function

Here is the structure of my HTML: <nav id="card-set-menu-nav" ng-style="cardSetMenuNavStyle"> ... </nav> In my Javascript code using AngularJS, I have a function called openCardSetMenu: $scope.openCardSetMenu = function(cardSet) { $scope ...

Having trouble displaying the HTML page in Django? Encountering a NoReverseMatch Error?

I have successfully created and integrated a django app into my project. Now, I am attempting to include another HTML page titled "About" to the existing setup. I have added the about page within the home app. View image of code snippet here Below is the ...

Importing JSON data from a URL to display in an HTML table

Looking to utilize the Untappd API for a beer menu project, I've encountered an issue. The goal is to showcase the JSON data received from the server and organize it into an HTML table. Despite successfully importing data from a local list.json file ...

Applying CSS transitions and transforms to SVG elements

Having trouble animating an SVG group with CSS transitions after applying a CSS transform? Check out my code below and let me know if you spot the issue. Inline SVG Code <a href="javascript:void(0)" class="hub-icon-container"> <svg xmlns="ht ...

Press anywhere outside the container to conceal it along with the button

Utilizing an Angular directive to hide div elements when the user interacts outside of them has been effective. However, there is a specific issue that arises when clicking outside of a div on a button that toggles the visibility of the div. The 'ang ...

What impact does Bootstrap .ratio have in making the img show up over the offcanvas menu?

Is there a way to prevent a ratioed image from appearing above the offcanvas menu? When using Bootstrap 5 and specifying a 16x9 ratio for the image... <div class="ratio ratio-16x9 my-3"> <img width="768" height=&q ...

Extending a division's height to match the remaining space within its parent division

There are 3 div elements in my code that I want to style like this: Below is the HTML code snippet: <section class="main-window"> <div id="topdiv"></div> <div id="middiv"></div> <div id="botdiv"></div> ...

Discrepancies in media screen queries displaying on inspection tools compared to actual device

I've done some research online but I'm still struggling with this issue. Despite creating media screen queries and setting the viewport for iPhone 7 plus, the website does not display correctly on my device. When I inspect it using Chrome, every ...

Are interactive SVGs the way to go? Embedding vs not embedding SVGs in JavaScript

I am attempting to modify the attribute of a circle within an SVG using JavaScript. It works fine when the SVG is directly embedded in the HTML file - 'kreis1' changes color upon button click. However, when I place the SVG in a separate file (whi ...

Issue: The error message "articales.forEach is not a function" is indicating

app.get('/', (req, res) => { const articales = { title: 'Test Articles', createdAt: Date.now(), description: "Test Description" } res.render('index', { articales : articales }) }) <div ...

Reference ngFor for Input Validation Template

I'm currently facing an issue with validating input fields within a *ngFor loop. I am struggling to create unique template references for each input field. Basically, I need all input fields to be required on submit unless at least one of them is fill ...

Issue with Global styles causing conflicts with Grommet styled-components styles

I attempted to update my current App to utilize Grommet for the Inputs. The transition went smoothly, but I encountered a problem with the styles. Because the react-App is embedded on various pages, I have to contend with various types of global css style ...

Incorporate dynamic classes into an HTML list using PHP

I'm struggling to assign consecutive classes to each list item in a list with the 'nav' class. My goal is to give each list item a class of 'nthChild-x', where x corresponds to its position in the list. I'm pretty new to PHP, ...

What could be the reason for this code not displaying buttons on separate lines rather than next to each other?

I am struggling to get the Logo to print followed by all buttons lined up side-by-side. I have experimented with different display properties within the first <div> tag such as block, inline-block, and even removing the display property altogether. ...

Vanishing border around the sticky table header

While working on creating a table in an excel style using html and css with a sticky header, I noticed that the borders on the table head appeared strange. Take a look at the code snippet below: table { border-collapse: collapse; position: relative ...

Center-aligned Bootstrap column with a width of 50% and centered vertically

I am looking to have images and videos displayed side by side on my webpage. The code below functions properly, however there is an issue with the alignment. While the horizontal center alignment is correct, the video and images are not centered vertically ...

Why isn't my CSS styling showing up on the page?

I am struggling to create a thin border using my code. Despite all my efforts, the border simply won't render on the page. To ensure maximum specificity, I have temporarily placed it within a page element: <div style="max-width: 100%; position: re ...

The positioning of the parent element shifts as a result of the CSS

What causes a vertical position change in buttons with content floated left or right? Take this example http://jsfiddle.net/8ff6dhou/ <button>aaa</button> <button><div style="float:left">bbb</div></button> <button> ...

Unchanging Dive Field

I'm having trouble understanding why this field isn't updating with the correct number. It seems that any value less than 1 is being rounded in the alert() function. I believe all numbers are simply getting rounded down, but I'm unsure of an ...

Tips for incorporating images into AngularJS applications

Just starting out with angular js. I've run into an issue. I'm working with a json for my data and I'm unsure about how to incorporate images into my code <div ng-controller="myCtrl" class="container"> <div class="col-md-8"&g ...