How to emulate CSS column-count in React-Native?
Asked Answered
V

0

7

With CSS columns, you can wrap images and divs across multiple columns. For example, if you set up a CSS file like this:

html,
body {
    height: 100%;
}
body {
    overflow: hidden;
    margin: 0;
    background-color: orange;
}
#master-container {
    height: 100%;
    column-count: 2;
}
#child-container {
    height: 200%;
    width: 100%;
    background-color: cadetblue
}
.child-element {
    height: 33%;
    width: 100%;
    background-color: crimson;
    margin-bottom: 15px;
}

And HTML like this:

<!doctype html>
<html>

    <link rel="stylesheet" href="index.css">

<body>

<div id="master-container">
    <div id="child-container">
        <div class="child-element"></div>
        <div class="child-element"></div>
        <div class="child-element"></div>
    </div>
</div>

</body>

</html>

This is the result: https://codepen.io/MichaelMC/pen/WpPOxo

I want to achieve the same effect on mobile with React-Native. Does anyone know how this CSS column-count magic actually works? Some kind of Pac-Man/Asteroids-style graphics trick? Duplicate elements?

Vesper answered 2/4, 2017 at 5:34 Comment(1)
Hello moderators? I have not touched programming for 5 months and this was the last question I asked. I have come back with another question 5 months later and I am banned from asking questions. I don't know how to fix this? I am so tired of this website and it's draconian rules. All I have ever done here is ask questions with a curious spirit. I do not have a computer science degree. I have taught myself everything. I am just trying to solve problems. Why am I being punished by you for that? Am I responsible for how my questions make your website look? Surely the onus is on the answerers.Vesper

© 2022 - 2024 — McMap. All rights reserved.