Bootstrap سان گهٽ استعمال ڪندي

LESS سان بوٽ اسٽريپ کي ترتيب ڏيو ۽ وڌايو ، سي ايس ايس پري پروسيسر، متغيرن جو فائدو وٺڻ لاءِ، ميڪسينس، ۽ وڌيڪ استعمال ڪيو بوٽ اسٽريپ جي سي ايس ايس ٺاهڻ لاءِ.

ڇو گهٽ؟

بوٽ اسٽريپ LESS سان ٺهيل آهي بنيادي طور تي، هڪ متحرڪ اسٽائل شيٽ ٻولي جيڪا اسان جي سٺي دوست، Alexis Sellier پاران ٺاهي وئي آهي . اهو ترقي ڪندڙ سسٽم تي ٻڌل CSS کي تيز، آسان ۽ وڌيڪ مزو ڏئي ٿو.

ڇا شامل آهي؟

CSS جي توسيع جي طور تي، LESS ۾ متغير شامل آهن، ڪوڊ جي ٻيهر استعمال لائق اسنپٽس لاءِ ميڪسين، سادي رياضي لاءِ آپريشن، nesting، ۽ حتي رنگ جا ڪم.

وڌيڪ سکو

گھٽ CSS

وڌيڪ سکڻ لاءِ سرڪاري ويب سائيٽ http://lesscss.org/ تي وڃو.

متغير

CSS ۾ رنگن ۽ پکسل جي قيمتن کي منظم ڪرڻ ۾ ٿورڙو درد ٿي سگھي ٿو، عام طور تي ڪاپي ۽ پيسٽ سان ڀريل. گهٽ سان نه جيتوڻيڪ - رنگن يا پکسل ويلز کي متغير طور تفويض ڪريو ۽ انهن کي هڪ ڀيرو تبديل ڪريو.

ملائيندڙ

اهي ٽي سرحد ريڊيس بيان جيڪي توهان کي باقاعده ol' CSS ۾ ڪرڻ گهرجن؟ ھاڻي اھي ھڪڙي لڪير تي ھيٺ آھن mixins جي مدد سان، ڪوڊ جا ٽڪرا توھان ڪٿي به استعمال ڪري سگھو ٿا.

آپريشنز

پنھنجي گرڊ، اڳواٽ، ۽ وڌيڪ سپر لچڪدار ٺاھيو رياضي تي عملن سان. ضرب ڪريو، ورهايو، شامل ڪريو، ۽ گھٽايو پنھنجي طريقي سان CSS جي صفائي.

ڇڪڻ ۽ ڳنڍڻ

@bodyBackground @white صفحي جي پس منظر جو رنگ
@textColor @grayDark سڄي جسم لاءِ ڊفالٽ ٽيڪسٽ رنگ، عنوان، ۽ وڌيڪ
@linkColor #08c ڊفالٽ لنڪ ٽيڪسٽ رنگ
@linkColorHover darken(@linkColor, 15%) ڊفالٽ لنڪ ٽيڪسٽ هور رنگ

گرڊ سسٽم

@gridColumns 12
@gridColumnWidth 60px
@gridGutterWidth 20px
@fluidGridColumnWidth 6.382978723%
@fluidGridGutterWidth 2.127659574%

ٽائپوگرافي

@sansFontFamily "Helvetica Neue"، Helvetica، Arial، sans-serif
@serifFontFamily Georgia, "Times New Roman", Times, serif
@monoFontFamily مينلو، موناکو، "ڪوريئر نيو"، مونو اسپيس
@baseFontSize 13px پکسلز هجڻ گهرجي
@baseFontFamily @sansFontFamily
@baseLineHeight 18px پکسلز هجڻ گهرجي
@altFontFamily @serifFontFamily
@headingsFontFamily inherit
@headingsFontWeight bold
@headingsColor inherit

ٽيبل

@tableBackground transparent
@tableBackgroundAccent #f9f9f9
@tableBackgroundHover #f5f5f5
@tableBorder ddd

گراسڪيل رنگ

@black #000
@grayDarker #222
@grayDark #333
@gray #555
@grayLight #999
@grayLighter #ايئي
@white #fff

تلفظ رنگ

@blue #049cdb
@green #46a546
@red #9d261d
@yellow #ffc40d
@orange #f89406
@pink #c3325f
@purple #7a43b6

اجزاء

بٽڻ

@btnBackground @white
@btnBackgroundHighlight darken(@white, 10%)
@btnBorder darken(@white, 20%)
@btnPrimaryBackground @linkColor
@btnPrimaryBackgroundHighlight spin(@btnPrimaryBackground, 15%)
@btnInfoBackground #5bc0de
@btnInfoBackgroundHighlight #2f96b4
@btnSuccessBackground #62c462
@btnSuccessBackgroundHighlight 51a351
@btnWarningBackground lighten(@orange, 15%)
@btnWarningBackgroundHighlight @orange
@btnDangerBackground #ee5f5b
@btnDangerBackgroundHighlight #bd362f
@btnInverseBackground @gray
@btnInverseBackgroundHighlight @grayDarker

