Please review the Fiddle Here...
I am trying to separate some elements here and I'm having a tough time. All my div tags appear correctly separated, but I'm not getting the separation.
For example, I've got a button, then a clear, then a paragraph.
But, the paragraph is actually showing up inside the button, after the clear.
<div id="container">
<div id="header">Transfer of Credit Estimator</div>
<div id="content">
<div id="classes">Enter total number of classes estimated for transfer, then click <strong>Estimate</strong>.
</div>
<input type="text" class="" placeholder="#">
<div id="btn">Estimate<div> <!-- Button -->
</div>
<div class="clear"></div>
<p>Hi</p>
<div id="footer">**The Estimator is based on classes that would transfer in as 4-credit courses that cost $1,608 each ($402/credit hour) here at University. The Estimator assumes that each class would be a 5-week class.</div> <!-- Footer -->
</div> <!-- Close Container -->
</div>
On top of that, the footer is taking on attributes from the '.btn' class, such as the font-family and font-weight.
Thoughts on what I'm doing wrong here?
The button div is not closed. It should be:
<div class="btn">Estimate</div>
The button div is not closed
<div id="btn">Estimate<div>
instead it should be
<div id="btn">Estimate</div>
Your browser tries to correct you missing closing tag and that creates the attributes to shift
Related
Currently I have a list like so:
<div class="list">
<div class="padding">
<div class="clickable-item">item 1</div>
</div>
<div class="padding">
<div class="clickable-item">item 2</div>
</div>
</div>
With the keyboard I would like to tab to the clickable-items one after another.
Currently it's tabbing through the 'padding' elements instead.
Is there any way I can tell the browser to ignore the padded parent and tab straight to the child?
Here's a few things to think about:
<div class="clickable-item" /> isn't indicating that it's a clickable item. See: Making a clickable <div> accessible through tab structure? on why using a div isn't always the best solution and using a button or a tag is better for accessibility.
Unlike what Anis R. said, if you want to keep the logical flow for tabbing based on the ordre of the page, you want to use tabindex="0" on the elements.
If you must use a div, think about using <div class"clickable-item" role="button" /> on your div in order to indicate that it is indeed something clickable.
You can set the tabindex attribute on the desired elements. The tab index number determines the order in which the elements are visited.
Edit: As FullOnFlatWhite and Graham Ritchie mentioned, it's generally better to use tab indices of zero (not positive), or use role="button" on your div.
<div class="list">
<div class="padding">
<div class="clickable-item" tabindex="0">item 1</div>
</div>
<div class="padding">
<div class="clickable-item" tabindex="0">item 2</div>
</div>
</div>
I am editing a site to be 3 columns.
Here is example page, currently 2 columns:
https://courses.guitar-dreams.com/lessons/an-introduction-to-triads-and-their-inversions/
So what we have is a header, sidebar, content area, and footer. Seems pretty straightforward. But as I look at the HTML, the structure is so odd. Here is how this page is arranged:
<body>
<div class="learndash-wrapper">
<div class="ld-focus">
<!-- notice how it is starting out with sidebar even though we have 2 headers on top of each other... -->
<div class="ld-focus-sidebar">
<div class="ld-focus-sidebar-wrapper">
<div class="ld-course-navigation">
Here is sidebar navigation content
</div> <!--/.ld-course-navigation-->
</div> <!--/.ld-focus-sidebar-wrapper-->
</div> <!--/.ld-focus-sidebar-->
<!-- ok now the main content -->
<div class="ld-focus-main">
<!-- oh but wait, let's add header first! And namely the 2nd header! -->
<div class="ld-focus-header">
Here is the 2nd header
</div> <!--/.ld-focus-header-->
<!-- ok now that we added 2nd header, let's add main content! -->
<div class="ld-focus-content">
here is main content
</div> <!--/.ld-focus-content-->
</div> <!--/.ld-focus-main-->
</div> <!--/.ld-focus-->
<!--/.ld-learndash-wrapper-->
<!-- Oh wait, now that we are at end, let's add that first header now! -->
<div id="wpadminbar" class="">
The topmost header
</div>
</body>
You see what I mean? I am not a web design expert, but I tend to believe that layout of pages generally should follow similar principles to the document publishing world. That is, if your page starts with header, probably good idea for that to be the first design element that you add, and not the last, and moreover, that the design element, if possible, should be placed in the design environment in a way that has physical correspondence to the rendered document.
I am trying to add a right sidebar to make it a 3 column layout. I tried adding a wrapper div to <div class="ld-focus-main"> with display: flex and followed some of the approaches here:
http://geniuscarrier.com/2-columns-layout-with-flexbox/
<div class="ld-focus-main">
<div class="ld-focus-header">
</div> <!--/.ld-focus-header-->
<div class="mywrapper">
<div class="ld-focus-content">
here is main content
</div> <!--/.ld-focus-content-->
<div class="mysidebar">My sidebar</div>
</div>
</div> <!--/.ld-focus-main-->
Here I used (as inline styles)
.mywrapper {
display: flex;
align-items: center;
}
.ld-focus-content {
flex-grow:1
}
I didn't use properties on the right sidebar since in the example in the link above it suggested that if all is well with wrapper and left then right part will follow suit.
But above doesn't produce desired result. At bottom of page linked above you see my added divs and "My Sidebar". I think part of the problem is that the theme template uses such bizarre placement of divs and properties such that when I try to add that right column the underlying structure is not making it work as expected. Sort of like 2nd, 3rd order effects... as well as a Jenga game within a Jenga game.
I was thinking about just redoing the entire template, but at this point I would prefer to just add a sticky right sidebar without a ton of rework. That said, to me it seems the proper way to do such a layout, syntactically would be
<div class="mainwrapper">
<div class = "firstheader"></div>
<div class = "secondheader"></div>
<div class = "outercontentwrapper"></div>
<div class = "leftnavigation"></div>
<div class = "contentwrapper">
<div class = "maincontent"></div>
<div class = "rightsidebar"></div>
</div>
</div>
<div class = "footer"></div>
</div>
Just not sure all the specific properties such that the page would behave as is now, plus add a right sidebar.
So with all that, how would you go about adding that right column?
Thanks!
Brian
I have a number of controls declared like this.
<div class="row">
<div class="col-sm-12">
<div>Caption</div>
<input type="text" class="form-control">
</div>
</div>
Trying to refactor my code, I introduced a component to encapsulate this particular behavior.
<div class="row">
<app-textbox [caption]="'Caption'"></app-textbox>
</div>
The markup for the component is just a copy of the original code.
<div class="col-sm-12">
<!-- <div style="width:100%;"> -->
<!-- <div class=""> -->
<div>{{data?.caption}}</div>
<input type="text" class="form-control">
</div>
The problem arising is with the class row seems not to propagate to the component. It spreads to the full width (as it's set to 12 but it's not the width of the component holding the class row - it's smaller). Analyzing the markup in the console of the browser, I can see that the only difference is that there's a tag for the custom control injected in the structure like this:
div class="row"
-- app-textbox
-- -- div class="col-sm-12"
-- -- input
while the "old-style" generates this:
div class="row"
-- div class="col-sm-12"
-- input
One way to handle it is to set the columns on the component in the main page like this.
<div class="row">
<app-textbox [caption]="'Caption'" class="col-sm-12"></app-input-text>
</div>
There are, however, two issues that bother me with it making me feel reluctant to this approach. First one is that the component still gets a (very tiny) extra margin of 15px on each side relative to the enclosing component (all the item have it but the custom app-textbox gets it twice, probably due to encapsulation). The other issue is that this kind of defeats the purpose of the encapsulation.
I've tried spreading the width of the components and setting different styles/classes to the input boxes etc. After a few hours, I realize that I'm at a loss.
Is it possible to make the injected tag app-textbox spread fully in its parent?
I had the same issue. Here is the way I solved it.
Original app.component.html:
<div class="container-fluid">
<div class="row">
<app-one></app-one>
<app-two></app-two>
</div>
</div>
Original one.component.html:
<div class="col-9">
<p>One</p>
</div>
Original two.component.html:
<div class="col-3">
<p>Two</p>
</div>
I moved 'col' divs from one and two components to the app component:
New app.component.html:
<div class="container-fluid">
<div class="row">
<div class="col-9">
<app-one></app-one>
</div>
<div class="col-3">
<app-two></app-two>
</div>
</div>
</div>
New one.component.html:
<p>One</p>
New two.component.html:
<p>Two</p>
For css to be visible in all your components, add it directly to the index.html file, or to app.component.css.
For example on the index.html as the last head element include:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#3.3.7/dist/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
That URL was taken from : https://getbootstrap.com/docs/3.3/getting-started/
(I'm assuming that your Angular2 project was generated with angular-cli and the files follow the standard names)
About the extra margin, try checking app.component.html. Maybe there's a container div around it. Also check index.html itself
This is probably an easy one, but I'm new to bootstrap and aren't quite familiar with how it works. I have the following code to create 4 even-width columns in a row. But it keeps showing up as 4 vertically stacked columns on my laptop (1920x1080) and I'm not quite sure where I'm doing it wrong.
<div class="container">
<div class="row-fluid">
<div class="col-md-3"><!--about us feature 1st -->
<div class="about-block">
<div class="heading">
<h6>AVAILABILITY</h6>
<p>Fast Response Time<br> 15 Minutes Setup</p>
</div>
</div>
</div><!--about us feature 1st closed -->
<div class="col-md-3"><!--about us feature 2nd -->
<div class="about-block">
<div class="heading">
<h6>SPEED</h6>
<p>Average 7x Faster<br> Complete Data Coverage</p>
</div>
</div>
</div> <!--about us feature 2nd closed -->
<div class="col-md-3"><!--about us feature 3rd -->
<div class="about-block">
<div class="heading">
<h6>SAFETY</h6>
<p>Reduce Human Risk<br> No Scaffolding</p>
</div>
</div>
</div><!--about us feature 3rd closed -->
<div class="col-md-3"><!--about us feature 4th -->
<div class="about-block">
<div class="heading">
<h6>COST SAVINGS</h6>
<p>Targeted Repairs<br> Less Outage Time</p>
</div>
</div>
</div><!--about us feature 4th closed -->
</div>
</div>
UPDATE Added screenshot:
Use col-sm-3 instead, or make your <div> element wider. If you are using a container directly inside body, you shouldn't have any problem. If you are using inside another element, make sure it is wide enough.
First, try changing row-fluid class to style="float: left". Second, it is true that (in theory) the screen is divided into 12, but 3*4 might be more than 12 (margin, border, etc.). If the first part renders three columns and the 4th underneath, try reducing the size of the columns by setting, for instance, width=24%.
it seems to be simple , our designer made the a design of 3 different forms in one like page
as you may see in this snippet
I don't think we can do this design with valid html in twitter bootstrap grids ?
where you would get the form opening and closing tags and keep it valid
<div class="container">
<div class="col-md-4">
<div class="row"><div class="form1">form1</div></div>
<div class="row"><div class="form2">form2</div></div>
<div class="row"><div class="form3">form3 </div></div>
</div>
<div class="col-md-4">
<div class="row"><div class="form3">continue of form3 </div></div>
</div>
<div class="col-md-4">
<div class="row">
<div class="form3">
continue of form3
</div>
</div>
</div>
</div><!-- /.container -->
You cannot split a form element so that one part is inside one element and another part is inside another element. HTML syntax prevents that.
You can, however, have input elements and other controls outside a form element and associate them functionally with it using form attributes. Browser support is still too limited to make this a feasible option in normal situations.