Elementor Header #8

21. Рамки

Рамки в CSS используются для создания границ вокруг элементов на веб-странице. Они помогают выделить контент, создать визуальную иерархию и улучшить восприятие информации. Рамки можно применять к любым HTML-элементам, используя свойство border и его производные. В этом уроке мы рассмотрим основные свойства для работы с рамками и предоставим примеры их использования.

Свойства рамок

  1. border

    • Основное свойство для создания рамок вокруг элемента.
    • Синтаксис: border: [ширина] [стиль] [цвет];
    • Примеры: border: 1px solid black;
  2. border-width

    • Определяет ширину рамки.
    • Синтаксис: border-width: [значение];
    • Значения: thin, medium, thick или конкретные единицы (например, 1px, 2em).
  3. border-style

    • Определяет стиль рамки.
    • Синтаксис: border-style: [значение];
    • Значения: none, solid, dashed, dotted, double, groove, ridge, inset, outset.
  4. border-color

    • Определяет цвет рамки.
    • Синтаксис: border-color: [значение];
    • Значения: любой цветовой код, например, #000000, rgb(0,0,0), rgba(0,0,0,0.5), hsl(0,0%,0%).
  5. border-radius

    • Определяет закругление углов рамки.
    • Синтаксис: border-radius: [значение];
    • Значения: единицы (например, 10px, 1em) или процентные значения (например, 50%).
  6. border-collapse

    • Определяет, как рамки таблицы отображаются.
    • Синтаксис: border-collapse: [значение];
    • Значения: collapse, separate.
  7. border-spacing

    • Определяет расстояние между границами ячеек в таблице.
    • Синтаксис: border-spacing: [значение];

Примеры использования

Пример 1: Основное использование рамок

				
					<!DOCTYPE html>
<html>
<head>
    <style>
        .box {
            border: 2px solid #000; /* Ширина, стиль и цвет рамки */
            padding: 20px; /* Отступы внутри рамки */
            margin: 10px; /* Отступы снаружи рамки */
        }
        .dashed-border {
            border: 3px dashed red; /* Пунктирная красная рамка */
        }
        .rounded-border {
            border: 2px solid blue; /* Синяя сплошная рамка */
            border-radius: 10px; /* Закругленные углы */
        }
        .colorful-border {
            border-width: 5px; /* Ширина рамки */
            border-style: solid; /* Сплошная рамка */
            border-color: green red blue yellow; /* Цвета для каждой стороны */
        }
    </style>
</head>
<body>
    <div class="box">Основная рамка</div>
    <div class="dashed-border">Пунктирная рамка</div>
    <div class="rounded-border">Закругленные углы</div>
    <div class="colorful-border">Цветная рамка</div>
