简体   繁体   中英

How to align div elements of innerDiv in one line

<script type="text/javascript">
        $(document).ready(function () {
            var iCnt = 0;

creating div element

            var container = $(document.createElement('div')).css({
               ---some css--
            });

task showing status

            var status = { 0: "completed", 1: "completed", 2: "Running",                 3:"Pending", 4: "Pending" };
           var cssClass = '';

            iCnt = iCnt + 1;
            var i = 0;

            $.each(status, function (idx, i) { 

                                 }


                var innerDiv = $(document.createElement('div')).css({
                   -- some css---
                });

                $(container).append(innerDiv);

Now how to align these div elements of innerDiv one after the another in one line

            });

            $('#main').after(container);
        });
    </script>

This user's problem was solved by advice via comment

Try adding float:left in css property for each div and provide enough width to outer div

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM