html - Using borders cause wrong alignment with Bootstrap 3 -
i'm having problem bootstrap. @ image below red lines.
jumbotron
aligned little on right. fits image divs on header area. however, borders
cause header area they're wrongly margined. correct around -20px left, , -20px right, fit on line below.
i've tried many things couldn't solve issue.
how can make borders correctly align below? if using borders isn't idea, how can replicate using other html/css tags?
source: using bootstrap 3
<div class="container"> <div class="row"> @for($i = 0; $i < 3; $i++) <div class="col-xs-12 col-sm-4 col-lg-4 header-news-section"> <img src="{{ url::to('test/haber.jpg') }}"class="img-rounded header-news-section-image pull-left" alt="haber"> <a href="#"> {{ $a = rand(0, 99) }} @for($y = 0; $y <= $a; $y++) {{ $y }} @endfor </a> </div> @endfor </div> </div> <div class="container"> <div class="row"> <div class="col-xs-12 col-sm-9"> <div class="jumbotron"> <h1>hello, world!</h1> ........ .header-news-section { min-height: 60px; border-color: #eeeeee #cccccc #cccccc #eeeeee; border-radius: 5px 5px 5px 5px; border-style: solid; border-width: 1px; margin-left: 0px; margin-bottom: 10px; margin-top: -5px; } .header-news-section { display: block; } img.header-news-section-image { height: 60px; width: auto; padding-right: 10px; padding-bottom: 5px; padding-top: 5px; }
edit: i've solved doing <div class="row" style="margin: 0px 0px 0px 0px;">
. knows why being caused in first place?
your problem occurs because of additional css class header-news-section
on first row margin-left: 0px;
. overrides original margin defined column classes , therefore news articles appear more left jumbotron.
this relevant part @ bootstrap docs:
columns create gutters (gaps between column content) via padding. padding offset in rows first , last column via negative margin on .rows.
just add div
inside columns may apply custom styling:
<div class="col-xs-12 col-sm-4 col-lg-4"> <div class="header-news-section"> <img src="{{ url::to('test/haber.jpg') }}"class="img-rounded header-news-section-image pull-left" alt="haber"> <a href="#"> {{ $a = rand(0, 99) }} @for($y = 0; $y <= $a; $y++) {{ $y }} @endfor</a> </div> </div>
maybe have edit css after this, correct way use bootstrap.
Comments
Post a Comment