Border positioning: how to?


Tags: css,positioning,border,border-layout

Problem :

I want to position the border, but this won't work. This is the CSS:

.menu-container {
    border-top: 5px solid #81806E;
    float: left;
    margin: 5px 27px 0 10px;
    width: 704px;
}

The problem is that this container, contains menu links. So if I adjust the width and margin, the border is coming with it. But I want to style it separately... How can I do this?



Solution :

Check the sample design and code with result, is this you want?

HTML:

<div class="menu-container">
      <a class="menu-item" href="#">Menu 1</a>
      <a class="menu-item" href="#">Menu 2</a>
      <a class="menu-item" href="#">Menu 3</a>
      <a class="menu-item" href="#">Menu 4</a>
      <a class="menu-item" href="#">Menu 5</a>
    </div>

CSS:

.menu-container {
    float: left;
    margin: 5px 27px 0 10px;
    width: 704px;
}
.menu-item{
  float:left;
  height:20px;
  margin-right:3px;
  border-top: 5px solid #81806E;
}

    CSS Howto..

    how to put 2 css elements in the same row (one next to each other)?

    How to get the current year using css?

    How to locate which css include is used for an element

    How to only deregister Wordpress stylesheet for non-logged in users?

    how to Styling a “choose file” button using css Only

    How to set background color to the column using CSS?

    How to embedded all resources(css,js,images) into one single html file?

    How to space text like using tab on website?

    how to center text and control user zoom in CSS

    How to use nth-child in CSS to select all elements after the 3rd one?

    How to use horizontal scroll when you have way many columns

    How do you position CSS elements directly under each other?

    How to override a link tag with another in css

    How to force the Sass interpreter to output non-css code?

    CSS how to center ::after pseudo elem

    How to set content to -webkit-slider-thumb

    How can I make a DIV cursor and background color change if I hover over it?

    css how to make the button in the middle of this code [closed]

    how to reduce the size of all component in sencha application

    How does one target IE7 and IE8 with valid CSS?

    How to style focused and visited anchors when scrolling with CSS / jQuery

    how to center perfectly image and text inline in the center of page

    How to Drop 2 nested shadows On 2 Divisions in CSS? [closed]

    How can I add a transition effect when opening my custom modal window?

    Understanding how menus work in html5 and css3

    How can i change background image opacity without changing on div content? [duplicate]

    How to apply “!important” from CSS via jQuery? [duplicate]

    All CSS menu when hover show submenu

    How do i make a div stick down from his div container?

    how decrease font size?