- Navigation has two parts one .navbar for Navigation header and other items.
- By default responsive.
- By adding .d-print for printing navbar.
- If you use div instead of nav use role="navigation".
- Navigation bar with collapse button.
- <nav class="navbar" id="">
- Navigation bar with expand all menu items
- <nav class="navbar navbar-expand-lg" id="">
- navbar + navbar-expand + color shcheme (navbar for Navigation header).
- navbar + .navbar-expand{-sm|-md|-lg|-xl} and if required use color scheme classes but myClass can solve color and background color scheme.
- Operational containers .navbar-expand{-sm|-md|-lg|-xl} manage horizontal widths.
- Sample
- <nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top myClass" id="">
- Sibling Elements
- Brand icon
- .navbar-brand - icon/logo/mini title with anchor in navbar
- <a class="navbar-brand" href="#">
<i class="fa fa-... CustomClass" ></i>
<span class="myCustomClass">Excellent Programming Tricks</span>
</a> - Collapse button
- <button class="navbar-toggler navbar-toggler-right" id="myID" type="button" data-toggle="collapse" data-target = "#navbarSupportedContent" aria-controls = "navbarSupportedContent" aria-expanded="true" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button> - Items
- .collapse .navbar-collapse for grouping and hiding navbar contents
- <div class="collapse navbar-collapse" id="navbarSupportedContent">
- .navbar-nav for dropdown menu with height and weight navigation
- <ul class="navbar-nav ml-auto">
- nav-item and .nav-link as shown below
- <li class="nav-item"><a class="nav-link" href= "about.html" > About </a></li>.
- Dropdown (submenu) - wrap + position
- <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="DropdownID" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown link
</a>
<div class="dropdown-menu" aria-labelledby="DropdownID">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li> - sample
- Grid
- Always .container + .row + .col
- Use only one class container but if you need you can use more than one but nested container class is not allowed in bootstrap.
- .container-fluid:
- When you change widow size it continuously its size also.
- Responsive
- Full screen
- .container:
- When you change window size its also change its size but specific point.
- Responsive.
- Gap between container
- Column class has different tag elements.
- <div class="container"><div class="row"><div class="col-md-4">title</div><ul class="col-md-8">list items (inline) </ul></div></div>
- .clearfix Float problem
- Clear float
- Use in parent sometimes
- Centering
- div items
- .mx-auto
- Horizontally center.
- Block item
- With width property
- heading {h1-h6]
- <h3 class="text-center">...</h3>
- Spacing
- Format for xs {property}{sides}-{size}
- Format for sm, md, lg, and xl {property}{sides}-{breakpoint}-{size}.
- <h3 id="about" class="py-5 text-center">About Myself</h3> --py-5 means padding both top and bottom with some calculated value.
- <h3 id="about" class="ml-0 text-center">About Myself</h3> --ml-0 means margin left with zero value.
- Typography
- class
- .lead -- more size and weight than parent.
- .text-right
- Tag
- <strong> --bold
- Color
- Text
- text-muted -- color(#777) like gray.
- Media
- Embedded
- <div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item" src="" allowfullscreen></iframe>
</div> - List
- Inline
- Elements in a row means inline list [remove bullet].
- <ul class="list-inline"> <li class="list-inline-item"></li></ul>
- One by one
- <ul class="list-group">
<li class="list-group-item">Freelancer iftekhar</li>
<li class="list-group-item disabled">Disable?</li></ul> - <div class="list-group">
<a href="#" class="list-group-item list-group-item-action active">
Galib </a>
<a href="#" class="list-group-item list-group-item-action">Normal</a>
<a href="#" class="list-group-item list-group-item-action disabled">Disable</a>
</div> - <div class="list-group">
<button type="button" class="list-group-item list-group-item-action active">Galib</button>
<button type="button" class="list-group-item list-group-item-action">Normal</button>
<button type="button" class="list-group-item list-group-item-action" disabled>Disable</button>
</div> - Form
- Form elements in a row means inline form
- <form class="form-inline"><input ...</div>
- Add some structure. Mainly margin-bottom with label and also controlling padding.
- <div class="form-group"></div>
- Use form-group class only when require.
- Textual inputs with 100% width.
- .form-control
- File inputs
- .form-control-file
- If label is not present in form use .sr-only.
- Form input-group
- Noting special just use input-group class with parent element.
- Glyphicon
- Not present in bootstpra v 4
- .sr-only
- Visually hidden but screen readers can access.
- Information for non-visual user.
- If label is not present in form use .sr-only
- <label class="sr-only">Email Address</label>
- Attributes
- role="": Required | Functionality | Good way to communicate whit modern device.
- We use meta(information of site), banner(site oriented not page oriented), navigation(every page may be involved), etc.
- Class and id not describe the role.
- <button role="navigation"> -- It doesn't mean that button is a navigation. Button relation/purpose with navigation.
- Misuse of curly brackets in HTML5.
- HTML roles used in Bootstrap
- role="form"
- aria-describedby: Relationship with other elements
- <input type="email" aria-describedby="emailHelp"><p id="emailHelp">...</p>
Ref: https://getbootstrap.com/
No comments:
Post a Comment