فارم

@placeholderText @grayLight
@inputBackground @white
@inputBorder #ccc
@inputBorderRadius 3px
@inputDisabledBackground @grayLighter
@formActionsBackground #f5f5f5

فارم رياستون ۽ خبرداري

@warningText #c09853
@warningBackground #f3edd2
@errorText #b94a48
@errorBackground #f2dede
@successText #468847
@successBackground #dff0d8
@infoText #3a87ad
@infoBackground #d9edf7

نوبار

@navbarHeight 40px
@navbarBackground @grayDarker
@navbarBackgroundHighlight @grayDark
@navbarText @grayLight
@navbarLinkColor @grayLight
@navbarLinkColorHover @white
@navbarLinkColorActive @navbarLinkColorHover
@navbarLinkBackgroundHover transparent
@navbarLinkBackgroundActive @navbarBackground
@navbarSearchBackground lighten(@navbarBackground, 25%)
@navbarSearchBackgroundFocus @white
@navbarSearchBorder darken(@navbarSearchBackground, 30%)
@navbarSearchPlaceholderColor #ccc
@navbarBrandColor @navbarLinkColor

ڊراپ ڊائونز

@dropdownBackground @white
@dropdownBorder rgba(0,0,0,.2)
@dropdownLinkColor @grayDark
@dropdownLinkColorHover @white
@dropdownLinkBackgroundHover @linkColor

هيرو يونٽ

@heroUnitBackground @grayLighter
@heroUnitHeadingColor inherit
@heroUnitLeadColor inhereit

جي باري ۾ mixins

بنيادي مرکبات

هڪ بنيادي ميڪسين لازمي طور تي هڪ شامل يا جزوي طور تي CSS جي هڪ ٽڪڙي لاءِ آهي. اهي صرف هڪ CSS ڪلاس وانگر لکيل آهن ۽ ڪٿي به سڏي سگهجن ٿا.

  1. . عنصر {
  2. . صاف فڪس ()؛
  3. }

پيرا ميٽرڪ ميڪس