<script>"use strict";function wprRemoveCPCSS(){var preload_stylesheets=document.querySelectorAll('link[data-rocket-async="style"][rel="preload"]');if(preload_stylesheets&&0<preload_stylesheets.length)for(var stylesheet_index=0;stylesheet_index<preload_stylesheets.length;stylesheet_index++){var media=preload_stylesheets[stylesheet_index].getAttribute("media")||"all";if(window.matchMedia(media).matches)return void setTimeout(wprRemoveCPCSS,200)}var elem=document.getElementById("rocket-critical-css");elem&&"remove"in elem&&elem.remove()}window.addEventListener?window.addEventListener("load",wprRemoveCPCSS):window.attachEvent&&window.attachEvent("onload",wprRemoveCPCSS);</script><script>class RocketElementorAnimation{constructor(){this.deviceMode=document.createElement("span"),this.deviceMode.id="elementor-device-mode-wpr",this.deviceMode.setAttribute("class","elementor-screen-only"),document.body.appendChild(this.deviceMode)}_detectAnimations(){let t=getComputedStyle(this.deviceMode,":after").content.replace(/"/g,"");this.animationSettingKeys=this._listAnimationSettingsKeys(t),document.querySelectorAll(".elementor-invisible[data-settings]").forEach(t=>{const e=t.getBoundingClientRect();if(e.bottom>=0&&e.top<=window.innerHeight)try{this._animateElement(t)}catch(t){}})}_animateElement(t){const e=JSON.parse(t.dataset.settings),i=e._animation_delay||e.animation_delay||0,n=e[this.animationSettingKeys.find(t=>e[t])];if("none"===n)return void t.classList.remove("elementor-invisible");t.classList.remove(n),this.currentAnimation&&t.classList.remove(this.currentAnimation),this.currentAnimation=n;let s=setTimeout(()=>{t.classList.remove("elementor-invisible"),t.classList.add("animated",n),this._removeAnimationSettings(t,e)},i);window.addEventListener("rocket-startLoading",function(){clearTimeout(s)})}_listAnimationSettingsKeys(t="mobile"){const e=[""];switch(t){case"mobile":e.unshift("_mobile");case"tablet":e.unshift("_tablet");case"desktop":e.unshift("_desktop")}const i=[];return["animation","_animation"].forEach(t=>{e.forEach(e=>{i.push(t+e)})}),i}_removeAnimationSettings(t,e){this._listAnimationSettingsKeys().forEach(t=>delete e[t]),t.dataset.settings=JSON.stringify(e)}static run(){const t=new RocketElementorAnimation;requestAnimationFrame(t._detectAnimations.bind(t))}}document.addEventListener("DOMContentLoaded",RocketElementorAnimation.run);</script><noscript><link rel='stylesheet' id='hello-elementor-theme-style-css' href='https://codefor.tech/wp-content/themes/hello-elementor/theme.min.css?ver=3.0.2' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-hello-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/integration/themes/hello-elementor/assets/css/style.css?ver=1724486282' media='all' /><link rel='stylesheet' id='sweetalert2-css' href='https://codefor.tech/wp-content/plugins/user-registration/assets/css/sweetalert2/sweetalert2.min.css?ver=10.16.7' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-general-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-smallscreen-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration-smallscreen.css?ver=1724486282' media='only screen and (max-width: 768px)' /><link data-minify="1" rel='stylesheet' id='user-registration-my-account-layout-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/my-account-layout.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='dashicons-css' href='https://codefor.tech/wp-content/cache/min/1/wp-includes/css/dashicons.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='hello-elementor-css' href='https://codefor.tech/wp-content/themes/hello-elementor/style.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='hello-elementor-header-footer-css' href='https://codefor.tech/wp-content/themes/hello-elementor/header-footer.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='elementor-frontend-css' href='https://codefor.tech/wp-content/plugins/elementor/assets/css/frontend-lite.min.css?ver=3.21.8' media='all' /><link rel='stylesheet' id='elementor-post-6-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-6.css?ver=1718118435' media='all' /><link data-minify="1" rel='stylesheet' id='font-awesome-all-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/all.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='font-awesome-v4-shims-css' href='https://codefor.tech/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/v4-shims.min.css?ver=5.12.0' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-public-styles-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/css/public.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='swiper-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/elementor/assets/lib/swiper/v8/css/swiper.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='elementor-pro-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/frontend-lite.min.css?ver=3.21.3' media='all' /><link rel='stylesheet' id='elementor-global-css' href='https://codefor.tech/wp-content/uploads/elementor/css/global.css?ver=1718118436' media='all' /><link rel='stylesheet' id='elementor-post-1907-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-1907.css?ver=1722992142' media='all' /><link rel='stylesheet' id='elementor-post-8-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-8.css?ver=1719760051' media='all' /><link rel='stylesheet' id='elementor-post-42-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-42.css?ver=1718469014' media='all' /><link rel='stylesheet' id='jquery-chosen-css' href='https://codefor.tech/wp-content/plugins/jet-search/assets/lib/chosen/chosen.min.css?ver=1.8.7' media='all' /><link data-minify="1" rel='stylesheet' id='jet-search-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-search/assets/css/jet-search.css?ver=1724486282' media='all' /><link rel='stylesheet' id='google-fonts-1-css' href='https://fonts.googleapis.com/css?family=Roboto%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic%7CRoboto+Slab%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic&#038;display=swap&#038;subset=cyrillic&#038;ver=6.6.2' media='all' /><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/widget-theme-elements.min.css"><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor/assets/css/widget-icon-list.min.css"><link rel='stylesheet' id='elementor-post-416-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-416.css?ver=1724268811' media='all' /><link rel='stylesheet' id='elementor-post-471-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-471.css?ver=1722847712' media='all' /><link rel='stylesheet' id='prismjs_style-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/modules/code-highlight.min.css?ver=1.23.0' media='' /><link data-minify="1" rel='stylesheet' id='mailpoet_public-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/mailpoet/assets/dist/css/mailpoet-public.c7ad0042.css?ver=1724486282' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_0-css' href='https://fonts.googleapis.com/css?family=Abril+FatFace%3A400%2C400i%2C700%2C700i%7CAlegreya%3A400%2C400i%2C700%2C700i%7CAlegreya+Sans%3A400%2C400i%2C700%2C700i%7CAmatic+SC%3A400%2C400i%2C700%2C700i%7CAnonymous+Pro%3A400%2C400i%2C700%2C700i%7CArchitects+Daughter%3A400%2C400i%2C700%2C700i%7CArchivo%3A400%2C400i%2C700%2C700i%7CArchivo+Narrow%3A400%2C400i%2C700%2C700i%7CAsap%3A400%2C400i%2C700%2C700i%7CBarlow%3A400%2C400i%2C700%2C700i%7CBioRhyme%3A400%2C400i%2C700%2C700i%7CBonbon%3A400%2C400i%2C700%2C700i%7CCabin%3A400%2C400i%2C700%2C700i%7CCairo%3A400%2C400i%2C700%2C700i%7CCardo%3A400%2C400i%2C700%2C700i%7CChivo%3A400%2C400i%2C700%2C700i%7CConcert+One%3A400%2C400i%2C700%2C700i%7CCormorant%3A400%2C400i%2C700%2C700i%7CCrimson+Text%3A400%2C400i%2C700%2C700i%7CEczar%3A400%2C400i%2C700%2C700i%7CExo+2%3A400%2C400i%2C700%2C700i%7CFira+Sans%3A400%2C400i%2C700%2C700i%7CFjalla+One%3A400%2C400i%2C700%2C700i%7CFrank+Ruhl+Libre%3A400%2C400i%2C700%2C700i%7CGreat+Vibes%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_1-css' href='https://fonts.googleapis.com/css?family=Heebo%3A400%2C400i%2C700%2C700i%7CIBM+Plex%3A400%2C400i%2C700%2C700i%7CInconsolata%3A400%2C400i%2C700%2C700i%7CIndie+Flower%3A400%2C400i%2C700%2C700i%7CInknut+Antiqua%3A400%2C400i%2C700%2C700i%7CInter%3A400%2C400i%2C700%2C700i%7CKarla%3A400%2C400i%2C700%2C700i%7CLibre+Baskerville%3A400%2C400i%2C700%2C700i%7CLibre+Franklin%3A400%2C400i%2C700%2C700i%7CMontserrat%3A400%2C400i%2C700%2C700i%7CNeuton%3A400%2C400i%2C700%2C700i%7CNotable%3A400%2C400i%2C700%2C700i%7CNothing+You+Could+Do%3A400%2C400i%2C700%2C700i%7CNoto+Sans%3A400%2C400i%2C700%2C700i%7CNunito%3A400%2C400i%2C700%2C700i%7COld+Standard+TT%3A400%2C400i%2C700%2C700i%7COxygen%3A400%2C400i%2C700%2C700i%7CPacifico%3A400%2C400i%2C700%2C700i%7CPoppins%3A400%2C400i%2C700%2C700i%7CProza+Libre%3A400%2C400i%2C700%2C700i%7CPT+Sans%3A400%2C400i%2C700%2C700i%7CPT+Serif%3A400%2C400i%2C700%2C700i%7CRakkas%3A400%2C400i%2C700%2C700i%7CReenie+Beanie%3A400%2C400i%2C700%2C700i%7CRoboto+Slab%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_2-css' href='https://fonts.googleapis.com/css?family=Ropa+Sans%3A400%2C400i%2C700%2C700i%7CRubik%3A400%2C400i%2C700%2C700i%7CShadows+Into+Light%3A400%2C400i%2C700%2C700i%7CSpace+Mono%3A400%2C400i%2C700%2C700i%7CSpectral%3A400%2C400i%2C700%2C700i%7CSue+Ellen+Francisco%3A400%2C400i%2C700%2C700i%7CTitillium+Web%3A400%2C400i%2C700%2C700i%7CUbuntu%3A400%2C400i%2C700%2C700i%7CVarela%3A400%2C400i%2C700%2C700i%7CVollkorn%3A400%2C400i%2C700%2C700i%7CWork+Sans%3A400%2C400i%2C700%2C700i%7CYatra+One%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='elementor-post-487-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-487.css?ver=1719159596' media='all' /><link rel='stylesheet' id='elementor-post-497-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-497.css?ver=1724485504' media='all' /><link rel='stylesheet' id='elementor-post-503-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-503.css?ver=1718466482' media='all' /><link rel='stylesheet' id='elementor-post-329-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-329.css?ver=1718467092' media='all' /></noscript></body>
</html>

				
			

Пример 2: Рамки в таблицах

				
					<!DOCTYPE html>
<html>
<head>
    <style>
        table {
            border-collapse: collapse; /* Объединение рамок таблицы */
            width: 100%; /* Ширина таблицы */
        }
        th, td {
            border: 1px solid black; /* Рамка для ячеек таблицы */
            padding: 10px; /* Отступы внутри ячеек */
        }
        th {
            background-color: #f2f2f2; /* Цвет фона для заголовков таблицы */
        }
    </style>
</head>
<body>
    <table>
        <tr>
            <th>Заголовок 1</th>
            <th>Заголовок 2</th>
        </tr>
        <tr>
            <td>Ячейка 1</td>
            <td>Ячейка 2</td>
        </tr>
        <tr>
            <td>Ячейка 3</td>
            <td>Ячейка 4</td>
        </tr>
    </table>
<noscript><link rel='stylesheet' id='hello-elementor-theme-style-css' href='https://codefor.tech/wp-content/themes/hello-elementor/theme.min.css?ver=3.0.2' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-hello-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/integration/themes/hello-elementor/assets/css/style.css?ver=1724486282' media='all' /><link rel='stylesheet' id='sweetalert2-css' href='https://codefor.tech/wp-content/plugins/user-registration/assets/css/sweetalert2/sweetalert2.min.css?ver=10.16.7' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-general-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-smallscreen-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration-smallscreen.css?ver=1724486282' media='only screen and (max-width: 768px)' /><link data-minify="1" rel='stylesheet' id='user-registration-my-account-layout-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/my-account-layout.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='dashicons-css' href='https://codefor.tech/wp-content/cache/min/1/wp-includes/css/dashicons.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='hello-elementor-css' href='https://codefor.tech/wp-content/themes/hello-elementor/style.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='hello-elementor-header-footer-css' href='https://codefor.tech/wp-content/themes/hello-elementor/header-footer.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='elementor-frontend-css' href='https://codefor.tech/wp-content/plugins/elementor/assets/css/frontend-lite.min.css?ver=3.21.8' media='all' /><link rel='stylesheet' id='elementor-post-6-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-6.css?ver=1718118435' media='all' /><link data-minify="1" rel='stylesheet' id='font-awesome-all-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/all.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='font-awesome-v4-shims-css' href='https://codefor.tech/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/v4-shims.min.css?ver=5.12.0' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-public-styles-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/css/public.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='swiper-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/elementor/assets/lib/swiper/v8/css/swiper.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='elementor-pro-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/frontend-lite.min.css?ver=3.21.3' media='all' /><link rel='stylesheet' id='elementor-global-css' href='https://codefor.tech/wp-content/uploads/elementor/css/global.css?ver=1718118436' media='all' /><link rel='stylesheet' id='elementor-post-1907-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-1907.css?ver=1722992142' media='all' /><link rel='stylesheet' id='elementor-post-8-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-8.css?ver=1719760051' media='all' /><link rel='stylesheet' id='elementor-post-42-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-42.css?ver=1718469014' media='all' /><link rel='stylesheet' id='jquery-chosen-css' href='https://codefor.tech/wp-content/plugins/jet-search/assets/lib/chosen/chosen.min.css?ver=1.8.7' media='all' /><link data-minify="1" rel='stylesheet' id='jet-search-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-search/assets/css/jet-search.css?ver=1724486282' media='all' /><link rel='stylesheet' id='google-fonts-1-css' href='https://fonts.googleapis.com/css?family=Roboto%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic%7CRoboto+Slab%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic&#038;display=swap&#038;subset=cyrillic&#038;ver=6.6.2' media='all' /><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/widget-theme-elements.min.css"><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor/assets/css/widget-icon-list.min.css"><link rel='stylesheet' id='elementor-post-416-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-416.css?ver=1724268811' media='all' /><link rel='stylesheet' id='elementor-post-471-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-471.css?ver=1722847712' media='all' /><link rel='stylesheet' id='prismjs_style-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/modules/code-highlight.min.css?ver=1.23.0' media='' /><link data-minify="1" rel='stylesheet' id='mailpoet_public-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/mailpoet/assets/dist/css/mailpoet-public.c7ad0042.css?ver=1724486282' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_0-css' href='https://fonts.googleapis.com/css?family=Abril+FatFace%3A400%2C400i%2C700%2C700i%7CAlegreya%3A400%2C400i%2C700%2C700i%7CAlegreya+Sans%3A400%2C400i%2C700%2C700i%7CAmatic+SC%3A400%2C400i%2C700%2C700i%7CAnonymous+Pro%3A400%2C400i%2C700%2C700i%7CArchitects+Daughter%3A400%2C400i%2C700%2C700i%7CArchivo%3A400%2C400i%2C700%2C700i%7CArchivo+Narrow%3A400%2C400i%2C700%2C700i%7CAsap%3A400%2C400i%2C700%2C700i%7CBarlow%3A400%2C400i%2C700%2C700i%7CBioRhyme%3A400%2C400i%2C700%2C700i%7CBonbon%3A400%2C400i%2C700%2C700i%7CCabin%3A400%2C400i%2C700%2C700i%7CCairo%3A400%2C400i%2C700%2C700i%7CCardo%3A400%2C400i%2C700%2C700i%7CChivo%3A400%2C400i%2C700%2C700i%7CConcert+One%3A400%2C400i%2C700%2C700i%7CCormorant%3A400%2C400i%2C700%2C700i%7CCrimson+Text%3A400%2C400i%2C700%2C700i%7CEczar%3A400%2C400i%2C700%2C700i%7CExo+2%3A400%2C400i%2C700%2C700i%7CFira+Sans%3A400%2C400i%2C700%2C700i%7CFjalla+One%3A400%2C400i%2C700%2C700i%7CFrank+Ruhl+Libre%3A400%2C400i%2C700%2C700i%7CGreat+Vibes%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_1-css' href='https://fonts.googleapis.com/css?family=Heebo%3A400%2C400i%2C700%2C700i%7CIBM+Plex%3A400%2C400i%2C700%2C700i%7CInconsolata%3A400%2C400i%2C700%2C700i%7CIndie+Flower%3A400%2C400i%2C700%2C700i%7CInknut+Antiqua%3A400%2C400i%2C700%2C700i%7CInter%3A400%2C400i%2C700%2C700i%7CKarla%3A400%2C400i%2C700%2C700i%7CLibre+Baskerville%3A400%2C400i%2C700%2C700i%7CLibre+Franklin%3A400%2C400i%2C700%2C700i%7CMontserrat%3A400%2C400i%2C700%2C700i%7CNeuton%3A400%2C400i%2C700%2C700i%7CNotable%3A400%2C400i%2C700%2C700i%7CNothing+You+Could+Do%3A400%2C400i%2C700%2C700i%7CNoto+Sans%3A400%2C400i%2C700%2C700i%7CNunito%3A400%2C400i%2C700%2C700i%7COld+Standard+TT%3A400%2C400i%2C700%2C700i%7COxygen%3A400%2C400i%2C700%2C700i%7CPacifico%3A400%2C400i%2C700%2C700i%7CPoppins%3A400%2C400i%2C700%2C700i%7CProza+Libre%3A400%2C400i%2C700%2C700i%7CPT+Sans%3A400%2C400i%2C700%2C700i%7CPT+Serif%3A400%2C400i%2C700%2C700i%7CRakkas%3A400%2C400i%2C700%2C700i%7CReenie+Beanie%3A400%2C400i%2C700%2C700i%7CRoboto+Slab%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_2-css' href='https://fonts.googleapis.com/css?family=Ropa+Sans%3A400%2C400i%2C700%2C700i%7CRubik%3A400%2C400i%2C700%2C700i%7CShadows+Into+Light%3A400%2C400i%2C700%2C700i%7CSpace+Mono%3A400%2C400i%2C700%2C700i%7CSpectral%3A400%2C400i%2C700%2C700i%7CSue+Ellen+Francisco%3A400%2C400i%2C700%2C700i%7CTitillium+Web%3A400%2C400i%2C700%2C700i%7CUbuntu%3A400%2C400i%2C700%2C700i%7CVarela%3A400%2C400i%2C700%2C700i%7CVollkorn%3A400%2C400i%2C700%2C700i%7CWork+Sans%3A400%2C400i%2C700%2C700i%7CYatra+One%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='elementor-post-487-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-487.css?ver=1719159596' media='all' /><link rel='stylesheet' id='elementor-post-497-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-497.css?ver=1724485504' media='all' /><link rel='stylesheet' id='elementor-post-503-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-503.css?ver=1718466482' media='all' /><link rel='stylesheet' id='elementor-post-329-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-329.css?ver=1718467092' media='all' /></noscript></body>
</html>

				
			

Распространённые ошибки

  1. Игнорирование единиц измерения: Не указывайте ширину рамки без единиц измерения. Например, border-width: 5; вместо border-width: 5px;.

  2. Неправильное использование стилей рамки: Например, использование border-style: solid без указания ширины и цвета рамки. Это может привести к отсутствию видимой рамки.

  3. Неправильное использование border-radius: Убедитесь, что значения border-radius соответствуют ожиданиям. Например, неправильное значение может привести к некрасивым или неожиданным закруглениям углов.

  4. Неоптимизированные цвета рамки: Выбирайте цвета рамки так, чтобы они сочетались с фоном и не создавали визуального дискомфорта.

  5. Неудобные размеры и стили рамок: Убедитесь, что размеры и стили рамок соответствуют общему дизайну сайта и не нарушают его визуальное восприятие.

Заключение

Рамки — это мощный инструмент в CSS для создания визуальных разделений и акцентов. Понимание свойств рамок и их правильное применение позволяет создавать стильные и хорошо структурированные веб-страницы. От основных стилей и ширин до сложных цветных рамок и закруглений — использование этих свойств поможет вам улучшить визуальное оформление вашего сайта.

Тестовое задание

  1. Создайте HTML-документ с несколькими элементами (например, блоки, изображения, таблицы).
  2. Примените различные стили рамок к этим элементам, используя свойства border, border-width, border-style, border-color, и border-radius.
  3. Настройте рамки для таблицы, включая свойства border-collapse и border-spacing.

HTML-документ:

				
					<!DOCTYPE html>
<html>
<head>
    <style>
        .container {
            width: 80%;
            margin: auto;
            padding: 20px;
        }
        .box {
            border: 2px solid #007BFF; /* Синяя рамка */
            padding: 20px;
            margin-bottom: 10px;
        }
        .rounded {
            border-radius: 15px; /* Закругленные углы */
        }
        .dotted {
            border: 2px dotted green; /* Зеленая пунктирная рамка */
        }
        .table-container {
            border-collapse: separate; /* Раздельные рамки для таблицы */
            border-spacing: 10px; /* Расстояние между ячейками */
        }
        table {
            width: 100%;
            border-collapse: collapse; /* Объединение рамок таблицы */
        }
        th, td {
            border: 1px solid black; /* Рамка для ячеек таблицы */
            padding: 10px;
        }
        th {
            background-color: #f4f4f4; /* Цвет фона для заголовков таблицы */
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="box rounded">Блок с закругленными углами</div>
        <div class="box dotted">Блок с пунктирной рамкой</div>
        <div class="table-container">
            <table>
                <tr>
                    <th>Название</th>
                    <th>Описание</th>
                </tr>
                <tr>
                    <td>Элемент 1</td>
                    <td>Описание 1</td>
                </tr>
                <tr>
                    <td>Элемент 2</td>
                    <td>Описание 2</td>
                </tr>
            </table>
        </div>
    </div>
<noscript><link rel='stylesheet' id='hello-elementor-theme-style-css' href='https://codefor.tech/wp-content/themes/hello-elementor/theme.min.css?ver=3.0.2' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-hello-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/integration/themes/hello-elementor/assets/css/style.css?ver=1724486282' media='all' /><link rel='stylesheet' id='sweetalert2-css' href='https://codefor.tech/wp-content/plugins/user-registration/assets/css/sweetalert2/sweetalert2.min.css?ver=10.16.7' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-general-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='user-registration-smallscreen-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/user-registration-smallscreen.css?ver=1724486282' media='only screen and (max-width: 768px)' /><link data-minify="1" rel='stylesheet' id='user-registration-my-account-layout-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/user-registration/assets/css/my-account-layout.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='dashicons-css' href='https://codefor.tech/wp-content/cache/min/1/wp-includes/css/dashicons.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='hello-elementor-css' href='https://codefor.tech/wp-content/themes/hello-elementor/style.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='hello-elementor-header-footer-css' href='https://codefor.tech/wp-content/themes/hello-elementor/header-footer.min.css?ver=3.0.2' media='all' /><link rel='stylesheet' id='elementor-frontend-css' href='https://codefor.tech/wp-content/plugins/elementor/assets/css/frontend-lite.min.css?ver=3.21.8' media='all' /><link rel='stylesheet' id='elementor-post-6-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-6.css?ver=1718118435' media='all' /><link data-minify="1" rel='stylesheet' id='font-awesome-all-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/all.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='font-awesome-v4-shims-css' href='https://codefor.tech/wp-content/plugins/jet-menu/assets/public/lib/font-awesome/css/v4-shims.min.css?ver=5.12.0' media='all' /><link data-minify="1" rel='stylesheet' id='jet-menu-public-styles-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-menu/assets/public/css/public.css?ver=1724486282' media='all' /><link data-minify="1" rel='stylesheet' id='swiper-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/elementor/assets/lib/swiper/v8/css/swiper.min.css?ver=1724486282' media='all' /><link rel='stylesheet' id='elementor-pro-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/frontend-lite.min.css?ver=3.21.3' media='all' /><link rel='stylesheet' id='elementor-global-css' href='https://codefor.tech/wp-content/uploads/elementor/css/global.css?ver=1718118436' media='all' /><link rel='stylesheet' id='elementor-post-1907-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-1907.css?ver=1722992142' media='all' /><link rel='stylesheet' id='elementor-post-8-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-8.css?ver=1719760051' media='all' /><link rel='stylesheet' id='elementor-post-42-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-42.css?ver=1718469014' media='all' /><link rel='stylesheet' id='jquery-chosen-css' href='https://codefor.tech/wp-content/plugins/jet-search/assets/lib/chosen/chosen.min.css?ver=1.8.7' media='all' /><link data-minify="1" rel='stylesheet' id='jet-search-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/jet-search/assets/css/jet-search.css?ver=1724486282' media='all' /><link rel='stylesheet' id='google-fonts-1-css' href='https://fonts.googleapis.com/css?family=Roboto%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic%7CRoboto+Slab%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic&#038;display=swap&#038;subset=cyrillic&#038;ver=6.6.2' media='all' /><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/widget-theme-elements.min.css"><link rel="stylesheet" href="https://codefor.tech/wp-content/plugins/elementor/assets/css/widget-icon-list.min.css"><link rel='stylesheet' id='elementor-post-416-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-416.css?ver=1724268811' media='all' /><link rel='stylesheet' id='elementor-post-471-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-471.css?ver=1722847712' media='all' /><link rel='stylesheet' id='prismjs_style-css' href='https://codefor.tech/wp-content/plugins/elementor-pro/assets/css/modules/code-highlight.min.css?ver=1.23.0' media='' /><link data-minify="1" rel='stylesheet' id='mailpoet_public-css' href='https://codefor.tech/wp-content/cache/min/1/wp-content/plugins/mailpoet/assets/dist/css/mailpoet-public.c7ad0042.css?ver=1724486282' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_0-css' href='https://fonts.googleapis.com/css?family=Abril+FatFace%3A400%2C400i%2C700%2C700i%7CAlegreya%3A400%2C400i%2C700%2C700i%7CAlegreya+Sans%3A400%2C400i%2C700%2C700i%7CAmatic+SC%3A400%2C400i%2C700%2C700i%7CAnonymous+Pro%3A400%2C400i%2C700%2C700i%7CArchitects+Daughter%3A400%2C400i%2C700%2C700i%7CArchivo%3A400%2C400i%2C700%2C700i%7CArchivo+Narrow%3A400%2C400i%2C700%2C700i%7CAsap%3A400%2C400i%2C700%2C700i%7CBarlow%3A400%2C400i%2C700%2C700i%7CBioRhyme%3A400%2C400i%2C700%2C700i%7CBonbon%3A400%2C400i%2C700%2C700i%7CCabin%3A400%2C400i%2C700%2C700i%7CCairo%3A400%2C400i%2C700%2C700i%7CCardo%3A400%2C400i%2C700%2C700i%7CChivo%3A400%2C400i%2C700%2C700i%7CConcert+One%3A400%2C400i%2C700%2C700i%7CCormorant%3A400%2C400i%2C700%2C700i%7CCrimson+Text%3A400%2C400i%2C700%2C700i%7CEczar%3A400%2C400i%2C700%2C700i%7CExo+2%3A400%2C400i%2C700%2C700i%7CFira+Sans%3A400%2C400i%2C700%2C700i%7CFjalla+One%3A400%2C400i%2C700%2C700i%7CFrank+Ruhl+Libre%3A400%2C400i%2C700%2C700i%7CGreat+Vibes%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_1-css' href='https://fonts.googleapis.com/css?family=Heebo%3A400%2C400i%2C700%2C700i%7CIBM+Plex%3A400%2C400i%2C700%2C700i%7CInconsolata%3A400%2C400i%2C700%2C700i%7CIndie+Flower%3A400%2C400i%2C700%2C700i%7CInknut+Antiqua%3A400%2C400i%2C700%2C700i%7CInter%3A400%2C400i%2C700%2C700i%7CKarla%3A400%2C400i%2C700%2C700i%7CLibre+Baskerville%3A400%2C400i%2C700%2C700i%7CLibre+Franklin%3A400%2C400i%2C700%2C700i%7CMontserrat%3A400%2C400i%2C700%2C700i%7CNeuton%3A400%2C400i%2C700%2C700i%7CNotable%3A400%2C400i%2C700%2C700i%7CNothing+You+Could+Do%3A400%2C400i%2C700%2C700i%7CNoto+Sans%3A400%2C400i%2C700%2C700i%7CNunito%3A400%2C400i%2C700%2C700i%7COld+Standard+TT%3A400%2C400i%2C700%2C700i%7COxygen%3A400%2C400i%2C700%2C700i%7CPacifico%3A400%2C400i%2C700%2C700i%7CPoppins%3A400%2C400i%2C700%2C700i%7CProza+Libre%3A400%2C400i%2C700%2C700i%7CPT+Sans%3A400%2C400i%2C700%2C700i%7CPT+Serif%3A400%2C400i%2C700%2C700i%7CRakkas%3A400%2C400i%2C700%2C700i%7CReenie+Beanie%3A400%2C400i%2C700%2C700i%7CRoboto+Slab%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='mailpoet_custom_fonts_2-css' href='https://fonts.googleapis.com/css?family=Ropa+Sans%3A400%2C400i%2C700%2C700i%7CRubik%3A400%2C400i%2C700%2C700i%7CShadows+Into+Light%3A400%2C400i%2C700%2C700i%7CSpace+Mono%3A400%2C400i%2C700%2C700i%7CSpectral%3A400%2C400i%2C700%2C700i%7CSue+Ellen+Francisco%3A400%2C400i%2C700%2C700i%7CTitillium+Web%3A400%2C400i%2C700%2C700i%7CUbuntu%3A400%2C400i%2C700%2C700i%7CVarela%3A400%2C400i%2C700%2C700i%7CVollkorn%3A400%2C400i%2C700%2C700i%7CWork+Sans%3A400%2C400i%2C700%2C700i%7CYatra+One%3A400%2C400i%2C700%2C700i&#038;ver=6.6.2' media='all' /><link rel='stylesheet' id='elementor-post-487-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-487.css?ver=1719159596' media='all' /><link rel='stylesheet' id='elementor-post-497-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-497.css?ver=1724485504' media='all' /><link rel='stylesheet' id='elementor-post-503-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-503.css?ver=1718466482' media='all' /><link rel='stylesheet' id='elementor-post-329-css' href='https://codefor.tech/wp-content/uploads/elementor/css/post-329.css?ver=1718467092' media='all' /></noscript></body>
</html>

				
			
Выполнив это задание, вы сможете эффективно использовать свойства рамок для создания стильных и функциональных элементов на веб-странице.
logo