ھڪڙو پيرا ميٽرڪ ميڪسين ھڪڙو بنيادي ميڪسين وانگر آھي، پر اھو پڻ اختياري ڊفالٽ قدرن سان پيرا ميٽرز (ان ڪري نالو) قبول ڪري ٿو.

  1. . عنصر {
  2. . سرحد - ريڊيس ( 4px
  3. }

آساني سان پنهنجو پاڻ کي شامل ڪريو

بوٽ اسٽريپ جون لڳ ڀڳ سڀئي ميڪسينز mixins.less ۾ محفوظ ٿيل آهن، هڪ شاندار افاديت .less فائل جيڪا توهان کي ٽول ڪٽ ۾ موجود .less فائلن مان ڪنهن ۾ به ميڪسين استعمال ڪرڻ جي قابل بڻائي ٿي.

تنهن ڪري، اڳتي وڌو ۽ موجوده استعمال ڪريو يا پنهنجو پاڻ کي شامل ڪرڻ لاء آزاد محسوس ڪريو جيئن توهان کي ضرورت آهي.

شامل ڪيل ميڪس

افاديت

ملائڻ پيرا ميٽرز استعمال
.clearfix() ڪو به ڪنهن به والدين کي شامل ڪريو اندر اندر floats صاف ڪرڻ لاء
.tab-focus() ڪو به لاڳو ڪريو ويب ڪٽ فوڪس انداز ۽ گول فائر فاڪس آئوٽ لائن
.center-block() ڪو به خودڪار مرڪز هڪ بلاڪ-سطح عنصر استعمال ڪنديmargin: auto
.ie7-inline-block() ڪو به display: inline-blockIE7 سپورٽ حاصل ڪرڻ لاء باقاعده کان علاوه استعمال ڪريو
.size() @height @width ھڪڙي لڪير تي اوچائي ۽ چوٽي کي جلدي سيٽ ڪريو
.square() @size ويڪر .size()۽ اوچائي کي ساڳي قدر مقرر ڪرڻ لاءِ ٺاهي ٿو
.opacity() @opacity سيٽ ڪريو، مڪمل انگن ۾، اوپيسيٽي سيڪڙو (مثال طور، "50" يا "75")

فارم

ملائڻ پيرا ميٽرز استعمال
.placeholder() @color: @placeholderText placeholderان پٽن لاءِ متن جو رنگ مقرر ڪريو

ٽائپوگرافي

ملائڻ پيرا ميٽرز استعمال
#font > #family > .serif() ڪو به هڪ عنصر ٺاهيو سيرف فونٽ اسٽيڪ استعمال ڪريو
#font > #family > .sans-serif() ڪو به هڪ عنصر ٺاهيو هڪ sans-serif فونٽ اسٽيڪ استعمال ڪريو
#font > #family > .monospace() ڪو به هڪ عنصر ٺاهيو مونو اسپيس فونٽ اسٽيڪ استعمال ڪريو
#font > .shorthand() @size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight آساني سان فونٽ سائيز، وزن، ۽ معروف مقرر ڪريو
#font > .serif() @size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight فونٽ فيملي کي سيرف تي سيٽ ڪريو، ۽ ڪنٽرول سائيز، وزن، ۽ اڳواڻي
#font > .sans-serif() @size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight sans-serif تي فونٽ فيملي سيٽ ڪريو، ۽ ڪنٽرول سائيز، وزن، ۽ اڳوڻو
#font > .monospace() @size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight فونٽ فيملي کي سيٽ ڪريو مونو اسپيس، ۽ ڪنٽرول سائيز، وزن ۽ اڳواٽ

گرڊ سسٽم

ملائڻ پيرا ميٽرز استعمال
.container-fixed() ڪو به توهان جي مواد کي رکڻ لاء هڪ افقي مرڪزي ڪنٽينر ٺاهيو
#grid > .core() @gridColumnWidth, @gridGutterWidth n ڪالمن ۽ x پکسل وائڊ گٽر سان گڏ پکسل گرڊ سسٽم (ڪنٽينر، قطار ۽ ڪالمن) ٺاھيو
#grid > .fluid() @fluidGridColumnWidth, @fluidGridGutterWidth Generate a precent grid system with n columns and x % wide gutter
#grid > .input() @gridColumnWidth, @gridGutterWidth Generate the pixel grid system for input elements, accounting for padding and borders
.makeColumn @columns: 1, @offset: 0 Turn any div into a grid column without the .span* classes

CSS3 properties

Mixin Parameters Usage
.border-radius() @radius Round the corners of an element. Can be a single value or four space-separated values
.box-shadow() @shadow Add a drop shadow to an element
.transition() @transition Add CSS3 transition effect (e.g., all .2s linear)
.rotate() @degrees Rotate an element n degrees
.scale() @ratio Scale an element to n times its original size
.translate() @x, @y Move an element on the x and y planes
.background-clip() @clip Crop the background of an element (useful for border-radius)
.background-size() @size Control the size of background images via CSS3
.box-sizing() @boxmodel Change the box model for an element (e.g., border-box for a full-width input)
.user-select() @select Control cursor selection of text on a page
.backface-visibility() @visibility: visible Prevent flickering of content when using CSS 3D transforms
.resizable() @direction: both Make any element resizable on the right and bottom
.content-columns() @columnCount, @columnGap: @gridGutterWidth Make the content of any element use CSS3 columns

Backgrounds and gradients

Mixin Parameters Usage
#translucent > .background() @color: @white, @alpha: 1 Give an element a translucent background color
#translucent > .border() @color: @white, @alpha: 1 Give an element a translucent border color
#gradient > .vertical() @startColor, @endColor Create a cross-browser vertical background gradient
#gradient > .horizontal() @startColor, @endColor Create a cross-browser horizontal background gradient
#gradient > .directional() @startColor, @endColor, @deg Create a cross-browser directional background gradient
#gradient > .vertical-three-colors() @startColor, @midColor, @colorStop, @endColor Create a cross-browser three-color background gradient
#gradient > .radial() @innerColor, @outerColor Create a cross-browser radial background gradient
#gradient > .striped() @color, @angle Create a cross-browser striped background gradient
#gradientBar() @primaryColor, @secondaryColor Used for buttons to assign a gradient and slightly darker border
Note: If you're submitting a pull request to GitHub with modified CSS, you must recompile the CSS via any of these methods.

Tools for compiling

Node with makefile

Install the LESS command line compiler and uglify-js globally with npm by running the following command:

$ npm install -g less uglify-js

Once installed just run make from the root of your bootstrap directory and you're all set.

Additionally, if you have watchr installed, you may run make watch to have bootstrap automatically rebuilt every time you edit a file in the bootstrap lib (this isn't required, just a convenience method).

Command line

Install the LESS command line tool via Node and run the following command:

$ lessc ./less/bootstrap.less > bootstrap.css

Be sure to include --compress in that command if you're trying to save some bytes!

Javascript

Download the latest Less.js and include the path to it (and Bootstrap) in the <head>.

<link rel="stylesheet/less" href="/path/to/bootstrap.less">
<script src="/path/to/less.js"></script>

To recompile the .less files, just save them and reload your page. Less.js compiles them and stores them in local storage.

Unofficial Mac app

The unofficial Mac app watches directories of .less files and compiles the code to local files after every save of a watched .less file.

If you like, you can toggle preferences in the app for automatic minifying and which directory the compiled files end up in.

More Mac apps

Crunch

Crunch is a great looking LESS editor and compiler built on Adobe Air.

CodeKit

Created by the same guy as the unofficial Mac app, CodeKit is a Mac app that compiles LESS, SASS, Stylus, and CoffeeScript.

Simpless

Mac, Linux, and PC app for drag and drop compiling of LESS files. Plus, the source code is on GitHub.