code
stringlengths 2.5k
150k
| kind
stringclasses 1
value |
---|---|
symfony SimplePreAuthenticationFactory SimplePreAuthenticationFactory
===============================
class **SimplePreAuthenticationFactory** implements [SecurityFactoryInterface](securityfactoryinterface "Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface")
Methods
-------
| | | |
| --- | --- | --- |
| string | [getPosition](#method_getPosition)() Defines the position at which the provider is called. | |
| string | [getKey](#method_getKey)() Defines the configuration key used to reference the provider in the firewall configuration. | |
| | [addConfiguration](#method_addConfiguration)([NodeDefinition](../../../../../component/config/definition/builder/nodedefinition "Symfony\Component\Config\Definition\Builder\NodeDefinition") $node) | |
| array | [create](#method_create)([ContainerBuilder](../../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, string $id, array $config, string $userProvider, string $defaultEntryPoint) Configures the container services required to use the authentication listener. | |
Details
-------
### string
getPosition()
Defines the position at which the provider is called.
Possible values: pre\_auth, form, http, and remember\_me.
#### Return Value
| | |
| --- | --- |
| string | |
### string
getKey()
Defines the configuration key used to reference the provider in the firewall configuration.
#### Return Value
| | |
| --- | --- |
| string | |
###
addConfiguration([NodeDefinition](../../../../../component/config/definition/builder/nodedefinition "Symfony\Component\Config\Definition\Builder\NodeDefinition") $node)
#### Parameters
| | | |
| --- | --- | --- |
| [NodeDefinition](../../../../../component/config/definition/builder/nodedefinition "Symfony\Component\Config\Definition\Builder\NodeDefinition") | $node | |
### array
create([ContainerBuilder](../../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, string $id, array $config, string $userProvider, string $defaultEntryPoint)
Configures the container services required to use the authentication listener.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
| string | $id | The unique id of the firewall |
| array | $config | The options array for the listener |
| string | $userProvider | The service id of the user provider |
| string | $defaultEntryPoint | |
#### Return Value
| | |
| --- | --- |
| array | containing three values: - the provider id - the listener id - the entry point id |
symfony AddSessionDomainConstraintPass AddSessionDomainConstraintPass
===============================
class **AddSessionDomainConstraintPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Uses the session domain to restrict allowed redirection targets.
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony RegisterCsrfTokenClearingLogoutHandlerPass RegisterCsrfTokenClearingLogoutHandlerPass
===========================================
class **RegisterCsrfTokenClearingLogoutHandlerPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony AddSecurityVotersPass AddSecurityVotersPass
======================
class **AddSecurityVotersPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Adds all configured security voters to the access decision manager.
Traits
------
| | |
| --- | --- |
| [PriorityTaggedServiceTrait](../../../../component/dependencyinjection/compiler/prioritytaggedservicetrait "Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait") | Trait that allows a generic method to find and sort service by priority option in the tag. |
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony TraceableFirewallListener TraceableFirewallListener
==========================
class **TraceableFirewallListener** extends [FirewallListener](../eventlistener/firewalllistener "Symfony\Bundle\SecurityBundle\EventListener\FirewallListener")
Firewall collecting called listeners.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([FirewallMapInterface](../../../component/security/http/firewallmapinterface "Symfony\Component\Security\Http\FirewallMapInterface") $map, [EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher, [LogoutUrlGenerator](../../../component/security/http/logout/logouturlgenerator "Symfony\Component\Security\Http\Logout\LogoutUrlGenerator") $logoutUrlGenerator) | from [FirewallListener](../eventlistener/firewalllistener#method___construct "Symfony\Bundle\SecurityBundle\EventListener\FirewallListener") |
| | [onKernelRequest](#method_onKernelRequest)([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event) | from [FirewallListener](../eventlistener/firewalllistener#method_onKernelRequest "Symfony\Bundle\SecurityBundle\EventListener\FirewallListener") |
| | [onKernelFinishRequest](#method_onKernelFinishRequest)([FinishRequestEvent](../../../component/httpkernel/event/finishrequestevent "Symfony\Component\HttpKernel\Event\FinishRequestEvent") $event) | from [FirewallListener](../eventlistener/firewalllistener#method_onKernelFinishRequest "Symfony\Bundle\SecurityBundle\EventListener\FirewallListener") |
| static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | from [Firewall](../../../component/security/http/firewall#method_getSubscribedEvents "Symfony\Component\Security\Http\Firewall") |
| | [handleRequest](#method_handleRequest)([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event, $listeners) | |
| | [getWrappedListeners](#method_getWrappedListeners)() | |
Details
-------
###
\_\_construct([FirewallMapInterface](../../../component/security/http/firewallmapinterface "Symfony\Component\Security\Http\FirewallMapInterface") $map, [EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher, [LogoutUrlGenerator](../../../component/security/http/logout/logouturlgenerator "Symfony\Component\Security\Http\Logout\LogoutUrlGenerator") $logoutUrlGenerator)
#### Parameters
| | | |
| --- | --- | --- |
| [FirewallMapInterface](../../../component/security/http/firewallmapinterface "Symfony\Component\Security\Http\FirewallMapInterface") | $map | |
| [EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $dispatcher | |
| [LogoutUrlGenerator](../../../component/security/http/logout/logouturlgenerator "Symfony\Component\Security\Http\Logout\LogoutUrlGenerator") | $logoutUrlGenerator | |
###
onKernelRequest([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event)
#### Parameters
| | | |
| --- | --- | --- |
| [GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") | $event | |
###
onKernelFinishRequest([FinishRequestEvent](../../../component/httpkernel/event/finishrequestevent "Symfony\Component\HttpKernel\Event\FinishRequestEvent") $event)
#### Parameters
| | | |
| --- | --- | --- |
| [FinishRequestEvent](../../../component/httpkernel/event/finishrequestevent "Symfony\Component\HttpKernel\Event\FinishRequestEvent") | $event | |
### static array
getSubscribedEvents()
Returns an array of event names this subscriber wants to listen to.
The array keys are event names and the value can be:
* The method name to call (priority defaults to 0)
* An array composed of the method name to call and the priority
* An array of arrays composed of the method names to call and respective priorities, or 0 if unset
For instance:
* array('eventName' => 'methodName')
* array('eventName' => array('methodName', $priority))
* array('eventName' => array(array('methodName1', $priority), array('methodName2')))
#### Return Value
| | |
| --- | --- |
| array | The event names to listen to |
### protected
handleRequest([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event, $listeners)
#### Parameters
| | | |
| --- | --- | --- |
| [GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") | $event | |
| | $listeners | |
###
getWrappedListeners()
symfony WrappedListener WrappedListener
================
class **WrappedListener** implements [ListenerInterface](../../../component/security/http/firewall/listenerinterface "Symfony\Component\Security\Http\Firewall\ListenerInterface")
Wraps a security listener for calls record.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([ListenerInterface](../../../component/security/http/firewall/listenerinterface "Symfony\Component\Security\Http\Firewall\ListenerInterface") $listener) | |
| | [handle](#method_handle)([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event) | |
| | [\_\_call](#method___call)($method, $arguments) Proxies all method calls to the original listener. | |
| [ListenerInterface](../../../component/security/http/firewall/listenerinterface "Symfony\Component\Security\Http\Firewall\ListenerInterface") | [getWrappedListener](#method_getWrappedListener)() | |
| array | [getInfo](#method_getInfo)() | |
Details
-------
###
\_\_construct([ListenerInterface](../../../component/security/http/firewall/listenerinterface "Symfony\Component\Security\Http\Firewall\ListenerInterface") $listener)
#### Parameters
| | | |
| --- | --- | --- |
| [ListenerInterface](../../../component/security/http/firewall/listenerinterface "Symfony\Component\Security\Http\Firewall\ListenerInterface") | $listener | |
###
handle([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event)
#### Parameters
| | | |
| --- | --- | --- |
| [GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") | $event | |
###
\_\_call($method, $arguments)
Proxies all method calls to the original listener.
#### Parameters
| | | |
| --- | --- | --- |
| | $method | |
| | $arguments | |
### [ListenerInterface](../../../component/security/http/firewall/listenerinterface "Symfony\Component\Security\Http\Firewall\ListenerInterface")
getWrappedListener()
#### Return Value
| | |
| --- | --- |
| [ListenerInterface](../../../component/security/http/firewall/listenerinterface "Symfony\Component\Security\Http\Firewall\ListenerInterface") | |
### array
getInfo()
#### Return Value
| | |
| --- | --- |
| array | |
symfony FirewallListener FirewallListener
=================
class **FirewallListener** extends [Firewall](../../../component/security/http/firewall "Symfony\Component\Security\Http\Firewall")
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([FirewallMapInterface](../../../component/security/http/firewallmapinterface "Symfony\Component\Security\Http\FirewallMapInterface") $map, [EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher, [LogoutUrlGenerator](../../../component/security/http/logout/logouturlgenerator "Symfony\Component\Security\Http\Logout\LogoutUrlGenerator") $logoutUrlGenerator) | |
| | [onKernelRequest](#method_onKernelRequest)([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event) | |
| | [onKernelFinishRequest](#method_onKernelFinishRequest)([FinishRequestEvent](../../../component/httpkernel/event/finishrequestevent "Symfony\Component\HttpKernel\Event\FinishRequestEvent") $event) | |
| static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | from [Firewall](../../../component/security/http/firewall#method_getSubscribedEvents "Symfony\Component\Security\Http\Firewall") |
| | [handleRequest](#method_handleRequest)([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event, $listeners) | from [Firewall](../../../component/security/http/firewall#method_handleRequest "Symfony\Component\Security\Http\Firewall") |
Details
-------
###
\_\_construct([FirewallMapInterface](../../../component/security/http/firewallmapinterface "Symfony\Component\Security\Http\FirewallMapInterface") $map, [EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher, [LogoutUrlGenerator](../../../component/security/http/logout/logouturlgenerator "Symfony\Component\Security\Http\Logout\LogoutUrlGenerator") $logoutUrlGenerator)
#### Parameters
| | | |
| --- | --- | --- |
| [FirewallMapInterface](../../../component/security/http/firewallmapinterface "Symfony\Component\Security\Http\FirewallMapInterface") | $map | |
| [EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $dispatcher | |
| [LogoutUrlGenerator](../../../component/security/http/logout/logouturlgenerator "Symfony\Component\Security\Http\Logout\LogoutUrlGenerator") | $logoutUrlGenerator | |
###
onKernelRequest([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event)
#### Parameters
| | | |
| --- | --- | --- |
| [GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") | $event | |
###
onKernelFinishRequest([FinishRequestEvent](../../../component/httpkernel/event/finishrequestevent "Symfony\Component\HttpKernel\Event\FinishRequestEvent") $event)
#### Parameters
| | | |
| --- | --- | --- |
| [FinishRequestEvent](../../../component/httpkernel/event/finishrequestevent "Symfony\Component\HttpKernel\Event\FinishRequestEvent") | $event | |
### static array
getSubscribedEvents()
Returns an array of event names this subscriber wants to listen to.
The array keys are event names and the value can be:
* The method name to call (priority defaults to 0)
* An array composed of the method name to call and the priority
* An array of arrays composed of the method names to call and respective priorities, or 0 if unset
For instance:
* array('eventName' => 'methodName')
* array('eventName' => array('methodName', $priority))
* array('eventName' => array(array('methodName1', $priority), array('methodName2')))
#### Return Value
| | |
| --- | --- |
| array | The event names to listen to |
### protected
handleRequest([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event, $listeners)
#### Parameters
| | | |
| --- | --- | --- |
| [GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") | $event | |
| | $listeners | |
symfony Symfony\Bundle\WebServerBundle\Command Symfony\Bundle\WebServerBundle\Command
======================================
Classes
-------
| | |
| --- | --- |
| [ServerLogCommand](command/serverlogcommand "Symfony\Bundle\WebServerBundle\Command\ServerLogCommand") | |
| [ServerRunCommand](command/serverruncommand "Symfony\Bundle\WebServerBundle\Command\ServerRunCommand") | Runs Symfony application using a local web server. |
| [ServerStartCommand](command/serverstartcommand "Symfony\Bundle\WebServerBundle\Command\ServerStartCommand") | Runs a local web server in a background process. |
| [ServerStatusCommand](command/serverstatuscommand "Symfony\Bundle\WebServerBundle\Command\ServerStatusCommand") | Shows the status of a process that is running PHP's built-in web server in the background. |
| [ServerStopCommand](command/serverstopcommand "Symfony\Bundle\WebServerBundle\Command\ServerStopCommand") | Stops a background process running a local web server. |
symfony Symfony\Bundle\WebServerBundle\DependencyInjection Symfony\Bundle\WebServerBundle\DependencyInjection
==================================================
Classes
-------
| | |
| --- | --- |
| [WebServerExtension](dependencyinjection/webserverextension "Symfony\Bundle\WebServerBundle\DependencyInjection\WebServerExtension") | |
| programming_docs |
symfony WebServerBundle WebServerBundle
================
class **WebServerBundle** extends [Bundle](../../component/httpkernel/bundle/bundle "Symfony\Component\HttpKernel\Bundle\Bundle")
Traits
------
| | |
| --- | --- |
| [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait "Symfony\Component\DependencyInjection\ContainerAwareTrait") | ContainerAware trait. |
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | | from [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait#property_container "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| protected | $name | | from [Bundle](../../component/httpkernel/bundle/bundle#property_name "Symfony\Component\HttpKernel\Bundle\Bundle") |
| protected | $extension | | from [Bundle](../../component/httpkernel/bundle/bundle#property_extension "Symfony\Component\HttpKernel\Bundle\Bundle") |
| protected | $path | | from [Bundle](../../component/httpkernel/bundle/bundle#property_path "Symfony\Component\HttpKernel\Bundle\Bundle") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setContainer](#method_setContainer)([ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null) | from [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait#method_setContainer "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| | [boot](#method_boot)() Boots the Bundle. | from [Bundle](../../component/httpkernel/bundle/bundle#method_boot "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [shutdown](#method_shutdown)() Shutdowns the Bundle. | from [Bundle](../../component/httpkernel/bundle/bundle#method_shutdown "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [build](#method_build)([ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Builds the bundle. | from [Bundle](../../component/httpkernel/bundle/bundle#method_build "Symfony\Component\HttpKernel\Bundle\Bundle") |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | [getContainerExtension](#method_getContainerExtension)() Returns the bundle's container extension. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getContainerExtension "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getNamespace](#method_getNamespace)() Gets the Bundle namespace. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getNamespace "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getPath](#method_getPath)() Gets the Bundle directory path. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getPath "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getName](#method_getName)() Returns the bundle name (the class short name). | from [Bundle](../../component/httpkernel/bundle/bundle#method_getName "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [registerCommands](#method_registerCommands)([Application](../../component/console/application "Symfony\Component\Console\Application") $application) | from [Bundle](../../component/httpkernel/bundle/bundle#method_registerCommands "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getContainerExtensionClass](#method_getContainerExtensionClass)() Returns the bundle's container extension class. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getContainerExtensionClass "Symfony\Component\HttpKernel\Bundle\Bundle") |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | [createContainerExtension](#method_createContainerExtension)() Creates the bundle's container extension. | from [Bundle](../../component/httpkernel/bundle/bundle#method_createContainerExtension "Symfony\Component\HttpKernel\Bundle\Bundle") |
Details
-------
###
setContainer([ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | |
###
boot()
Boots the Bundle.
###
shutdown()
Shutdowns the Bundle.
###
build([ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Builds the bundle.
It is only ever called once when the cache is empty.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
### [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null
getContainerExtension()
Returns the bundle's container extension.
#### Return Value
| | |
| --- | --- |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | The default extension or null if there is none |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### string
getNamespace()
Gets the Bundle namespace.
#### Return Value
| | |
| --- | --- |
| string | The Bundle namespace |
### string
getPath()
Gets the Bundle directory path.
The path should always be returned as a Unix path (with /).
#### Return Value
| | |
| --- | --- |
| string | The Bundle absolute path |
### final string
getName()
Returns the bundle name (the class short name).
#### Return Value
| | |
| --- | --- |
| string | The Bundle name |
###
registerCommands([Application](../../component/console/application "Symfony\Component\Console\Application") $application)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../component/console/application "Symfony\Component\Console\Application") | $application | |
### protected string
getContainerExtensionClass()
Returns the bundle's container extension class.
#### Return Value
| | |
| --- | --- |
| string | |
### protected [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null
createContainerExtension()
Creates the bundle's container extension.
#### Return Value
| | |
| --- | --- |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | |
symfony WebServer WebServer
==========
class **WebServer**
Manages a local HTTP web server.
Constants
---------
| | |
| --- | --- |
| STARTED | |
| STOPPED | |
Methods
-------
| | | |
| --- | --- | --- |
| | [run](#method_run)([WebServerConfig](webserverconfig "Symfony\Bundle\WebServerBundle\WebServerConfig") $config, $disableOutput = true, callable $callback = null) | |
| | [start](#method_start)([WebServerConfig](webserverconfig "Symfony\Bundle\WebServerBundle\WebServerConfig") $config, $pidFile = null) | |
| | [stop](#method_stop)($pidFile = null) | |
| | [getAddress](#method_getAddress)($pidFile = null) | |
| | [isRunning](#method_isRunning)($pidFile = null) | |
Details
-------
###
run([WebServerConfig](webserverconfig "Symfony\Bundle\WebServerBundle\WebServerConfig") $config, $disableOutput = true, callable $callback = null)
#### Parameters
| | | |
| --- | --- | --- |
| [WebServerConfig](webserverconfig "Symfony\Bundle\WebServerBundle\WebServerConfig") | $config | |
| | $disableOutput | |
| callable | $callback | |
###
start([WebServerConfig](webserverconfig "Symfony\Bundle\WebServerBundle\WebServerConfig") $config, $pidFile = null)
#### Parameters
| | | |
| --- | --- | --- |
| [WebServerConfig](webserverconfig "Symfony\Bundle\WebServerBundle\WebServerConfig") | $config | |
| | $pidFile | |
###
stop($pidFile = null)
#### Parameters
| | | |
| --- | --- | --- |
| | $pidFile | |
###
getAddress($pidFile = null)
#### Parameters
| | | |
| --- | --- | --- |
| | $pidFile | |
###
isRunning($pidFile = null)
#### Parameters
| | | |
| --- | --- | --- |
| | $pidFile | |
symfony WebServerConfig WebServerConfig
================
class **WebServerConfig**
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(string $documentRoot, string $env, string $address = null, string $router = null) | |
| | [getDocumentRoot](#method_getDocumentRoot)() | |
| | [getEnv](#method_getEnv)() | |
| | [getRouter](#method_getRouter)() | |
| | [getHostname](#method_getHostname)() | |
| | [getPort](#method_getPort)() | |
| | [getAddress](#method_getAddress)() | |
Details
-------
###
\_\_construct(string $documentRoot, string $env, string $address = null, string $router = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $documentRoot | |
| string | $env | |
| string | $address | |
| string | $router | |
###
getDocumentRoot()
###
getEnv()
###
getRouter()
###
getHostname()
###
getPort()
###
getAddress()
symfony ServerStartCommand ServerStartCommand
===================
class **ServerStartCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Runs a local web server in a background process.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $documentRoot = null, string $environment = null) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $documentRoot = null, string $environment = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $documentRoot | |
| string | $environment | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony ServerRunCommand ServerRunCommand
=================
class **ServerRunCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Runs Symfony application using a local web server.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $documentRoot = null, string $environment = null) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $documentRoot = null, string $environment = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $documentRoot | |
| string | $environment | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony ServerStatusCommand ServerStatusCommand
====================
class **ServerStatusCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Shows the status of a process that is running PHP's built-in web server in the background.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony ServerStopCommand ServerStopCommand
==================
class **ServerStopCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Stops a background process running a local web server.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony ServerLogCommand ServerLogCommand
=================
class **ServerLogCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony WebServerExtension WebServerExtension
===================
class **WebServerExtension** extends [Extension](../../../component/dependencyinjection/extension/extension "Symfony\Component\DependencyInjection\Extension\Extension")
Methods
-------
| | | |
| --- | --- | --- |
| string | [getXsdValidationBasePath](#method_getXsdValidationBasePath)() Returns the base path for the XSD files. | from [Extension](../../../component/dependencyinjection/extension/extension#method_getXsdValidationBasePath "Symfony\Component\DependencyInjection\Extension\Extension") |
| string | [getNamespace](#method_getNamespace)() Returns the namespace to be used for this extension (XML namespace). | from [Extension](../../../component/dependencyinjection/extension/extension#method_getNamespace "Symfony\Component\DependencyInjection\Extension\Extension") |
| string | [getAlias](#method_getAlias)() Returns the recommended alias to use in XML. | from [Extension](../../../component/dependencyinjection/extension/extension#method_getAlias "Symfony\Component\DependencyInjection\Extension\Extension") |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null | [getConfiguration](#method_getConfiguration)(array $config, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Returns extension configuration. | from [Extension](../../../component/dependencyinjection/extension/extension#method_getConfiguration "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [processConfiguration](#method_processConfiguration)([ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") $configuration, array $configs) | from [Extension](../../../component/dependencyinjection/extension/extension#method_processConfiguration "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [getProcessedConfigs](#method_getProcessedConfigs)() | from [Extension](../../../component/dependencyinjection/extension/extension#method_getProcessedConfigs "Symfony\Component\DependencyInjection\Extension\Extension") |
| bool | [isConfigEnabled](#method_isConfigEnabled)([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, array $config) | from [Extension](../../../component/dependencyinjection/extension/extension#method_isConfigEnabled "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [load](#method_load)(array $configs, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Loads a specific configuration. | |
Details
-------
### string
getXsdValidationBasePath()
Returns the base path for the XSD files.
#### Return Value
| | |
| --- | --- |
| string | The XSD base path |
### string
getNamespace()
Returns the namespace to be used for this extension (XML namespace).
#### Return Value
| | |
| --- | --- |
| string | The XML namespace |
### string
getAlias()
Returns the recommended alias to use in XML.
This alias is also the mandatory prefix to use when using YAML.
This convention is to remove the "Extension" postfix from the class name and then lowercase and underscore the result. So:
```
AcmeHelloExtension
```
becomes
```
acme_hello
```
This can be overridden in a sub-class to specify the alias manually.
#### Return Value
| | |
| --- | --- |
| string | The alias |
#### Exceptions
| | |
| --- | --- |
| [BadMethodCallException](../../../component/dependencyinjection/exception/badmethodcallexception "Symfony\Component\DependencyInjection\Exception\BadMethodCallException") | When the extension name does not follow conventions |
### [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null
getConfiguration(array $config, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Returns extension configuration.
#### Parameters
| | | |
| --- | --- | --- |
| array | $config | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
#### Return Value
| | |
| --- | --- |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null | The configuration or null |
### final protected
processConfiguration([ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") $configuration, array $configs)
#### Parameters
| | | |
| --- | --- | --- |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") | $configuration | |
| array | $configs | |
### final
getProcessedConfigs()
### protected bool
isConfigEnabled([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, array $config)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
| array | $config | |
#### Return Value
| | |
| --- | --- |
| bool | Whether the configuration is enabled |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/dependencyinjection/exception/invalidargumentexception "Symfony\Component\DependencyInjection\Exception\InvalidArgumentException") | When the config is not enableable |
###
load(array $configs, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Loads a specific configuration.
#### Parameters
| | | |
| --- | --- | --- |
| array | $configs | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | When provided tag is not defined in this extension |
symfony Symfony\Bundle\TwigBundle\Loader Symfony\Bundle\TwigBundle\Loader
================================
Classes
-------
| | |
| --- | --- |
| [FilesystemLoader](loader/filesystemloader "Symfony\Bundle\TwigBundle\Loader\FilesystemLoader") | FilesystemLoader extends the default Twig filesystem loader to work with the Symfony paths and template references. |
symfony Symfony\Bundle\TwigBundle\Command Symfony\Bundle\TwigBundle\Command
=================================
Classes
-------
| | |
| --- | --- |
| [LintCommand](command/lintcommand "Symfony\Bundle\TwigBundle\Command\LintCommand") | Command that will validate your template syntax and output encountered errors. |
symfony Symfony\Bundle\TwigBundle\Controller Symfony\Bundle\TwigBundle\Controller
====================================
Classes
-------
| | |
| --- | --- |
| [ExceptionController](controller/exceptioncontroller "Symfony\Bundle\TwigBundle\Controller\ExceptionController") | ExceptionController renders error or exception pages for a given FlattenException. |
| [PreviewErrorController](controller/previewerrorcontroller "Symfony\Bundle\TwigBundle\Controller\PreviewErrorController") | PreviewErrorController can be used to test error pages. |
symfony TemplateIterator TemplateIterator
=================
class **TemplateIterator** implements [IteratorAggregate](http://php.net/IteratorAggregate)
Iterator for all templates in bundles and in the application Resources directory.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([KernelInterface](../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel, string $rootDir, array $paths = array(), string $defaultPath = null) | |
| | [getIterator](#method_getIterator)() {@inheritdoc} | |
Details
-------
###
\_\_construct([KernelInterface](../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel, string $rootDir, array $paths = array(), string $defaultPath = null)
#### Parameters
| | | |
| --- | --- | --- |
| [KernelInterface](../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | $kernel | A KernelInterface instance |
| string | $rootDir | The directory where global templates can be stored |
| array | $paths | Additional Twig paths to warm |
| string | $defaultPath | The directory where global templates can be stored |
###
getIterator()
{@inheritdoc}
symfony Symfony\Bundle\TwigBundle\DependencyInjection Symfony\Bundle\TwigBundle\DependencyInjection
=============================================
Namespaces
----------
[Symfony\Bundle\TwigBundle\DependencyInjection\Compiler](dependencyinjection/compiler)[Symfony\Bundle\TwigBundle\DependencyInjection\Configurator](dependencyinjection/configurator) Classes
-------
| | |
| --- | --- |
| [Configuration](dependencyinjection/configuration "Symfony\Bundle\TwigBundle\DependencyInjection\Configuration") | TwigExtension configuration structure. |
| [TwigExtension](dependencyinjection/twigextension "Symfony\Bundle\TwigBundle\DependencyInjection\TwigExtension") | TwigExtension. |
symfony Symfony\Bundle\TwigBundle\CacheWarmer Symfony\Bundle\TwigBundle\CacheWarmer
=====================================
Classes
-------
| | |
| --- | --- |
| [TemplateCacheCacheWarmer](cachewarmer/templatecachecachewarmer "Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer") | Generates the Twig cache for all templates. |
| [TemplateCacheWarmer](cachewarmer/templatecachewarmer "Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheWarmer") | Generates the Twig cache for all templates. |
symfony TwigEngine TwigEngine
===========
class **TwigEngine** extends [TwigEngine](../../bridge/twig/twigengine "Symfony\Bridge\Twig\TwigEngine") implements [EngineInterface](../frameworkbundle/templating/engineinterface "Symfony\Bundle\FrameworkBundle\Templating\EngineInterface")
This engine renders Twig templates.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $environment | | from [TwigEngine](../../bridge/twig/twigengine#property_environment "Symfony\Bridge\Twig\TwigEngine") |
| protected | $parser | | from [TwigEngine](../../bridge/twig/twigengine#property_parser "Symfony\Bridge\Twig\TwigEngine") |
| protected | $locator | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(Environment $environment, [TemplateNameParserInterface](../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") $parser, [FileLocatorInterface](../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") $locator) | |
| string | [render](#method_render)(string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array()) Renders a template. | |
| | [stream](#method_stream)(string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array()) Streams a template. | from [TwigEngine](../../bridge/twig/twigengine#method_stream "Symfony\Bridge\Twig\TwigEngine") |
| bool | [exists](#method_exists)(string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Returns true if the template exists. | from [TwigEngine](../../bridge/twig/twigengine#method_exists "Symfony\Bridge\Twig\TwigEngine") |
| bool | [supports](#method_supports)(string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Returns true if this class is able to render the given template. | from [TwigEngine](../../bridge/twig/twigengine#method_supports "Symfony\Bridge\Twig\TwigEngine") |
| Template | [load](#method_load)(string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface")|Template $name) Loads the given template. | from [TwigEngine](../../bridge/twig/twigengine#method_load "Symfony\Bridge\Twig\TwigEngine") |
| [Response](../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [renderResponse](#method_renderResponse)(string $view, array $parameters = array(), [Response](../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null) Renders a view and returns a Response. | |
Details
-------
###
\_\_construct(Environment $environment, [TemplateNameParserInterface](../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") $parser, [FileLocatorInterface](../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") $locator)
#### Parameters
| | | |
| --- | --- | --- |
| Environment | $environment | |
| [TemplateNameParserInterface](../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") | $parser | |
| [FileLocatorInterface](../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") | $locator | |
### string
render(string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array())
Renders a template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
| array | $parameters | An array of parameters to pass to the template |
#### Return Value
| | |
| --- | --- |
| string | The evaluated template as a string |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
###
stream(string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array())
Streams a template.
The implementation should output the content directly to the client.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
| array | $parameters | An array of parameters to pass to the template |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
| [LogicException](http://php.net/LogicException) | if the template cannot be streamed |
### bool
exists(string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Returns true if the template exists.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| bool | true if the template exists, false otherwise |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the engine cannot handle the template name |
### bool
supports(string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Returns true if this class is able to render the given template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| bool | true if this class supports the given template, false otherwise |
### protected Template
load(string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface")|Template $name)
Loads the given template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface")|Template | $name | A template name or an instance of TemplateReferenceInterface or Template |
#### Return Value
| | |
| --- | --- |
| Template | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | if the template does not exist |
### [Response](../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
renderResponse(string $view, array $parameters = array(), [Response](../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null)
Renders a view and returns a Response.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | The view name |
| array | $parameters | An array of parameters to pass to the view |
| [Response](../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | A Response instance |
#### Return Value
| | |
| --- | --- |
| [Response](../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
symfony TwigBundle TwigBundle
===========
class **TwigBundle** extends [Bundle](../../component/httpkernel/bundle/bundle "Symfony\Component\HttpKernel\Bundle\Bundle")
Bundle.
Traits
------
| | |
| --- | --- |
| [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait "Symfony\Component\DependencyInjection\ContainerAwareTrait") | ContainerAware trait. |
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | | from [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait#property_container "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| protected | $name | | from [Bundle](../../component/httpkernel/bundle/bundle#property_name "Symfony\Component\HttpKernel\Bundle\Bundle") |
| protected | $extension | | from [Bundle](../../component/httpkernel/bundle/bundle#property_extension "Symfony\Component\HttpKernel\Bundle\Bundle") |
| protected | $path | | from [Bundle](../../component/httpkernel/bundle/bundle#property_path "Symfony\Component\HttpKernel\Bundle\Bundle") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setContainer](#method_setContainer)([ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null) | from [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait#method_setContainer "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| | [boot](#method_boot)() Boots the Bundle. | from [Bundle](../../component/httpkernel/bundle/bundle#method_boot "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [shutdown](#method_shutdown)() Shutdowns the Bundle. | from [Bundle](../../component/httpkernel/bundle/bundle#method_shutdown "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [build](#method_build)([ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Builds the bundle. | |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | [getContainerExtension](#method_getContainerExtension)() Returns the bundle's container extension. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getContainerExtension "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getNamespace](#method_getNamespace)() Gets the Bundle namespace. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getNamespace "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getPath](#method_getPath)() Gets the Bundle directory path. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getPath "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getName](#method_getName)() Returns the bundle name (the class short name). | from [Bundle](../../component/httpkernel/bundle/bundle#method_getName "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [registerCommands](#method_registerCommands)([Application](../../component/console/application "Symfony\Component\Console\Application") $application) | |
| string | [getContainerExtensionClass](#method_getContainerExtensionClass)() Returns the bundle's container extension class. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getContainerExtensionClass "Symfony\Component\HttpKernel\Bundle\Bundle") |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | [createContainerExtension](#method_createContainerExtension)() Creates the bundle's container extension. | from [Bundle](../../component/httpkernel/bundle/bundle#method_createContainerExtension "Symfony\Component\HttpKernel\Bundle\Bundle") |
Details
-------
###
setContainer([ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | |
###
boot()
Boots the Bundle.
###
shutdown()
Shutdowns the Bundle.
###
build([ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Builds the bundle.
It is only ever called once when the cache is empty.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
### [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null
getContainerExtension()
Returns the bundle's container extension.
#### Return Value
| | |
| --- | --- |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | The default extension or null if there is none |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### string
getNamespace()
Gets the Bundle namespace.
#### Return Value
| | |
| --- | --- |
| string | The Bundle namespace |
### string
getPath()
Gets the Bundle directory path.
The path should always be returned as a Unix path (with /).
#### Return Value
| | |
| --- | --- |
| string | The Bundle absolute path |
### final string
getName()
Returns the bundle name (the class short name).
#### Return Value
| | |
| --- | --- |
| string | The Bundle name |
###
registerCommands([Application](../../component/console/application "Symfony\Component\Console\Application") $application)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../component/console/application "Symfony\Component\Console\Application") | $application | |
### protected string
getContainerExtensionClass()
Returns the bundle's container extension class.
#### Return Value
| | |
| --- | --- |
| string | |
### protected [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null
createContainerExtension()
Creates the bundle's container extension.
#### Return Value
| | |
| --- | --- |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | |
| programming_docs |
symfony TemplateCacheWarmer TemplateCacheWarmer
====================
class **TemplateCacheWarmer** implements [CacheWarmerInterface](../../../component/httpkernel/cachewarmer/cachewarmerinterface "Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface"), [ServiceSubscriberInterface](../../../component/dependencyinjection/servicesubscriberinterface "Symfony\Component\DependencyInjection\ServiceSubscriberInterface")
Generates the Twig cache for all templates.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(ContainerInterface $container, [Traversable](http://php.net/Traversable) $iterator) | |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | |
| bool | [isOptional](#method_isOptional)() Checks whether this warmer is optional or not. | |
| static array | [getSubscribedServices](#method_getSubscribedServices)() Returns an array of service types required by such instances, optionally keyed by the service names used internally. | |
Details
-------
###
\_\_construct(ContainerInterface $container, [Traversable](http://php.net/Traversable) $iterator)
#### Parameters
| | | |
| --- | --- | --- |
| ContainerInterface | $container | |
| [Traversable](http://php.net/Traversable) | $iterator | |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### bool
isOptional()
Checks whether this warmer is optional or not.
Optional warmers can be ignored on certain conditions.
A warmer should return true if the cache can be generated incrementally and on-demand.
#### Return Value
| | |
| --- | --- |
| bool | true if the warmer is optional, false otherwise |
### static array
getSubscribedServices()
Returns an array of service types required by such instances, optionally keyed by the service names used internally.
For mandatory dependencies:
* array('logger' => 'Psr\Log\LoggerInterface') means the objects use the "logger" name internally to fetch a service which must implement Psr\Log\LoggerInterface.
* array('Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface')
otherwise:
* array('logger' => '?Psr\Log\LoggerInterface') denotes an optional dependency
* array('?Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface')
#### Return Value
| | |
| --- | --- |
| array | The required service types, optionally keyed by service names |
symfony TemplateCacheCacheWarmer TemplateCacheCacheWarmer
=========================
class **TemplateCacheCacheWarmer** implements [CacheWarmerInterface](../../../component/httpkernel/cachewarmer/cachewarmerinterface "Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface"), [ServiceSubscriberInterface](../../../component/dependencyinjection/servicesubscriberinterface "Symfony\Component\DependencyInjection\ServiceSubscriberInterface")
Generates the Twig cache for all templates.
This warmer must be registered after TemplatePathsCacheWarmer, as the Twig loader will need the cache generated by it.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $container | | |
| protected | $finder | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(ContainerInterface $container, [TemplateFinderInterface](../../frameworkbundle/cachewarmer/templatefinderinterface "Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface") $finder = null, array $paths = array()) | |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | |
| bool | [isOptional](#method_isOptional)() Checks whether this warmer is optional or not. | |
| static array | [getSubscribedServices](#method_getSubscribedServices)() Returns an array of service types required by such instances, optionally keyed by the service names used internally. | |
Details
-------
###
\_\_construct(ContainerInterface $container, [TemplateFinderInterface](../../frameworkbundle/cachewarmer/templatefinderinterface "Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface") $finder = null, array $paths = array())
#### Parameters
| | | |
| --- | --- | --- |
| ContainerInterface | $container | |
| [TemplateFinderInterface](../../frameworkbundle/cachewarmer/templatefinderinterface "Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface") | $finder | |
| array | $paths | |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### bool
isOptional()
Checks whether this warmer is optional or not.
#### Return Value
| | |
| --- | --- |
| bool | true if the warmer is optional, false otherwise |
### static array
getSubscribedServices()
Returns an array of service types required by such instances, optionally keyed by the service names used internally.
For mandatory dependencies:
* array('logger' => 'Psr\Log\LoggerInterface') means the objects use the "logger" name internally to fetch a service which must implement Psr\Log\LoggerInterface.
* array('Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface')
otherwise:
* array('logger' => '?Psr\Log\LoggerInterface') denotes an optional dependency
* array('?Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface')
#### Return Value
| | |
| --- | --- |
| array | The required service types, optionally keyed by service names |
symfony ExceptionController ExceptionController
====================
class **ExceptionController**
ExceptionController renders error or exception pages for a given FlattenException.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $twig | | |
| protected | $debug | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(Environment $twig, bool $debug) | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [showAction](#method_showAction)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [FlattenException](../../../component/debug/exception/flattenexception "Symfony\Component\Debug\Exception\FlattenException") $exception, [DebugLoggerInterface](../../../component/httpkernel/log/debugloggerinterface "Symfony\Component\HttpKernel\Log\DebugLoggerInterface") $logger = null) Converts an Exception to a Response. | |
| string | [getAndCleanOutputBuffering](#method_getAndCleanOutputBuffering)(int $startObLevel) | |
| string | [findTemplate](#method_findTemplate)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $format, int $code, bool $showException) | |
| | [templateExists](#method_templateExists)($template) | |
Details
-------
###
\_\_construct(Environment $twig, bool $debug)
#### Parameters
| | | |
| --- | --- | --- |
| Environment | $twig | |
| bool | $debug | Show error (false) or exception (true) pages by default |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
showAction([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [FlattenException](../../../component/debug/exception/flattenexception "Symfony\Component\Debug\Exception\FlattenException") $exception, [DebugLoggerInterface](../../../component/httpkernel/log/debugloggerinterface "Symfony\Component\HttpKernel\Log\DebugLoggerInterface") $logger = null)
Converts an Exception to a Response.
A "showException" request parameter can be used to force display of an error page (when set to false) or the exception page (when true). If it is not present, the "debug" value passed into the constructor will be used.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| [FlattenException](../../../component/debug/exception/flattenexception "Symfony\Component\Debug\Exception\FlattenException") | $exception | |
| [DebugLoggerInterface](../../../component/httpkernel/log/debugloggerinterface "Symfony\Component\HttpKernel\Log\DebugLoggerInterface") | $logger | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | When the exception template does not exist |
### protected string
getAndCleanOutputBuffering(int $startObLevel)
#### Parameters
| | | |
| --- | --- | --- |
| int | $startObLevel | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected string
findTemplate([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $format, int $code, bool $showException)
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| string | $format | |
| int | $code | An HTTP response status code |
| bool | $showException | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected
templateExists($template)
#### Parameters
| | | |
| --- | --- | --- |
| | $template | |
symfony PreviewErrorController PreviewErrorController
=======================
class **PreviewErrorController**
PreviewErrorController can be used to test error pages.
It will create a test exception and forward it to another controller.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $kernel | | |
| protected | $controller | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([HttpKernelInterface](../../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") $kernel, $controller) | |
| | [previewErrorPageAction](#method_previewErrorPageAction)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, $code) | |
Details
-------
###
\_\_construct([HttpKernelInterface](../../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") $kernel, $controller)
#### Parameters
| | | |
| --- | --- | --- |
| [HttpKernelInterface](../../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") | $kernel | |
| | $controller | |
###
previewErrorPageAction([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, $code)
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| | $code | |
symfony FilesystemLoader FilesystemLoader
=================
class **FilesystemLoader** extends FilesystemLoader
FilesystemLoader extends the default Twig filesystem loader to work with the Symfony paths and template references.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $locator | | |
| protected | $parser | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([FileLocatorInterface](../../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") $locator, [TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") $parser, string $rootPath = null) | |
| | [exists](#method_exists)($name) {@inheritdoc} | |
| string | [findTemplate](#method_findTemplate)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $template, bool $throw = true) Returns the path to the template file. | |
Details
-------
###
\_\_construct([FileLocatorInterface](../../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") $locator, [TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") $parser, string $rootPath = null)
#### Parameters
| | | |
| --- | --- | --- |
| [FileLocatorInterface](../../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") | $locator | |
| [TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") | $parser | |
| string | $rootPath | |
###
exists($name)
{@inheritdoc}
The name parameter might also be a TemplateReferenceInterface.
#### Parameters
| | | |
| --- | --- | --- |
| | $name | |
### protected string
findTemplate(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $template, bool $throw = true)
Returns the path to the template file.
The file locator is used to locate the template when the naming convention is the symfony one (i.e. the name can be parsed). Otherwise the template is located using the locator from the twig library.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $template | The template |
| bool | $throw | When true, a LoaderError exception will be thrown if a template could not be found |
#### Return Value
| | |
| --- | --- |
| string | The path to the template file |
#### Exceptions
| | |
| --- | --- |
| LoaderError | if the template could not be found |
symfony LintCommand LintCommand
============
class **LintCommand** extends [LintCommand](../../../bridge/twig/command/lintcommand "Symfony\Bridge\Twig\Command\LintCommand")
Command that will validate your template syntax and output encountered errors.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | from [LintCommand](../../../bridge/twig/command/lintcommand#property_defaultName "Symfony\Bridge\Twig\Command\LintCommand") |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(Environment $twig) | from [LintCommand](../../../bridge/twig/command/lintcommand#method___construct "Symfony\Bridge\Twig\Command\LintCommand") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | from [LintCommand](../../../bridge/twig/command/lintcommand#method_execute "Symfony\Bridge\Twig\Command\LintCommand") |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
| | [findFiles](#method_findFiles)($filename) | |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(Environment $twig)
#### Parameters
| | | |
| --- | --- | --- |
| Environment | $twig | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
### protected
findFiles($filename)
#### Parameters
| | | |
| --- | --- | --- |
| | $filename | |
| programming_docs |
symfony Configuration Configuration
==============
class **Configuration** implements [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")
TwigExtension configuration structure.
Methods
-------
| | | |
| --- | --- | --- |
| [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder") | [getConfigTreeBuilder](#method_getConfigTreeBuilder)() Generates the configuration tree builder. | |
Details
-------
### [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder")
getConfigTreeBuilder()
Generates the configuration tree builder.
#### Return Value
| | |
| --- | --- |
| [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder") | The tree builder |
symfony Symfony\Bundle\TwigBundle\DependencyInjection\Compiler Symfony\Bundle\TwigBundle\DependencyInjection\Compiler
======================================================
Classes
-------
| | |
| --- | --- |
| [ExceptionListenerPass](compiler/exceptionlistenerpass "Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExceptionListenerPass") | Registers the Twig exception listener if Twig is registered as a templating engine. |
| [ExtensionPass](compiler/extensionpass "Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass") | |
| [RuntimeLoaderPass](compiler/runtimeloaderpass "Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\RuntimeLoaderPass") | Registers Twig runtime services. |
| [TwigEnvironmentPass](compiler/twigenvironmentpass "Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass") | Adds tagged twig.extension services to twig service. |
| [TwigLoaderPass](compiler/twigloaderpass "Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigLoaderPass") | Adds services tagged twig.loader as Twig loaders. |
symfony TwigExtension TwigExtension
==============
class **TwigExtension** extends [Extension](../../../component/httpkernel/dependencyinjection/extension "Symfony\Component\HttpKernel\DependencyInjection\Extension")
TwigExtension.
Methods
-------
| | | |
| --- | --- | --- |
| string | [getXsdValidationBasePath](#method_getXsdValidationBasePath)() Returns the base path for the XSD files. | |
| string | [getNamespace](#method_getNamespace)() Returns the namespace to be used for this extension (XML namespace). | |
| string | [getAlias](#method_getAlias)() Returns the recommended alias to use in XML. | from [Extension](../../../component/dependencyinjection/extension/extension#method_getAlias "Symfony\Component\DependencyInjection\Extension\Extension") |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null | [getConfiguration](#method_getConfiguration)(array $config, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Returns extension configuration. | from [Extension](../../../component/dependencyinjection/extension/extension#method_getConfiguration "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [processConfiguration](#method_processConfiguration)([ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") $configuration, array $configs) | from [Extension](../../../component/dependencyinjection/extension/extension#method_processConfiguration "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [getProcessedConfigs](#method_getProcessedConfigs)() | from [Extension](../../../component/dependencyinjection/extension/extension#method_getProcessedConfigs "Symfony\Component\DependencyInjection\Extension\Extension") |
| bool | [isConfigEnabled](#method_isConfigEnabled)([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, array $config) | from [Extension](../../../component/dependencyinjection/extension/extension#method_isConfigEnabled "Symfony\Component\DependencyInjection\Extension\Extension") |
| array | [getAnnotatedClassesToCompile](#method_getAnnotatedClassesToCompile)() Gets the annotated classes to cache. | from [Extension](../../../component/httpkernel/dependencyinjection/extension#method_getAnnotatedClassesToCompile "Symfony\Component\HttpKernel\DependencyInjection\Extension") |
| | [addAnnotatedClassesToCompile](#method_addAnnotatedClassesToCompile)(array $annotatedClasses) Adds annotated classes to the class cache. | from [Extension](../../../component/httpkernel/dependencyinjection/extension#method_addAnnotatedClassesToCompile "Symfony\Component\HttpKernel\DependencyInjection\Extension") |
| | [load](#method_load)(array $configs, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Loads a specific configuration. | |
Details
-------
### string
getXsdValidationBasePath()
Returns the base path for the XSD files.
#### Return Value
| | |
| --- | --- |
| string | The XSD base path |
### string
getNamespace()
Returns the namespace to be used for this extension (XML namespace).
#### Return Value
| | |
| --- | --- |
| string | The XML namespace |
### string
getAlias()
Returns the recommended alias to use in XML.
This alias is also the mandatory prefix to use when using YAML.
This convention is to remove the "Extension" postfix from the class name and then lowercase and underscore the result. So:
```
AcmeHelloExtension
```
becomes
```
acme_hello
```
This can be overridden in a sub-class to specify the alias manually.
#### Return Value
| | |
| --- | --- |
| string | The alias |
#### Exceptions
| | |
| --- | --- |
| [BadMethodCallException](../../../component/dependencyinjection/exception/badmethodcallexception "Symfony\Component\DependencyInjection\Exception\BadMethodCallException") | When the extension name does not follow conventions |
### [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null
getConfiguration(array $config, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Returns extension configuration.
#### Parameters
| | | |
| --- | --- | --- |
| array | $config | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
#### Return Value
| | |
| --- | --- |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null | The configuration or null |
### final protected
processConfiguration([ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") $configuration, array $configs)
#### Parameters
| | | |
| --- | --- | --- |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") | $configuration | |
| array | $configs | |
### final
getProcessedConfigs()
### protected bool
isConfigEnabled([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, array $config)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
| array | $config | |
#### Return Value
| | |
| --- | --- |
| bool | Whether the configuration is enabled |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/dependencyinjection/exception/invalidargumentexception "Symfony\Component\DependencyInjection\Exception\InvalidArgumentException") | When the config is not enableable |
### array
getAnnotatedClassesToCompile()
Gets the annotated classes to cache.
#### Return Value
| | |
| --- | --- |
| array | An array of classes |
###
addAnnotatedClassesToCompile(array $annotatedClasses)
Adds annotated classes to the class cache.
#### Parameters
| | | |
| --- | --- | --- |
| array | $annotatedClasses | An array of class patterns |
###
load(array $configs, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Loads a specific configuration.
#### Parameters
| | | |
| --- | --- | --- |
| array | $configs | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | When provided tag is not defined in this extension |
symfony Symfony\Bundle\TwigBundle\DependencyInjection\Configurator Symfony\Bundle\TwigBundle\DependencyInjection\Configurator
==========================================================
Classes
-------
| | |
| --- | --- |
| [EnvironmentConfigurator](configurator/environmentconfigurator "Symfony\Bundle\TwigBundle\DependencyInjection\Configurator\EnvironmentConfigurator") | Twig environment configurator. |
symfony EnvironmentConfigurator EnvironmentConfigurator
========================
class **EnvironmentConfigurator**
Twig environment configurator.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(string $dateFormat, string $intervalFormat, string|null $timezone, int $decimals, string $decimalPoint, string $thousandsSeparator) | |
| | [configure](#method_configure)(Environment $environment) | |
Details
-------
###
\_\_construct(string $dateFormat, string $intervalFormat, string|null $timezone, int $decimals, string $decimalPoint, string $thousandsSeparator)
#### Parameters
| | | |
| --- | --- | --- |
| string | $dateFormat | |
| string | $intervalFormat | |
| string|null | $timezone | |
| int | $decimals | |
| string | $decimalPoint | |
| string | $thousandsSeparator | |
###
configure(Environment $environment)
#### Parameters
| | | |
| --- | --- | --- |
| Environment | $environment | |
symfony ExtensionPass ExtensionPass
==============
class **ExtensionPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony TwigEnvironmentPass TwigEnvironmentPass
====================
class **TwigEnvironmentPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Adds tagged twig.extension services to twig service.
Traits
------
| | |
| --- | --- |
| [PriorityTaggedServiceTrait](../../../../component/dependencyinjection/compiler/prioritytaggedservicetrait "Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait") | Trait that allows a generic method to find and sort service by priority option in the tag. |
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony TwigLoaderPass TwigLoaderPass
===============
class **TwigLoaderPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Adds services tagged twig.loader as Twig loaders.
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony RuntimeLoaderPass RuntimeLoaderPass
==================
class **RuntimeLoaderPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Registers Twig runtime services.
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony ExceptionListenerPass ExceptionListenerPass
======================
class **ExceptionListenerPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Registers the Twig exception listener if Twig is registered as a templating engine.
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony FrameworkBundle FrameworkBundle
================
class **FrameworkBundle** extends [Bundle](../../component/httpkernel/bundle/bundle "Symfony\Component\HttpKernel\Bundle\Bundle")
Bundle.
Traits
------
| | |
| --- | --- |
| [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait "Symfony\Component\DependencyInjection\ContainerAwareTrait") | ContainerAware trait. |
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | | from [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait#property_container "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| protected | $name | | from [Bundle](../../component/httpkernel/bundle/bundle#property_name "Symfony\Component\HttpKernel\Bundle\Bundle") |
| protected | $extension | | from [Bundle](../../component/httpkernel/bundle/bundle#property_extension "Symfony\Component\HttpKernel\Bundle\Bundle") |
| protected | $path | | from [Bundle](../../component/httpkernel/bundle/bundle#property_path "Symfony\Component\HttpKernel\Bundle\Bundle") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setContainer](#method_setContainer)([ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null) | from [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait#method_setContainer "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| | [boot](#method_boot)() Boots the Bundle. | |
| | [shutdown](#method_shutdown)() Shutdowns the Bundle. | from [Bundle](../../component/httpkernel/bundle/bundle#method_shutdown "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [build](#method_build)([ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Builds the bundle. | |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | [getContainerExtension](#method_getContainerExtension)() Returns the bundle's container extension. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getContainerExtension "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getNamespace](#method_getNamespace)() Gets the Bundle namespace. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getNamespace "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getPath](#method_getPath)() Gets the Bundle directory path. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getPath "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getName](#method_getName)() Returns the bundle name (the class short name). | from [Bundle](../../component/httpkernel/bundle/bundle#method_getName "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [registerCommands](#method_registerCommands)([Application](../../component/console/application "Symfony\Component\Console\Application") $application) | from [Bundle](../../component/httpkernel/bundle/bundle#method_registerCommands "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getContainerExtensionClass](#method_getContainerExtensionClass)() Returns the bundle's container extension class. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getContainerExtensionClass "Symfony\Component\HttpKernel\Bundle\Bundle") |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | [createContainerExtension](#method_createContainerExtension)() Creates the bundle's container extension. | from [Bundle](../../component/httpkernel/bundle/bundle#method_createContainerExtension "Symfony\Component\HttpKernel\Bundle\Bundle") |
Details
-------
###
setContainer([ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | |
###
boot()
Boots the Bundle.
###
shutdown()
Shutdowns the Bundle.
###
build([ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Builds the bundle.
It is only ever called once when the cache is empty.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
### [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null
getContainerExtension()
Returns the bundle's container extension.
#### Return Value
| | |
| --- | --- |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | The default extension or null if there is none |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### string
getNamespace()
Gets the Bundle namespace.
#### Return Value
| | |
| --- | --- |
| string | The Bundle namespace |
### string
getPath()
Gets the Bundle directory path.
The path should always be returned as a Unix path (with /).
#### Return Value
| | |
| --- | --- |
| string | The Bundle absolute path |
### final string
getName()
Returns the bundle name (the class short name).
#### Return Value
| | |
| --- | --- |
| string | The Bundle name |
###
registerCommands([Application](../../component/console/application "Symfony\Component\Console\Application") $application)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../component/console/application "Symfony\Component\Console\Application") | $application | |
### protected string
getContainerExtensionClass()
Returns the bundle's container extension class.
#### Return Value
| | |
| --- | --- |
| string | |
### protected [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null
createContainerExtension()
Creates the bundle's container extension.
#### Return Value
| | |
| --- | --- |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | |
| programming_docs |
symfony Symfony\Bundle\FrameworkBundle\Routing Symfony\Bundle\FrameworkBundle\Routing
======================================
Classes
-------
| | |
| --- | --- |
| [AnnotatedRouteControllerLoader](routing/annotatedroutecontrollerloader "Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader") | AnnotatedRouteControllerLoader is an implementation of AnnotationClassLoader that sets the '\_controller' default based on the class and method names. |
| [DelegatingLoader](routing/delegatingloader "Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader") | DelegatingLoader delegates route loading to other loaders using a loader resolver. |
| [RedirectableUrlMatcher](routing/redirectableurlmatcher "Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher") | |
| [Router](routing/router "Symfony\Bundle\FrameworkBundle\Routing\Router") | This Router creates the Loader only when the cache is empty. |
symfony Client Client
=======
class **Client** extends [Client](../../component/httpkernel/client "Symfony\Component\HttpKernel\Client")
Client simulates a browser and makes requests to a Kernel object.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $history | | from [Client](../../component/browserkit/client#property_history "Symfony\Component\BrowserKit\Client") |
| protected | $cookieJar | | from [Client](../../component/browserkit/client#property_cookieJar "Symfony\Component\BrowserKit\Client") |
| protected | $server | | from [Client](../../component/browserkit/client#property_server "Symfony\Component\BrowserKit\Client") |
| protected | $internalRequest | | from [Client](../../component/browserkit/client#property_internalRequest "Symfony\Component\BrowserKit\Client") |
| protected | $request | | from [Client](../../component/browserkit/client#property_request "Symfony\Component\BrowserKit\Client") |
| protected | $internalResponse | | from [Client](../../component/browserkit/client#property_internalResponse "Symfony\Component\BrowserKit\Client") |
| protected | $response | | from [Client](../../component/browserkit/client#property_response "Symfony\Component\BrowserKit\Client") |
| protected | $crawler | | from [Client](../../component/browserkit/client#property_crawler "Symfony\Component\BrowserKit\Client") |
| protected | $insulated | | from [Client](../../component/browserkit/client#property_insulated "Symfony\Component\BrowserKit\Client") |
| protected | $redirect | | from [Client](../../component/browserkit/client#property_redirect "Symfony\Component\BrowserKit\Client") |
| protected | $followRedirects | | from [Client](../../component/browserkit/client#property_followRedirects "Symfony\Component\BrowserKit\Client") |
| protected | $kernel | | from [Client](../../component/httpkernel/client#property_kernel "Symfony\Component\HttpKernel\Client") |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([HttpKernelInterface](../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") $kernel, array $server = array(), [History](../../component/browserkit/history "Symfony\Component\BrowserKit\History") $history = null, [CookieJar](../../component/browserkit/cookiejar "Symfony\Component\BrowserKit\CookieJar") $cookieJar = null) | |
| | [followRedirects](#method_followRedirects)(bool $followRedirect = true) Sets whether to automatically follow redirects or not. | from [Client](../../component/browserkit/client#method_followRedirects "Symfony\Component\BrowserKit\Client") |
| bool | [isFollowingRedirects](#method_isFollowingRedirects)() Returns whether client automatically follows redirects or not. | from [Client](../../component/browserkit/client#method_isFollowingRedirects "Symfony\Component\BrowserKit\Client") |
| | [setMaxRedirects](#method_setMaxRedirects)(int $maxRedirects) Sets the maximum number of redirects that crawler can follow. | from [Client](../../component/browserkit/client#method_setMaxRedirects "Symfony\Component\BrowserKit\Client") |
| int | [getMaxRedirects](#method_getMaxRedirects)() Returns the maximum number of redirects that crawler can follow. | from [Client](../../component/browserkit/client#method_getMaxRedirects "Symfony\Component\BrowserKit\Client") |
| | [insulate](#method_insulate)(bool $insulated = true) Sets the insulated flag. | from [Client](../../component/browserkit/client#method_insulate "Symfony\Component\BrowserKit\Client") |
| | [setServerParameters](#method_setServerParameters)(array $server) Sets server parameters. | from [Client](../../component/browserkit/client#method_setServerParameters "Symfony\Component\BrowserKit\Client") |
| | [setServerParameter](#method_setServerParameter)(string $key, string $value) Sets single server parameter. | from [Client](../../component/browserkit/client#method_setServerParameter "Symfony\Component\BrowserKit\Client") |
| string | [getServerParameter](#method_getServerParameter)(string $key, string $default = '') Gets single server parameter for specified key. | from [Client](../../component/browserkit/client#method_getServerParameter "Symfony\Component\BrowserKit\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | [xmlHttpRequest](#method_xmlHttpRequest)(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true) | from [Client](../../component/browserkit/client#method_xmlHttpRequest "Symfony\Component\BrowserKit\Client") |
| [History](../../component/browserkit/history "Symfony\Component\BrowserKit\History") | [getHistory](#method_getHistory)() Returns the History instance. | from [Client](../../component/browserkit/client#method_getHistory "Symfony\Component\BrowserKit\Client") |
| [CookieJar](../../component/browserkit/cookiejar "Symfony\Component\BrowserKit\CookieJar") | [getCookieJar](#method_getCookieJar)() Returns the CookieJar instance. | from [Client](../../component/browserkit/client#method_getCookieJar "Symfony\Component\BrowserKit\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | [getCrawler](#method_getCrawler)() Returns the current Crawler instance. | from [Client](../../component/browserkit/client#method_getCrawler "Symfony\Component\BrowserKit\Client") |
| [Response](../../component/browserkit/response "Symfony\Component\BrowserKit\Response") | [getInternalResponse](#method_getInternalResponse)() Returns the current BrowserKit Response instance. | from [Client](../../component/browserkit/client#method_getInternalResponse "Symfony\Component\BrowserKit\Client") |
| Response | [getResponse](#method_getResponse)() A Response instance | from [Client](../../component/httpkernel/client#method_getResponse "Symfony\Component\HttpKernel\Client") |
| [Request](../../component/browserkit/request "Symfony\Component\BrowserKit\Request") | [getInternalRequest](#method_getInternalRequest)() Returns the current BrowserKit Request instance. | from [Client](../../component/browserkit/client#method_getInternalRequest "Symfony\Component\BrowserKit\Client") |
| Request | [getRequest](#method_getRequest)() A Request instance | from [Client](../../component/httpkernel/client#method_getRequest "Symfony\Component\HttpKernel\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | [click](#method_click)([Link](../../component/domcrawler/link "Symfony\Component\DomCrawler\Link") $link) Clicks on a given link. | from [Client](../../component/browserkit/client#method_click "Symfony\Component\BrowserKit\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | [submit](#method_submit)([Form](../../component/domcrawler/form "Symfony\Component\DomCrawler\Form") $form, array $values = array()) Submits a form. | from [Client](../../component/browserkit/client#method_submit "Symfony\Component\BrowserKit\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | [request](#method_request)(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true) Calls a URI. | from [Client](../../component/browserkit/client#method_request "Symfony\Component\BrowserKit\Client") |
| object | [doRequestInProcess](#method_doRequestInProcess)(object $request) Makes a request in another process. | |
| object | [doRequest](#method_doRequest)(object $request) Makes a request. | |
| | [getScript](#method_getScript)(object $request) Returns the script to execute when the request must be insulated. | |
| object | [filterRequest](#method_filterRequest)([Request](../../component/browserkit/request "Symfony\Component\BrowserKit\Request") $request) Converts the BrowserKit request to a HttpKernel request. | from [Client](../../component/httpkernel/client#method_filterRequest "Symfony\Component\HttpKernel\Client") |
| [Response](../../component/browserkit/response "Symfony\Component\BrowserKit\Response") | [filterResponse](#method_filterResponse)(object $response) Converts the HttpKernel response to a BrowserKit response. | from [Client](../../component/httpkernel/client#method_filterResponse "Symfony\Component\HttpKernel\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")|null | [createCrawlerFromContent](#method_createCrawlerFromContent)(string $uri, string $content, string $type) Creates a crawler. | from [Client](../../component/browserkit/client#method_createCrawlerFromContent "Symfony\Component\BrowserKit\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | [back](#method_back)() Goes back in the browser history. | from [Client](../../component/browserkit/client#method_back "Symfony\Component\BrowserKit\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | [forward](#method_forward)() Goes forward in the browser history. | from [Client](../../component/browserkit/client#method_forward "Symfony\Component\BrowserKit\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | [reload](#method_reload)() Reloads the current browser. | from [Client](../../component/browserkit/client#method_reload "Symfony\Component\BrowserKit\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | [followRedirect](#method_followRedirect)() Follow redirects? | from [Client](../../component/browserkit/client#method_followRedirect "Symfony\Component\BrowserKit\Client") |
| | [restart](#method_restart)() Restarts the client. | from [Client](../../component/browserkit/client#method_restart "Symfony\Component\BrowserKit\Client") |
| string | [getAbsoluteUri](#method_getAbsoluteUri)(string $uri) Takes a URI and converts it to absolute if it is not already absolute. | from [Client](../../component/browserkit/client#method_getAbsoluteUri "Symfony\Component\BrowserKit\Client") |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | [requestFromRequest](#method_requestFromRequest)([Request](../../component/browserkit/request "Symfony\Component\BrowserKit\Request") $request, bool $changeHistory = true) Makes a request from a Request object directly. | from [Client](../../component/browserkit/client#method_requestFromRequest "Symfony\Component\BrowserKit\Client") |
| | [catchExceptions](#method_catchExceptions)(bool $catchExceptions) Sets whether to catch exceptions when the kernel is handling a request. | from [Client](../../component/httpkernel/client#method_catchExceptions "Symfony\Component\HttpKernel\Client") |
| | [getHandleScript](#method_getHandleScript)() | from [Client](../../component/httpkernel/client#method_getHandleScript "Symfony\Component\HttpKernel\Client") |
| array | [filterFiles](#method_filterFiles)(array $files) Filters an array of files. | from [Client](../../component/httpkernel/client#method_filterFiles "Symfony\Component\HttpKernel\Client") |
| [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface")|null | [getContainer](#method_getContainer)() Returns the container. | |
| [KernelInterface](../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | [getKernel](#method_getKernel)() Returns the kernel. | |
| [Profile](../../component/httpkernel/profiler/profile "Symfony\Component\HttpKernel\Profiler\Profile")|false | [getProfile](#method_getProfile)() Gets the profile associated with the current Response. | |
| | [enableProfiler](#method_enableProfiler)() Enables the profiler for the very next request. | |
| | [disableReboot](#method_disableReboot)() Disables kernel reboot between requests. | |
| | [enableReboot](#method_enableReboot)() Enables kernel reboot between requests. | |
Details
-------
###
\_\_construct([HttpKernelInterface](../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") $kernel, array $server = array(), [History](../../component/browserkit/history "Symfony\Component\BrowserKit\History") $history = null, [CookieJar](../../component/browserkit/cookiejar "Symfony\Component\BrowserKit\CookieJar") $cookieJar = null)
#### Parameters
| | | |
| --- | --- | --- |
| [HttpKernelInterface](../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") | $kernel | An HttpKernel instance |
| array | $server | The server parameters (equivalent of $\_SERVER) |
| [History](../../component/browserkit/history "Symfony\Component\BrowserKit\History") | $history | A History instance to store the browser history |
| [CookieJar](../../component/browserkit/cookiejar "Symfony\Component\BrowserKit\CookieJar") | $cookieJar | A CookieJar instance to store the cookies |
###
followRedirects(bool $followRedirect = true)
Sets whether to automatically follow redirects or not.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $followRedirect | Whether to follow redirects |
### bool
isFollowingRedirects()
Returns whether client automatically follows redirects or not.
#### Return Value
| | |
| --- | --- |
| bool | |
###
setMaxRedirects(int $maxRedirects)
Sets the maximum number of redirects that crawler can follow.
#### Parameters
| | | |
| --- | --- | --- |
| int | $maxRedirects | |
### int
getMaxRedirects()
Returns the maximum number of redirects that crawler can follow.
#### Return Value
| | |
| --- | --- |
| int | |
###
insulate(bool $insulated = true)
Sets the insulated flag.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $insulated | Whether to insulate the requests or not |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | When Symfony Process Component is not installed |
###
setServerParameters(array $server)
Sets server parameters.
#### Parameters
| | | |
| --- | --- | --- |
| array | $server | An array of server parameters |
###
setServerParameter(string $key, string $value)
Sets single server parameter.
#### Parameters
| | | |
| --- | --- | --- |
| string | $key | A key of the parameter |
| string | $value | A value of the parameter |
### string
getServerParameter(string $key, string $default = '')
Gets single server parameter for specified key.
#### Parameters
| | | |
| --- | --- | --- |
| string | $key | A key of the parameter to get |
| string | $default | A default value when key is undefined |
#### Return Value
| | |
| --- | --- |
| string | A value of the parameter |
### [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")
xmlHttpRequest(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true)
#### Parameters
| | | |
| --- | --- | --- |
| string | $method | |
| string | $uri | |
| array | $parameters | |
| array | $files | |
| array | $server | |
| string | $content | |
| bool | $changeHistory | |
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | |
### [History](../../component/browserkit/history "Symfony\Component\BrowserKit\History")
getHistory()
Returns the History instance.
#### Return Value
| | |
| --- | --- |
| [History](../../component/browserkit/history "Symfony\Component\BrowserKit\History") | A History instance |
### [CookieJar](../../component/browserkit/cookiejar "Symfony\Component\BrowserKit\CookieJar")
getCookieJar()
Returns the CookieJar instance.
#### Return Value
| | |
| --- | --- |
| [CookieJar](../../component/browserkit/cookiejar "Symfony\Component\BrowserKit\CookieJar") | A CookieJar instance |
### [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")
getCrawler()
Returns the current Crawler instance.
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | A Crawler instance |
### [Response](../../component/browserkit/response "Symfony\Component\BrowserKit\Response")
getInternalResponse()
Returns the current BrowserKit Response instance.
#### Return Value
| | |
| --- | --- |
| [Response](../../component/browserkit/response "Symfony\Component\BrowserKit\Response") | A BrowserKit Response instance |
### Response
getResponse()
A Response instance
#### Return Value
| | |
| --- | --- |
| Response | |
### [Request](../../component/browserkit/request "Symfony\Component\BrowserKit\Request")
getInternalRequest()
Returns the current BrowserKit Request instance.
#### Return Value
| | |
| --- | --- |
| [Request](../../component/browserkit/request "Symfony\Component\BrowserKit\Request") | A BrowserKit Request instance |
### Request
getRequest()
A Request instance
#### Return Value
| | |
| --- | --- |
| Request | |
### [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")
click([Link](../../component/domcrawler/link "Symfony\Component\DomCrawler\Link") $link)
Clicks on a given link.
#### Parameters
| | | |
| --- | --- | --- |
| [Link](../../component/domcrawler/link "Symfony\Component\DomCrawler\Link") | $link | |
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | |
### [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")
submit([Form](../../component/domcrawler/form "Symfony\Component\DomCrawler\Form") $form, array $values = array())
Submits a form.
#### Parameters
| | | |
| --- | --- | --- |
| [Form](../../component/domcrawler/form "Symfony\Component\DomCrawler\Form") | $form | |
| array | $values | |
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | |
### [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")
request(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true)
Calls a URI.
#### Parameters
| | | |
| --- | --- | --- |
| string | $method | The request method |
| string | $uri | The URI to fetch |
| array | $parameters | The Request parameters |
| array | $files | The files |
| array | $server | The server parameters (HTTP headers are referenced with a HTTP\_ prefix as PHP does) |
| string | $content | The raw body data |
| bool | $changeHistory | Whether to update the history or not (only used internally for back(), forward(), and reload()) |
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | |
### protected object
doRequestInProcess(object $request)
Makes a request in another process.
#### Parameters
| | | |
| --- | --- | --- |
| object | $request | An origin request instance |
#### Return Value
| | |
| --- | --- |
| object | An origin response instance |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | When processing returns exit code |
### protected object
doRequest(object $request)
Makes a request.
#### Parameters
| | | |
| --- | --- | --- |
| object | $request | An origin request instance |
#### Return Value
| | |
| --- | --- |
| object | An origin response instance |
### protected
getScript(object $request)
Returns the script to execute when the request must be insulated.
It assumes that the autoloader is named 'autoload.php' and that it is stored in the same directory as the kernel (this is the case for the Symfony Standard Edition). If this is not your case, create your own client and override this method.
#### Parameters
| | | |
| --- | --- | --- |
| object | $request | An origin request instance |
### protected object
filterRequest([Request](../../component/browserkit/request "Symfony\Component\BrowserKit\Request") $request)
Converts the BrowserKit request to a HttpKernel request.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../component/browserkit/request "Symfony\Component\BrowserKit\Request") | $request | The BrowserKit Request to filter |
#### Return Value
| | |
| --- | --- |
| object | An origin request instance |
### protected [Response](../../component/browserkit/response "Symfony\Component\BrowserKit\Response")
filterResponse(object $response)
Converts the HttpKernel response to a BrowserKit response.
#### Parameters
| | | |
| --- | --- | --- |
| object | $response | The origin response to filter |
#### Return Value
| | |
| --- | --- |
| [Response](../../component/browserkit/response "Symfony\Component\BrowserKit\Response") | An BrowserKit Response instance |
### protected [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")|null
createCrawlerFromContent(string $uri, string $content, string $type)
Creates a crawler.
This method returns null if the DomCrawler component is not available.
#### Parameters
| | | |
| --- | --- | --- |
| string | $uri | A URI |
| string | $content | Content for the crawler to use |
| string | $type | Content type |
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")|null | |
### [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")
back()
Goes back in the browser history.
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | |
### [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")
forward()
Goes forward in the browser history.
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | |
### [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")
reload()
Reloads the current browser.
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | |
### [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")
followRedirect()
Follow redirects?
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If request was not a redirect |
###
restart()
Restarts the client.
It flushes history and all cookies.
### protected string
getAbsoluteUri(string $uri)
Takes a URI and converts it to absolute if it is not already absolute.
#### Parameters
| | | |
| --- | --- | --- |
| string | $uri | A URI |
#### Return Value
| | |
| --- | --- |
| string | An absolute URI |
### protected [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler")
requestFromRequest([Request](../../component/browserkit/request "Symfony\Component\BrowserKit\Request") $request, bool $changeHistory = true)
Makes a request from a Request object directly.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../component/browserkit/request "Symfony\Component\BrowserKit\Request") | $request | A Request instance |
| bool | $changeHistory | Whether to update the history or not (only used internally for back(), forward(), and reload()) |
#### Return Value
| | |
| --- | --- |
| [Crawler](../../component/domcrawler/crawler "Symfony\Component\DomCrawler\Crawler") | |
###
catchExceptions(bool $catchExceptions)
Sets whether to catch exceptions when the kernel is handling a request.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $catchExceptions | Whether to catch exceptions |
### protected
getHandleScript()
### protected array
filterFiles(array $files)
Filters an array of files.
This method created test instances of UploadedFile so that the move() method can be called on those instances.
If the size of a file is greater than the allowed size (from php.ini) then an invalid UploadedFile is returned with an error set to UPLOAD\_ERR\_INI\_SIZE.
#### Parameters
| | | |
| --- | --- | --- |
| array | $files | |
#### Return Value
| | |
| --- | --- |
| array | An array with all uploaded files marked as already moved |
#### See also
| | |
| --- | --- |
| [UploadedFile](../../component/httpfoundation/file/uploadedfile "Symfony\Component\HttpFoundation\File\UploadedFile") | |
### [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface")|null
getContainer()
Returns the container.
#### Return Value
| | |
| --- | --- |
| [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface")|null | Returns null when the Kernel has been shutdown or not started yet |
### [KernelInterface](../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface")
getKernel()
Returns the kernel.
#### Return Value
| | |
| --- | --- |
| [KernelInterface](../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | |
### [Profile](../../component/httpkernel/profiler/profile "Symfony\Component\HttpKernel\Profiler\Profile")|false
getProfile()
Gets the profile associated with the current Response.
#### Return Value
| | |
| --- | --- |
| [Profile](../../component/httpkernel/profiler/profile "Symfony\Component\HttpKernel\Profiler\Profile")|false | A Profile instance |
###
enableProfiler()
Enables the profiler for the very next request.
If the profiler is not enabled, the call to this method does nothing.
###
disableReboot()
Disables kernel reboot between requests.
By default, the Client reboots the Kernel for each request. This method allows to keep the same kernel across requests.
###
enableReboot()
Enables kernel reboot between requests.
| programming_docs |
symfony Symfony\Bundle\FrameworkBundle\DataCollector Symfony\Bundle\FrameworkBundle\DataCollector
============================================
Classes
-------
| | |
| --- | --- |
| [RequestDataCollector](datacollector/requestdatacollector "Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector") deprecated | RequestDataCollector. |
| [RouterDataCollector](datacollector/routerdatacollector "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector") | RouterDataCollector. |
symfony Symfony\Bundle\FrameworkBundle\Translation Symfony\Bundle\FrameworkBundle\Translation
==========================================
Classes
-------
| | |
| --- | --- |
| [Translator](translation/translator "Symfony\Bundle\FrameworkBundle\Translation\Translator") | Translator. |
symfony Symfony\Bundle\FrameworkBundle\Command Symfony\Bundle\FrameworkBundle\Command
======================================
Classes
-------
| | |
| --- | --- |
| [AboutCommand](command/aboutcommand "Symfony\Bundle\FrameworkBundle\Command\AboutCommand") | A console command to display information about the current installation. |
| [AbstractConfigCommand](command/abstractconfigcommand "Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand") | A console command for dumping available configuration reference. |
| [AssetsInstallCommand](command/assetsinstallcommand "Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand") | Command that places bundle web assets into a given directory. |
| [CacheClearCommand](command/cacheclearcommand "Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand") | Clear and Warmup the cache. |
| [CachePoolClearCommand](command/cachepoolclearcommand "Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand") | Clear cache pools. |
| [CachePoolDeleteCommand](command/cachepooldeletecommand "Symfony\Bundle\FrameworkBundle\Command\CachePoolDeleteCommand") | Delete an item from a cache pool. |
| [CachePoolPruneCommand](command/cachepoolprunecommand "Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand") | Cache pool pruner command. |
| [CacheWarmupCommand](command/cachewarmupcommand "Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand") | Warmup the cache. |
| [ConfigDebugCommand](command/configdebugcommand "Symfony\Bundle\FrameworkBundle\Command\ConfigDebugCommand") | A console command for dumping available configuration reference. |
| [ConfigDumpReferenceCommand](command/configdumpreferencecommand "Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand") | A console command for dumping available configuration reference. |
| [ContainerAwareCommand](command/containerawarecommand "Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand") | Command. |
| [ContainerDebugCommand](command/containerdebugcommand "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") | A console command for retrieving information about services. |
| [DebugAutowiringCommand](command/debugautowiringcommand "Symfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand") | A console command for autowiring information. |
| [EventDispatcherDebugCommand](command/eventdispatcherdebugcommand "Symfony\Bundle\FrameworkBundle\Command\EventDispatcherDebugCommand") | A console command for retrieving information about event dispatcher. |
| [RouterDebugCommand](command/routerdebugcommand "Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand") | A console command for retrieving information about routes. |
| [RouterMatchCommand](command/routermatchcommand "Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand") | A console command to test route matching. |
| [TranslationDebugCommand](command/translationdebugcommand "Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand") | Helps finding unused or missing translation messages in a given locale and comparing them with the fallback ones. |
| [TranslationUpdateCommand](command/translationupdatecommand "Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand") | A command that parses templates to extract translation messages and adds them into the translation files. |
| [WorkflowDumpCommand](command/workflowdumpcommand "Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand") | |
| [XliffLintCommand](command/xlifflintcommand "Symfony\Bundle\FrameworkBundle\Command\XliffLintCommand") | Validates XLIFF files syntax and outputs encountered errors. |
| [YamlLintCommand](command/yamllintcommand "Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand") | Validates YAML files syntax and outputs encountered errors. |
symfony Symfony\Bundle\FrameworkBundle\Test Symfony\Bundle\FrameworkBundle\Test
===================================
Classes
-------
| | |
| --- | --- |
| [KernelTestCase](test/kerneltestcase "Symfony\Bundle\FrameworkBundle\Test\KernelTestCase") | KernelTestCase is the base class for tests needing a Kernel. |
| [TestContainer](test/testcontainer "Symfony\Bundle\FrameworkBundle\Test\TestContainer") | |
| [WebTestCase](test/webtestcase "Symfony\Bundle\FrameworkBundle\Test\WebTestCase") | WebTestCase is the base class for functional tests. |
symfony Symfony\Bundle\FrameworkBundle\Controller Symfony\Bundle\FrameworkBundle\Controller
=========================================
Classes
-------
| | |
| --- | --- |
| [AbstractController](controller/abstractcontroller "Symfony\Bundle\FrameworkBundle\Controller\AbstractController") | Provides common features needed in controllers. |
| [Controller](controller/controller "Symfony\Bundle\FrameworkBundle\Controller\Controller") | Controller is a simple implementation of a Controller. |
| [ControllerNameParser](controller/controllernameparser "Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser") deprecated | ControllerNameParser converts controller from the short notation a:b:c (BlogBundle:Post:index) to a fully-qualified class::method string (Bundle\BlogBundle\Controller\PostController::indexAction). |
| [ControllerResolver](controller/controllerresolver "Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver") | |
| [ControllerTrait](controller/controllertrait "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") | Common features needed in controllers. |
| [RedirectController](controller/redirectcontroller "Symfony\Bundle\FrameworkBundle\Controller\RedirectController") | Redirects a request to another URL. |
| [TemplateController](controller/templatecontroller "Symfony\Bundle\FrameworkBundle\Controller\TemplateController") | TemplateController. |
symfony Symfony\Bundle\FrameworkBundle\Templating Symfony\Bundle\FrameworkBundle\Templating
=========================================
Namespaces
----------
[Symfony\Bundle\FrameworkBundle\Templating\Helper](templating/helper)[Symfony\Bundle\FrameworkBundle\Templating\Loader](templating/loader) Classes
-------
| | |
| --- | --- |
| [DelegatingEngine](templating/delegatingengine "Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine") | DelegatingEngine selects an engine for a given template. |
| [GlobalVariables](templating/globalvariables "Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables") | GlobalVariables is the entry point for Symfony global variables in PHP templates. |
| [PhpEngine](templating/phpengine "Symfony\Bundle\FrameworkBundle\Templating\PhpEngine") | This engine knows how to render Symfony templates. |
| [TemplateFilenameParser](templating/templatefilenameparser "Symfony\Bundle\FrameworkBundle\Templating\TemplateFilenameParser") | TemplateFilenameParser converts template filenames to TemplateReferenceInterface instances. |
| [TemplateNameParser](templating/templatenameparser "Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser") | TemplateNameParser converts template names from the short notation "bundle:section:template.format.engine" to TemplateReferenceInterface instances. |
| [TemplateReference](templating/templatereference "Symfony\Bundle\FrameworkBundle\Templating\TemplateReference") | Internal representation of a template. |
| [TimedPhpEngine](templating/timedphpengine "Symfony\Bundle\FrameworkBundle\Templating\TimedPhpEngine") | Times the time spent to render a template. |
Interfaces
----------
| | |
| --- | --- |
| *[EngineInterface](templating/engineinterface "Symfony\Bundle\FrameworkBundle\Templating\EngineInterface")* | EngineInterface is the interface each engine must implement. |
symfony Symfony\Bundle\FrameworkBundle\Kernel Symfony\Bundle\FrameworkBundle\Kernel
=====================================
Classes
-------
| | |
| --- | --- |
| [MicroKernelTrait](kernel/microkerneltrait "Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait") | A Kernel that provides configuration hooks. |
symfony Symfony\Bundle\FrameworkBundle\DependencyInjection Symfony\Bundle\FrameworkBundle\DependencyInjection
==================================================
Namespaces
----------
[Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler](dependencyinjection/compiler) Classes
-------
| | |
| --- | --- |
| [Configuration](dependencyinjection/configuration "Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration") | FrameworkExtension configuration structure. |
| [FrameworkExtension](dependencyinjection/frameworkextension "Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension") | FrameworkExtension. |
symfony Symfony\Bundle\FrameworkBundle\Console Symfony\Bundle\FrameworkBundle\Console
======================================
Namespaces
----------
[Symfony\Bundle\FrameworkBundle\Console\Descriptor](console/descriptor)[Symfony\Bundle\FrameworkBundle\Console\Helper](console/helper) Classes
-------
| | |
| --- | --- |
| [Application](console/application "Symfony\Bundle\FrameworkBundle\Console\Application") | |
symfony Symfony\Bundle\FrameworkBundle\EventListener Symfony\Bundle\FrameworkBundle\EventListener
============================================
Classes
-------
| | |
| --- | --- |
| [ResolveControllerNameSubscriber](eventlistener/resolvecontrollernamesubscriber "Symfony\Bundle\FrameworkBundle\EventListener\ResolveControllerNameSubscriber") deprecated | Guarantees that the \_controller key is parsed into its final format. |
symfony Symfony\Bundle\FrameworkBundle\CacheWarmer Symfony\Bundle\FrameworkBundle\CacheWarmer
==========================================
Classes
-------
| | |
| --- | --- |
| [AbstractPhpFileCacheWarmer](cachewarmer/abstractphpfilecachewarmer "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer") | |
| [AnnotationsCacheWarmer](cachewarmer/annotationscachewarmer "Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer") | Warms up annotation caches for classes found in composer's autoload class map and declared in DI bundle extensions using the addAnnotatedClassesToCache method. |
| [RouterCacheWarmer](cachewarmer/routercachewarmer "Symfony\Bundle\FrameworkBundle\CacheWarmer\RouterCacheWarmer") | Generates the router matcher and generator classes. |
| [SerializerCacheWarmer](cachewarmer/serializercachewarmer "Symfony\Bundle\FrameworkBundle\CacheWarmer\SerializerCacheWarmer") | Warms up XML and YAML serializer metadata. |
| [TemplateFinder](cachewarmer/templatefinder "Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder") | Finds all the templates. |
| [TemplatePathsCacheWarmer](cachewarmer/templatepathscachewarmer "Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplatePathsCacheWarmer") | Computes the association between template names and their paths on the disk. |
| [TranslationsCacheWarmer](cachewarmer/translationscachewarmer "Symfony\Bundle\FrameworkBundle\CacheWarmer\TranslationsCacheWarmer") | Generates the catalogues for translations. |
| [ValidatorCacheWarmer](cachewarmer/validatorcachewarmer "Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer") | Warms up XML and YAML validator metadata. |
Interfaces
----------
| | |
| --- | --- |
| *[TemplateFinderInterface](cachewarmer/templatefinderinterface "Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface")* | Interface for finding all the templates. |
symfony Symfony\Bundle\FrameworkBundle\HttpCache Symfony\Bundle\FrameworkBundle\HttpCache
========================================
Classes
-------
| | |
| --- | --- |
| [HttpCache](httpcache/httpcache "Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache") | Manages HTTP cache objects in a Container. |
symfony RouterDataCollector RouterDataCollector
====================
class **RouterDataCollector** extends [RouterDataCollector](../../../component/httpkernel/datacollector/routerdatacollector "Symfony\Component\HttpKernel\DataCollector\RouterDataCollector")
RouterDataCollector.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $data | | from [DataCollector](../../../component/httpkernel/datacollector/datacollector#property_data "Symfony\Component\HttpKernel\DataCollector\DataCollector") |
| protected [SplObjectStorage](http://php.net/SplObjectStorage) | $controllers | | from [RouterDataCollector](../../../component/httpkernel/datacollector/routerdatacollector#property_controllers "Symfony\Component\HttpKernel\DataCollector\RouterDataCollector") |
Methods
-------
| | | |
| --- | --- | --- |
| | [serialize](#method_serialize)() | from [DataCollector](../../../component/httpkernel/datacollector/datacollector#method_serialize "Symfony\Component\HttpKernel\DataCollector\DataCollector") |
| | [unserialize](#method_unserialize)($data) | from [DataCollector](../../../component/httpkernel/datacollector/datacollector#method_unserialize "Symfony\Component\HttpKernel\DataCollector\DataCollector") |
| [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | [cloneVar](#method_cloneVar)(mixed $var) Converts the variable into a serializable Data instance. | from [DataCollector](../../../component/httpkernel/datacollector/datacollector#method_cloneVar "Symfony\Component\HttpKernel\DataCollector\DataCollector") |
| callable[] | [getCasters](#method_getCasters)() | from [DataCollector](../../../component/httpkernel/datacollector/datacollector#method_getCasters "Symfony\Component\HttpKernel\DataCollector\DataCollector") |
| | [\_\_construct](#method___construct)() | from [RouterDataCollector](../../../component/httpkernel/datacollector/routerdatacollector#method___construct "Symfony\Component\HttpKernel\DataCollector\RouterDataCollector") |
| | [collect](#method_collect)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null) Collects data for the given Request and Response. | from [RouterDataCollector](../../../component/httpkernel/datacollector/routerdatacollector#method_collect "Symfony\Component\HttpKernel\DataCollector\RouterDataCollector") |
| | [reset](#method_reset)() Resets this data collector to its initial state. | from [RouterDataCollector](../../../component/httpkernel/datacollector/routerdatacollector#method_reset "Symfony\Component\HttpKernel\DataCollector\RouterDataCollector") |
| | [guessRoute](#method_guessRoute)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, $controller) | |
| | [onKernelController](#method_onKernelController)([FilterControllerEvent](../../../component/httpkernel/event/filtercontrollerevent "Symfony\Component\HttpKernel\Event\FilterControllerEvent") $event) Remembers the controller associated to each request. | from [RouterDataCollector](../../../component/httpkernel/datacollector/routerdatacollector#method_onKernelController "Symfony\Component\HttpKernel\DataCollector\RouterDataCollector") |
| bool | [getRedirect](#method_getRedirect)() | from [RouterDataCollector](../../../component/httpkernel/datacollector/routerdatacollector#method_getRedirect "Symfony\Component\HttpKernel\DataCollector\RouterDataCollector") |
| string|null | [getTargetUrl](#method_getTargetUrl)() | from [RouterDataCollector](../../../component/httpkernel/datacollector/routerdatacollector#method_getTargetUrl "Symfony\Component\HttpKernel\DataCollector\RouterDataCollector") |
| string|null | [getTargetRoute](#method_getTargetRoute)() | from [RouterDataCollector](../../../component/httpkernel/datacollector/routerdatacollector#method_getTargetRoute "Symfony\Component\HttpKernel\DataCollector\RouterDataCollector") |
| string | [getName](#method_getName)() Returns the name of the collector. | from [RouterDataCollector](../../../component/httpkernel/datacollector/routerdatacollector#method_getName "Symfony\Component\HttpKernel\DataCollector\RouterDataCollector") |
Details
-------
###
serialize()
###
unserialize($data)
#### Parameters
| | | |
| --- | --- | --- |
| | $data | |
### protected [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data")
cloneVar(mixed $var)
Converts the variable into a serializable Data instance.
This array can be displayed in the template using the VarDumper component.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $var | |
#### Return Value
| | |
| --- | --- |
| [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | |
### protected callable[]
getCasters()
#### Return Value
| | |
| --- | --- |
| callable[] | The casters to add to the cloner |
###
\_\_construct()
###
collect([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null)
Collects data for the given Request and Response.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | |
| [Exception](http://php.net/Exception) | $exception | |
###
reset()
Resets this data collector to its initial state.
###
guessRoute([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, $controller)
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| | $controller | |
###
onKernelController([FilterControllerEvent](../../../component/httpkernel/event/filtercontrollerevent "Symfony\Component\HttpKernel\Event\FilterControllerEvent") $event)
Remembers the controller associated to each request.
#### Parameters
| | | |
| --- | --- | --- |
| [FilterControllerEvent](../../../component/httpkernel/event/filtercontrollerevent "Symfony\Component\HttpKernel\Event\FilterControllerEvent") | $event | |
### bool
getRedirect()
#### Return Value
| | |
| --- | --- |
| bool | Whether this request will result in a redirect |
### string|null
getTargetUrl()
#### Return Value
| | |
| --- | --- |
| string|null | The target URL |
### string|null
getTargetRoute()
#### Return Value
| | |
| --- | --- |
| string|null | The target route |
### string
getName()
Returns the name of the collector.
#### Return Value
| | |
| --- | --- |
| string | The collector name |
symfony RequestDataCollector deprecated RequestDataCollector deprecated
================================
class **RequestDataCollector** extends [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector")
deprecated
| since | Symfony 4.1 |
RequestDataCollector.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $data | | from [DataCollector](../../../component/httpkernel/datacollector/datacollector#property_data "Symfony\Component\HttpKernel\DataCollector\DataCollector") |
| protected | $controllers | | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#property_controllers "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
Methods
-------
| | | |
| --- | --- | --- |
| | [serialize](#method_serialize)() | from [DataCollector](../../../component/httpkernel/datacollector/datacollector#method_serialize "Symfony\Component\HttpKernel\DataCollector\DataCollector") |
| | [unserialize](#method_unserialize)($data) | from [DataCollector](../../../component/httpkernel/datacollector/datacollector#method_unserialize "Symfony\Component\HttpKernel\DataCollector\DataCollector") |
| [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | [cloneVar](#method_cloneVar)(mixed $var) Converts the variable into a serializable Data instance. | from [DataCollector](../../../component/httpkernel/datacollector/datacollector#method_cloneVar "Symfony\Component\HttpKernel\DataCollector\DataCollector") |
| callable[] | [getCasters](#method_getCasters)() | from [DataCollector](../../../component/httpkernel/datacollector/datacollector#method_getCasters "Symfony\Component\HttpKernel\DataCollector\DataCollector") |
| | [\_\_construct](#method___construct)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method___construct "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [collect](#method_collect)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null) Collects data for the given Request and Response. | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_collect "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [lateCollect](#method_lateCollect)() Collects data as late as possible. | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_lateCollect "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [reset](#method_reset)() Resets this data collector to its initial state. | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_reset "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getMethod](#method_getMethod)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getMethod "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getPathInfo](#method_getPathInfo)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getPathInfo "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getRequestRequest](#method_getRequestRequest)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getRequestRequest "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getRequestQuery](#method_getRequestQuery)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getRequestQuery "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getRequestHeaders](#method_getRequestHeaders)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getRequestHeaders "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getRequestServer](#method_getRequestServer)($raw = false) | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getRequestServer "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getRequestCookies](#method_getRequestCookies)($raw = false) | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getRequestCookies "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getRequestAttributes](#method_getRequestAttributes)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getRequestAttributes "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getResponseHeaders](#method_getResponseHeaders)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getResponseHeaders "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getResponseCookies](#method_getResponseCookies)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getResponseCookies "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getSessionMetadata](#method_getSessionMetadata)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getSessionMetadata "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getSessionAttributes](#method_getSessionAttributes)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getSessionAttributes "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getFlashes](#method_getFlashes)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getFlashes "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getContent](#method_getContent)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getContent "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getContentType](#method_getContentType)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getContentType "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getStatusText](#method_getStatusText)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getStatusText "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getStatusCode](#method_getStatusCode)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getStatusCode "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getFormat](#method_getFormat)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getFormat "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getLocale](#method_getLocale)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getLocale "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getDotenvVars](#method_getDotenvVars)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getDotenvVars "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| string | [getRoute](#method_getRoute)() Gets the route name. | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getRoute "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getIdentifier](#method_getIdentifier)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getIdentifier "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| array | [getRouteParams](#method_getRouteParams)() Gets the route parameters. | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getRouteParams "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| array|string | [getController](#method_getController)() Gets the parsed controller. | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getController "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| array|bool | [getRedirect](#method_getRedirect)() Gets the previous request attributes. | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getRedirect "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [getForwardToken](#method_getForwardToken)() | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getForwardToken "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [onKernelController](#method_onKernelController)([FilterControllerEvent](../../../component/httpkernel/event/filtercontrollerevent "Symfony\Component\HttpKernel\Event\FilterControllerEvent") $event) | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_onKernelController "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| | [onKernelResponse](#method_onKernelResponse)([FilterResponseEvent](../../../component/httpkernel/event/filterresponseevent "Symfony\Component\HttpKernel\Event\FilterResponseEvent") $event) | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_onKernelResponse "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getSubscribedEvents "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| string | [getName](#method_getName)() Returns the name of the collector. | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_getName "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
| array|string | [parseController](#method_parseController)(mixed $controller) Parse a controller. | from [RequestDataCollector](../../../component/httpkernel/datacollector/requestdatacollector#method_parseController "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector") |
Details
-------
###
serialize()
###
unserialize($data)
#### Parameters
| | | |
| --- | --- | --- |
| | $data | |
### protected [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data")
cloneVar(mixed $var)
Converts the variable into a serializable Data instance.
This array can be displayed in the template using the VarDumper component.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $var | |
#### Return Value
| | |
| --- | --- |
| [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | |
### protected callable[]
getCasters()
#### Return Value
| | |
| --- | --- |
| callable[] | The casters to add to the cloner |
###
\_\_construct()
###
collect([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null)
Collects data for the given Request and Response.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | |
| [Exception](http://php.net/Exception) | $exception | |
###
lateCollect()
Collects data as late as possible.
###
reset()
Resets this data collector to its initial state.
###
getMethod()
###
getPathInfo()
###
getRequestRequest()
###
getRequestQuery()
###
getRequestHeaders()
###
getRequestServer($raw = false)
#### Parameters
| | | |
| --- | --- | --- |
| | $raw | |
###
getRequestCookies($raw = false)
#### Parameters
| | | |
| --- | --- | --- |
| | $raw | |
###
getRequestAttributes()
###
getResponseHeaders()
###
getResponseCookies()
###
getSessionMetadata()
###
getSessionAttributes()
###
getFlashes()
###
getContent()
###
getContentType()
###
getStatusText()
###
getStatusCode()
###
getFormat()
###
getLocale()
###
getDotenvVars()
### string
getRoute()
Gets the route name.
The \_route request attributes is automatically set by the Router Matcher.
#### Return Value
| | |
| --- | --- |
| string | The route |
###
getIdentifier()
### array
getRouteParams()
Gets the route parameters.
The \_route\_params request attributes is automatically set by the RouterListener.
#### Return Value
| | |
| --- | --- |
| array | The parameters |
### array|string
getController()
Gets the parsed controller.
#### Return Value
| | |
| --- | --- |
| array|string | The controller as a string or array of data with keys 'class', 'method', 'file' and 'line' |
### array|bool
getRedirect()
Gets the previous request attributes.
#### Return Value
| | |
| --- | --- |
| array|bool | A legacy array of data from the previous redirection response or false otherwise |
###
getForwardToken()
###
onKernelController([FilterControllerEvent](../../../component/httpkernel/event/filtercontrollerevent "Symfony\Component\HttpKernel\Event\FilterControllerEvent") $event)
#### Parameters
| | | |
| --- | --- | --- |
| [FilterControllerEvent](../../../component/httpkernel/event/filtercontrollerevent "Symfony\Component\HttpKernel\Event\FilterControllerEvent") | $event | |
###
onKernelResponse([FilterResponseEvent](../../../component/httpkernel/event/filterresponseevent "Symfony\Component\HttpKernel\Event\FilterResponseEvent") $event)
#### Parameters
| | | |
| --- | --- | --- |
| [FilterResponseEvent](../../../component/httpkernel/event/filterresponseevent "Symfony\Component\HttpKernel\Event\FilterResponseEvent") | $event | |
### static array
getSubscribedEvents()
Returns an array of event names this subscriber wants to listen to.
The array keys are event names and the value can be:
* The method name to call (priority defaults to 0)
* An array composed of the method name to call and the priority
* An array of arrays composed of the method names to call and respective priorities, or 0 if unset
For instance:
* array('eventName' => 'methodName')
* array('eventName' => array('methodName', $priority))
* array('eventName' => array(array('methodName1', $priority), array('methodName2')))
#### Return Value
| | |
| --- | --- |
| array | The event names to listen to |
### string
getName()
Returns the name of the collector.
#### Return Value
| | |
| --- | --- |
| string | The collector name |
### protected array|string
parseController(mixed $controller)
Parse a controller.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $controller | The controller to parse |
#### Return Value
| | |
| --- | --- |
| array|string | An array of controller data or a simple string |
| programming_docs |
symfony WebTestCase WebTestCase
============
abstract class **WebTestCase** extends [KernelTestCase](kerneltestcase "Symfony\Bundle\FrameworkBundle\Test\KernelTestCase")
WebTestCase is the base class for functional tests.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $class | | from [KernelTestCase](kerneltestcase#property_class "Symfony\Bundle\FrameworkBundle\Test\KernelTestCase") |
| static protected [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | $kernel | | from [KernelTestCase](kerneltestcase#property_kernel "Symfony\Bundle\FrameworkBundle\Test\KernelTestCase") |
| static protected [ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | | from [KernelTestCase](kerneltestcase#property_container "Symfony\Bundle\FrameworkBundle\Test\KernelTestCase") |
Methods
-------
| | | |
| --- | --- | --- |
| static string | [getKernelClass](#method_getKernelClass)() | from [KernelTestCase](kerneltestcase#method_getKernelClass "Symfony\Bundle\FrameworkBundle\Test\KernelTestCase") |
| static [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | [bootKernel](#method_bootKernel)(array $options = array()) Boots the Kernel for this test. | from [KernelTestCase](kerneltestcase#method_bootKernel "Symfony\Bundle\FrameworkBundle\Test\KernelTestCase") |
| static [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | [createKernel](#method_createKernel)(array $options = array()) Creates a Kernel. | from [KernelTestCase](kerneltestcase#method_createKernel "Symfony\Bundle\FrameworkBundle\Test\KernelTestCase") |
| static | [ensureKernelShutdown](#method_ensureKernelShutdown)() Shuts the kernel down if it was used in the test. | from [KernelTestCase](kerneltestcase#method_ensureKernelShutdown "Symfony\Bundle\FrameworkBundle\Test\KernelTestCase") |
| | [tearDown](#method_tearDown)() Clean up Kernel usage in this test. | from [KernelTestCase](kerneltestcase#method_tearDown "Symfony\Bundle\FrameworkBundle\Test\KernelTestCase") |
| static [Client](../client "Symfony\Bundle\FrameworkBundle\Client") | [createClient](#method_createClient)(array $options = array(), array $server = array()) Creates a Client. | |
Details
-------
### static protected string
getKernelClass()
#### Return Value
| | |
| --- | --- |
| string | The Kernel class name |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | |
| [LogicException](http://php.net/LogicException) | |
### static protected [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface")
bootKernel(array $options = array())
Boots the Kernel for this test.
#### Parameters
| | | |
| --- | --- | --- |
| array | $options | |
#### Return Value
| | |
| --- | --- |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | A KernelInterface instance |
### static protected [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface")
createKernel(array $options = array())
Creates a Kernel.
Available options:
* environment
* debug
#### Parameters
| | | |
| --- | --- | --- |
| array | $options | |
#### Return Value
| | |
| --- | --- |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | A KernelInterface instance |
### static protected
ensureKernelShutdown()
Shuts the kernel down if it was used in the test.
### protected
tearDown()
Clean up Kernel usage in this test.
### static protected [Client](../client "Symfony\Bundle\FrameworkBundle\Client")
createClient(array $options = array(), array $server = array())
Creates a Client.
#### Parameters
| | | |
| --- | --- | --- |
| array | $options | An array of options to pass to the createKernel method |
| array | $server | An array of server parameters |
#### Return Value
| | |
| --- | --- |
| [Client](../client "Symfony\Bundle\FrameworkBundle\Client") | A Client instance |
symfony TestContainer TestContainer
==============
class **TestContainer** extends [Container](../../../component/dependencyinjection/container "Symfony\Component\DependencyInjection\Container")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $parameterBag | | from [Container](../../../component/dependencyinjection/container#property_parameterBag "Symfony\Component\DependencyInjection\Container") |
| protected | $services | | from [Container](../../../component/dependencyinjection/container#property_services "Symfony\Component\DependencyInjection\Container") |
| protected | $fileMap | | from [Container](../../../component/dependencyinjection/container#property_fileMap "Symfony\Component\DependencyInjection\Container") |
| protected | $methodMap | | from [Container](../../../component/dependencyinjection/container#property_methodMap "Symfony\Component\DependencyInjection\Container") |
| protected | $factories | | from [Container](../../../component/dependencyinjection/container#property_factories "Symfony\Component\DependencyInjection\Container") |
| protected | $aliases | | from [Container](../../../component/dependencyinjection/container#property_aliases "Symfony\Component\DependencyInjection\Container") |
| protected | $loading | | from [Container](../../../component/dependencyinjection/container#property_loading "Symfony\Component\DependencyInjection\Container") |
| protected | $resolving | | from [Container](../../../component/dependencyinjection/container#property_resolving "Symfony\Component\DependencyInjection\Container") |
| protected | $syntheticIds | | from [Container](../../../component/dependencyinjection/container#property_syntheticIds "Symfony\Component\DependencyInjection\Container") |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel, string $privateServicesLocatorId) | |
| | [compile](#method_compile)() Compiles the container. | |
| bool | [isCompiled](#method_isCompiled)() Returns true if the container is compiled. | |
| [ParameterBagInterface](../../../component/dependencyinjection/parameterbag/parameterbaginterface "Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface") | [getParameterBag](#method_getParameterBag)() Gets the service container parameter bag. | |
| mixed | [getParameter](#method_getParameter)(string $name) Gets a parameter. | |
| bool | [hasParameter](#method_hasParameter)(string $name) Checks if a parameter exists. | |
| | [setParameter](#method_setParameter)(string $name, mixed $value) Sets a parameter. | |
| | [set](#method_set)(string $id, object $service) Sets a service. | |
| bool | [has](#method_has)(string $id) Returns true if the given service is defined. | |
| object | [get](#method_get)(string $id, int $invalidBehavior = 1) Gets a service. | |
| bool | [initialized](#method_initialized)(string $id) Returns true if the given service has actually been initialized. | |
| | [reset](#method_reset)() Resets shared services from the container. | |
| array | [getServiceIds](#method_getServiceIds)() Gets all service ids. | |
| array | [getRemovedIds](#method_getRemovedIds)() Gets service ids that existed at compile time. | |
| static string | [camelize](#method_camelize)(string $id) Camelizes a string. | from [Container](../../../component/dependencyinjection/container#method_camelize "Symfony\Component\DependencyInjection\Container") |
| static string | [underscore](#method_underscore)(string $id) A string to underscore. | from [Container](../../../component/dependencyinjection/container#method_underscore "Symfony\Component\DependencyInjection\Container") |
| object | [load](#method_load)($file) Creates a service by requiring its factory file. | from [Container](../../../component/dependencyinjection/container#method_load "Symfony\Component\DependencyInjection\Container") |
| mixed | [getEnv](#method_getEnv)(string $name) Fetches a variable from the environment. | from [Container](../../../component/dependencyinjection/container#method_getEnv "Symfony\Component\DependencyInjection\Container") |
Details
-------
###
\_\_construct([KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel, string $privateServicesLocatorId)
#### Parameters
| | | |
| --- | --- | --- |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | $kernel | |
| string | $privateServicesLocatorId | |
###
compile()
Compiles the container.
This method does two things:
* Parameter values are resolved;
* The parameter bag is frozen.
### bool
isCompiled()
Returns true if the container is compiled.
#### Return Value
| | |
| --- | --- |
| bool | |
### [ParameterBagInterface](../../../component/dependencyinjection/parameterbag/parameterbaginterface "Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface")
getParameterBag()
Gets the service container parameter bag.
#### Return Value
| | |
| --- | --- |
| [ParameterBagInterface](../../../component/dependencyinjection/parameterbag/parameterbaginterface "Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface") | A ParameterBagInterface instance |
### mixed
getParameter(string $name)
Gets a parameter.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The parameter name |
#### Return Value
| | |
| --- | --- |
| mixed | The parameter value |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/dependencyinjection/exception/invalidargumentexception "Symfony\Component\DependencyInjection\Exception\InvalidArgumentException") | if the parameter is not defined |
### bool
hasParameter(string $name)
Checks if a parameter exists.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The parameter name |
#### Return Value
| | |
| --- | --- |
| bool | The presence of parameter in container |
###
setParameter(string $name, mixed $value)
Sets a parameter.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The parameter name |
| mixed | $value | The parameter value |
###
set(string $id, object $service)
Sets a service.
Setting a service to null resets the service: has() returns false and get() behaves in the same way as if the service was never created.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | The service identifier |
| object | $service | The service instance |
### bool
has(string $id)
Returns true if the given service is defined.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | The service identifier |
#### Return Value
| | |
| --- | --- |
| bool | true if the service is defined, false otherwise |
### object
get(string $id, int $invalidBehavior = 1)
Gets a service.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | The service identifier |
| int | $invalidBehavior | The behavior when the service does not exist |
#### Return Value
| | |
| --- | --- |
| object | The associated service |
#### Exceptions
| | |
| --- | --- |
| [ServiceCircularReferenceException](../../../component/dependencyinjection/exception/servicecircularreferenceexception "Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException") | When a circular reference is detected |
| [ServiceNotFoundException](../../../component/dependencyinjection/exception/servicenotfoundexception "Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException") | When the service is not defined |
| [Exception](http://php.net/Exception) | if an exception has been thrown when the service has been resolved |
### bool
initialized(string $id)
Returns true if the given service has actually been initialized.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | |
#### Return Value
| | |
| --- | --- |
| bool | true if the service has been initialized, false otherwise |
###
reset()
Resets shared services from the container.
The container is not intended to be used again after being reset in a normal workflow. This method is meant as a way to release references for ref-counting. A subsequent call to ContainerInterface::get will recreate a new instance of the shared service.
### array
getServiceIds()
Gets all service ids.
#### Return Value
| | |
| --- | --- |
| array | An array of all defined service ids |
### array
getRemovedIds()
Gets service ids that existed at compile time.
#### Return Value
| | |
| --- | --- |
| array | |
### static string
camelize(string $id)
Camelizes a string.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | A string to camelize |
#### Return Value
| | |
| --- | --- |
| string | The camelized string |
### static string
underscore(string $id)
A string to underscore.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | The string to underscore |
#### Return Value
| | |
| --- | --- |
| string | The underscored string |
### protected object
load($file)
Creates a service by requiring its factory file.
#### Parameters
| | | |
| --- | --- | --- |
| | $file | |
#### Return Value
| | |
| --- | --- |
| object | The service created by the file |
### protected mixed
getEnv(string $name)
Fetches a variable from the environment.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the environment variable |
#### Return Value
| | |
| --- | --- |
| mixed | The value to use for the provided environment variable name |
#### Exceptions
| | |
| --- | --- |
| [EnvNotFoundException](../../../component/dependencyinjection/exception/envnotfoundexception "Symfony\Component\DependencyInjection\Exception\EnvNotFoundException") | When the environment variable is not found and has no default value |
symfony KernelTestCase KernelTestCase
===============
abstract class **KernelTestCase** extends TestCase
KernelTestCase is the base class for tests needing a Kernel.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $class | | |
| static protected [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | $kernel | | |
| static protected [ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string | [getKernelClass](#method_getKernelClass)() | |
| static [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | [bootKernel](#method_bootKernel)(array $options = array()) Boots the Kernel for this test. | |
| static [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | [createKernel](#method_createKernel)(array $options = array()) Creates a Kernel. | |
| static | [ensureKernelShutdown](#method_ensureKernelShutdown)() Shuts the kernel down if it was used in the test. | |
| | [tearDown](#method_tearDown)() Clean up Kernel usage in this test. | |
Details
-------
### static protected string
getKernelClass()
#### Return Value
| | |
| --- | --- |
| string | The Kernel class name |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | |
| [LogicException](http://php.net/LogicException) | |
### static protected [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface")
bootKernel(array $options = array())
Boots the Kernel for this test.
#### Parameters
| | | |
| --- | --- | --- |
| array | $options | |
#### Return Value
| | |
| --- | --- |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | A KernelInterface instance |
### static protected [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface")
createKernel(array $options = array())
Creates a Kernel.
Available options:
* environment
* debug
#### Parameters
| | | |
| --- | --- | --- |
| array | $options | |
#### Return Value
| | |
| --- | --- |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | A KernelInterface instance |
### static protected
ensureKernelShutdown()
Shuts the kernel down if it was used in the test.
### protected
tearDown()
Clean up Kernel usage in this test.
symfony Translator Translator
===========
class **Translator** extends [Translator](../../../component/translation/translator "Symfony\Component\Translation\Translator") implements [WarmableInterface](../../../component/httpkernel/cachewarmer/warmableinterface "Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface")
Translator.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [MessageCatalogueInterface](../../../component/translation/messagecatalogueinterface "Symfony\Component\Translation\MessageCatalogueInterface")[] | $catalogues | | from [Translator](../../../component/translation/translator#property_catalogues "Symfony\Component\Translation\Translator") |
| protected | $container | | |
| protected | $loaderIds | | |
| protected | $options | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(ContainerInterface $container, [MessageFormatterInterface](../../../component/translation/formatter/messageformatterinterface "Symfony\Component\Translation\Formatter\MessageFormatterInterface") $formatter, string $defaultLocale, array $loaderIds = array(), array $options = array()) Constructor. | |
| | [setConfigCacheFactory](#method_setConfigCacheFactory)([ConfigCacheFactoryInterface](../../../component/config/configcachefactoryinterface "Symfony\Component\Config\ConfigCacheFactoryInterface") $configCacheFactory) | from [Translator](../../../component/translation/translator#method_setConfigCacheFactory "Symfony\Component\Translation\Translator") |
| | [addLoader](#method_addLoader)(string $format, [LoaderInterface](../../../component/translation/loader/loaderinterface "Symfony\Component\Translation\Loader\LoaderInterface") $loader) Adds a Loader. | from [Translator](../../../component/translation/translator#method_addLoader "Symfony\Component\Translation\Translator") |
| | [addResource](#method_addResource)(string $format, mixed $resource, string $locale, string $domain = null) Adds a Resource. | |
| | [setLocale](#method_setLocale)(string $locale) Sets the current locale. | from [Translator](../../../component/translation/translator#method_setLocale "Symfony\Component\Translation\Translator") |
| string | [getLocale](#method_getLocale)() Returns the current locale. | from [Translator](../../../component/translation/translator#method_getLocale "Symfony\Component\Translation\Translator") |
| | [setFallbackLocales](#method_setFallbackLocales)(array $locales) Sets the fallback locales. | from [Translator](../../../component/translation/translator#method_setFallbackLocales "Symfony\Component\Translation\Translator") |
| array | [getFallbackLocales](#method_getFallbackLocales)() Gets the fallback locales. | from [Translator](../../../component/translation/translator#method_getFallbackLocales "Symfony\Component\Translation\Translator") |
| string | [trans](#method_trans)(string $id, array $parameters = array(), string|null $domain = null, string|null $locale = null) Translates the given message. | from [Translator](../../../component/translation/translator#method_trans "Symfony\Component\Translation\Translator") |
| string | [transChoice](#method_transChoice)(string $id, int $number, array $parameters = array(), string|null $domain = null, string|null $locale = null) Translates the given choice message by choosing a translation according to a number. | from [Translator](../../../component/translation/translator#method_transChoice "Symfony\Component\Translation\Translator") |
| [MessageCatalogueInterface](../../../component/translation/messagecatalogueinterface "Symfony\Component\Translation\MessageCatalogueInterface") | [getCatalogue](#method_getCatalogue)(string|null $locale = null) Gets the catalogue by locale. | from [Translator](../../../component/translation/translator#method_getCatalogue "Symfony\Component\Translation\Translator") |
| array | [getLoaders](#method_getLoaders)() Gets the loaders. | from [Translator](../../../component/translation/translator#method_getLoaders "Symfony\Component\Translation\Translator") |
| | [loadCatalogue](#method_loadCatalogue)(string $locale) | from [Translator](../../../component/translation/translator#method_loadCatalogue "Symfony\Component\Translation\Translator") |
| | [initializeCatalogue](#method_initializeCatalogue)(string $locale) | |
| | [computeFallbackLocales](#method_computeFallbackLocales)($locale) | from [Translator](../../../component/translation/translator#method_computeFallbackLocales "Symfony\Component\Translation\Translator") |
| | [assertValidLocale](#method_assertValidLocale)(string $locale) Asserts that the locale is valid, throws an Exception if not. | from [Translator](../../../component/translation/translator#method_assertValidLocale "Symfony\Component\Translation\Translator") |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | |
| | [initialize](#method_initialize)() | |
Details
-------
###
\_\_construct(ContainerInterface $container, [MessageFormatterInterface](../../../component/translation/formatter/messageformatterinterface "Symfony\Component\Translation\Formatter\MessageFormatterInterface") $formatter, string $defaultLocale, array $loaderIds = array(), array $options = array())
Constructor.
Available options:
* cache\_dir: The cache directory (or null to disable caching)
* debug: Whether to enable debugging or not (false by default)
* resource\_files: List of translation resources available grouped by locale.
#### Parameters
| | | |
| --- | --- | --- |
| ContainerInterface | $container | A ContainerInterface instance |
| [MessageFormatterInterface](../../../component/translation/formatter/messageformatterinterface "Symfony\Component\Translation\Formatter\MessageFormatterInterface") | $formatter | |
| string | $defaultLocale | |
| array | $loaderIds | An array of loader Ids |
| array | $options | An array of options |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/translation/exception/invalidargumentexception "Symfony\Component\Translation\Exception\InvalidArgumentException") | |
###
setConfigCacheFactory([ConfigCacheFactoryInterface](../../../component/config/configcachefactoryinterface "Symfony\Component\Config\ConfigCacheFactoryInterface") $configCacheFactory)
#### Parameters
| | | |
| --- | --- | --- |
| [ConfigCacheFactoryInterface](../../../component/config/configcachefactoryinterface "Symfony\Component\Config\ConfigCacheFactoryInterface") | $configCacheFactory | |
###
addLoader(string $format, [LoaderInterface](../../../component/translation/loader/loaderinterface "Symfony\Component\Translation\Loader\LoaderInterface") $loader)
Adds a Loader.
#### Parameters
| | | |
| --- | --- | --- |
| string | $format | The name of the loader (see addResource()) |
| [LoaderInterface](../../../component/translation/loader/loaderinterface "Symfony\Component\Translation\Loader\LoaderInterface") | $loader | A LoaderInterface instance |
###
addResource(string $format, mixed $resource, string $locale, string $domain = null)
Adds a Resource.
#### Parameters
| | | |
| --- | --- | --- |
| string | $format | The name of the loader (see addLoader()) |
| mixed | $resource | The resource name |
| string | $locale | The locale |
| string | $domain | The domain |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/translation/exception/invalidargumentexception "Symfony\Component\Translation\Exception\InvalidArgumentException") | If the locale contains invalid characters |
###
setLocale(string $locale)
Sets the current locale.
#### Parameters
| | | |
| --- | --- | --- |
| string | $locale | The locale |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/translation/exception/invalidargumentexception "Symfony\Component\Translation\Exception\InvalidArgumentException") | If the locale contains invalid characters |
### string
getLocale()
Returns the current locale.
#### Return Value
| | |
| --- | --- |
| string | The locale |
###
setFallbackLocales(array $locales)
Sets the fallback locales.
#### Parameters
| | | |
| --- | --- | --- |
| array | $locales | The fallback locales |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/translation/exception/invalidargumentexception "Symfony\Component\Translation\Exception\InvalidArgumentException") | If a locale contains invalid characters |
### array
getFallbackLocales()
Gets the fallback locales.
#### Return Value
| | |
| --- | --- |
| array | $locales The fallback locales |
### string
trans(string $id, array $parameters = array(), string|null $domain = null, string|null $locale = null)
Translates the given message.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | The message id (may also be an object that can be cast to string) |
| array | $parameters | An array of parameters for the message |
| string|null | $domain | The domain for the message or null to use the default |
| string|null | $locale | The locale or null to use the default |
#### Return Value
| | |
| --- | --- |
| string | The translated string |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/translation/exception/invalidargumentexception "Symfony\Component\Translation\Exception\InvalidArgumentException") | If the locale contains invalid characters |
### string
transChoice(string $id, int $number, array $parameters = array(), string|null $domain = null, string|null $locale = null)
Translates the given choice message by choosing a translation according to a number.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | The message id (may also be an object that can be cast to string) |
| int | $number | The number to use to find the indice of the message |
| array | $parameters | An array of parameters for the message |
| string|null | $domain | The domain for the message or null to use the default |
| string|null | $locale | The locale or null to use the default |
#### Return Value
| | |
| --- | --- |
| string | The translated string |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/translation/exception/invalidargumentexception "Symfony\Component\Translation\Exception\InvalidArgumentException") | If the locale contains invalid characters |
### [MessageCatalogueInterface](../../../component/translation/messagecatalogueinterface "Symfony\Component\Translation\MessageCatalogueInterface")
getCatalogue(string|null $locale = null)
Gets the catalogue by locale.
#### Parameters
| | | |
| --- | --- | --- |
| string|null | $locale | The locale or null to use the default |
#### Return Value
| | |
| --- | --- |
| [MessageCatalogueInterface](../../../component/translation/messagecatalogueinterface "Symfony\Component\Translation\MessageCatalogueInterface") | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/translation/exception/invalidargumentexception "Symfony\Component\Translation\Exception\InvalidArgumentException") | If the locale contains invalid characters |
### protected array
getLoaders()
Gets the loaders.
#### Return Value
| | |
| --- | --- |
| array | LoaderInterface[] |
### protected
loadCatalogue(string $locale)
#### Parameters
| | | |
| --- | --- | --- |
| string | $locale | |
### protected
initializeCatalogue(string $locale)
#### Parameters
| | | |
| --- | --- | --- |
| string | $locale | |
### protected
computeFallbackLocales($locale)
#### Parameters
| | | |
| --- | --- | --- |
| | $locale | |
### protected
assertValidLocale(string $locale)
Asserts that the locale is valid, throws an Exception if not.
#### Parameters
| | | |
| --- | --- | --- |
| string | $locale | Locale to tests |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/translation/exception/invalidargumentexception "Symfony\Component\Translation\Exception\InvalidArgumentException") | If the locale contains invalid characters |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### protected
initialize()
| programming_docs |
symfony RouterCacheWarmer RouterCacheWarmer
==================
class **RouterCacheWarmer** implements [CacheWarmerInterface](../../../component/httpkernel/cachewarmer/cachewarmerinterface "Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface"), [ServiceSubscriberInterface](../../../component/dependencyinjection/servicesubscriberinterface "Symfony\Component\DependencyInjection\ServiceSubscriberInterface")
Generates the router matcher and generator classes.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(ContainerInterface $container) | |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | |
| bool | [isOptional](#method_isOptional)() Checks whether this warmer is optional or not. | |
| static array | [getSubscribedServices](#method_getSubscribedServices)() Returns an array of service types required by such instances, optionally keyed by the service names used internally. | |
Details
-------
###
\_\_construct(ContainerInterface $container)
#### Parameters
| | | |
| --- | --- | --- |
| ContainerInterface | $container | |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### bool
isOptional()
Checks whether this warmer is optional or not.
#### Return Value
| | |
| --- | --- |
| bool | true if the warmer is optional, false otherwise |
### static array
getSubscribedServices()
Returns an array of service types required by such instances, optionally keyed by the service names used internally.
For mandatory dependencies:
* array('logger' => 'Psr\Log\LoggerInterface') means the objects use the "logger" name internally to fetch a service which must implement Psr\Log\LoggerInterface.
* array('Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface')
otherwise:
* array('logger' => '?Psr\Log\LoggerInterface') denotes an optional dependency
* array('?Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface')
#### Return Value
| | |
| --- | --- |
| array | The required service types, optionally keyed by service names |
symfony ValidatorCacheWarmer ValidatorCacheWarmer
=====================
class **ValidatorCacheWarmer** extends [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer")
Warms up XML and YAML validator metadata.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([ValidatorBuilderInterface](../../../component/validator/validatorbuilderinterface "Symfony\Component\Validator\ValidatorBuilderInterface") $validatorBuilder, string $phpArrayFile, CacheItemPoolInterface $fallbackPool) | |
| bool | [isOptional](#method_isOptional)() Checks whether this warmer is optional or not. | from [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer#method_isOptional "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer") |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | from [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer#method_warmUp "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer") |
| | [warmUpPhpArrayAdapter](#method_warmUpPhpArrayAdapter)([PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") $phpArrayAdapter, array $values) | |
| bool | [doWarmUp](#method_doWarmUp)(string $cacheDir, [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") $arrayAdapter) | |
Details
-------
###
\_\_construct([ValidatorBuilderInterface](../../../component/validator/validatorbuilderinterface "Symfony\Component\Validator\ValidatorBuilderInterface") $validatorBuilder, string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
#### Parameters
| | | |
| --- | --- | --- |
| [ValidatorBuilderInterface](../../../component/validator/validatorbuilderinterface "Symfony\Component\Validator\ValidatorBuilderInterface") | $validatorBuilder | |
| string | $phpArrayFile | The PHP file where metadata are cached |
| CacheItemPoolInterface | $fallbackPool | The pool where runtime-discovered metadata are cached |
### bool
isOptional()
Checks whether this warmer is optional or not.
Optional warmers can be ignored on certain conditions.
A warmer should return true if the cache can be generated incrementally and on-demand.
#### Return Value
| | |
| --- | --- |
| bool | true if the warmer is optional, false otherwise |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### protected
warmUpPhpArrayAdapter([PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") $phpArrayAdapter, array $values)
#### Parameters
| | | |
| --- | --- | --- |
| [PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") | $phpArrayAdapter | |
| array | $values | |
### protected bool
doWarmUp(string $cacheDir, [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") $arrayAdapter)
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | |
| [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") | $arrayAdapter | |
#### Return Value
| | |
| --- | --- |
| bool | false if there is nothing to warm-up |
symfony TranslationsCacheWarmer TranslationsCacheWarmer
========================
class **TranslationsCacheWarmer** implements [CacheWarmerInterface](../../../component/httpkernel/cachewarmer/cachewarmerinterface "Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface"), [ServiceSubscriberInterface](../../../component/dependencyinjection/servicesubscriberinterface "Symfony\Component\DependencyInjection\ServiceSubscriberInterface")
Generates the catalogues for translations.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(ContainerInterface $container) | |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | |
| bool | [isOptional](#method_isOptional)() Checks whether this warmer is optional or not. | |
| static array | [getSubscribedServices](#method_getSubscribedServices)() Returns an array of service types required by such instances, optionally keyed by the service names used internally. | |
Details
-------
###
\_\_construct(ContainerInterface $container)
#### Parameters
| | | |
| --- | --- | --- |
| ContainerInterface | $container | |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### bool
isOptional()
Checks whether this warmer is optional or not.
Optional warmers can be ignored on certain conditions.
A warmer should return true if the cache can be generated incrementally and on-demand.
#### Return Value
| | |
| --- | --- |
| bool | true if the warmer is optional, false otherwise |
### static array
getSubscribedServices()
Returns an array of service types required by such instances, optionally keyed by the service names used internally.
For mandatory dependencies:
* array('logger' => 'Psr\Log\LoggerInterface') means the objects use the "logger" name internally to fetch a service which must implement Psr\Log\LoggerInterface.
* array('Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface')
otherwise:
* array('logger' => '?Psr\Log\LoggerInterface') denotes an optional dependency
* array('?Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface')
#### Return Value
| | |
| --- | --- |
| array | The required service types, optionally keyed by service names |
symfony TemplateFinder TemplateFinder
===============
class **TemplateFinder** implements [TemplateFinderInterface](templatefinderinterface "Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface")
Finds all the templates.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel, [TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") $parser, string $rootDir) | |
| array | [findAllTemplates](#method_findAllTemplates)() Find all the templates in the bundle and in the kernel Resources folder. | |
Details
-------
###
\_\_construct([KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel, [TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") $parser, string $rootDir)
#### Parameters
| | | |
| --- | --- | --- |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | $kernel | A KernelInterface instance |
| [TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") | $parser | A TemplateNameParserInterface instance |
| string | $rootDir | The directory where global templates can be stored |
### array
findAllTemplates()
Find all the templates in the bundle and in the kernel Resources folder.
#### Return Value
| | |
| --- | --- |
| array | An array of templates of type TemplateReferenceInterface |
symfony TemplatePathsCacheWarmer TemplatePathsCacheWarmer
=========================
class **TemplatePathsCacheWarmer** extends [CacheWarmer](../../../component/httpkernel/cachewarmer/cachewarmer "Symfony\Component\HttpKernel\CacheWarmer\CacheWarmer")
Computes the association between template names and their paths on the disk.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $finder | | |
| protected | $locator | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [writeCacheFile](#method_writeCacheFile)($file, $content) | from [CacheWarmer](../../../component/httpkernel/cachewarmer/cachewarmer#method_writeCacheFile "Symfony\Component\HttpKernel\CacheWarmer\CacheWarmer") |
| | [\_\_construct](#method___construct)([TemplateFinderInterface](templatefinderinterface "Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface") $finder, [TemplateLocator](../templating/loader/templatelocator "Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator") $locator) | |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | |
| bool | [isOptional](#method_isOptional)() Checks whether this warmer is optional or not. | |
Details
-------
### protected
writeCacheFile($file, $content)
#### Parameters
| | | |
| --- | --- | --- |
| | $file | |
| | $content | |
###
\_\_construct([TemplateFinderInterface](templatefinderinterface "Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface") $finder, [TemplateLocator](../templating/loader/templatelocator "Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator") $locator)
#### Parameters
| | | |
| --- | --- | --- |
| [TemplateFinderInterface](templatefinderinterface "Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface") | $finder | |
| [TemplateLocator](../templating/loader/templatelocator "Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator") | $locator | |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### bool
isOptional()
Checks whether this warmer is optional or not.
#### Return Value
| | |
| --- | --- |
| bool | true if the warmer is optional, false otherwise |
symfony TemplateFinderInterface TemplateFinderInterface
========================
interface **TemplateFinderInterface**
Interface for finding all the templates.
Methods
-------
| | | |
| --- | --- | --- |
| array | [findAllTemplates](#method_findAllTemplates)() Find all the templates. | |
Details
-------
### array
findAllTemplates()
Find all the templates.
#### Return Value
| | |
| --- | --- |
| array | An array of templates of type TemplateReferenceInterface |
symfony SerializerCacheWarmer SerializerCacheWarmer
======================
class **SerializerCacheWarmer** extends [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer")
Warms up XML and YAML serializer metadata.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(array $loaders, string $phpArrayFile, CacheItemPoolInterface $fallbackPool) | |
| bool | [isOptional](#method_isOptional)() Checks whether this warmer is optional or not. | from [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer#method_isOptional "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer") |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | from [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer#method_warmUp "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer") |
| | [warmUpPhpArrayAdapter](#method_warmUpPhpArrayAdapter)([PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") $phpArrayAdapter, array $values) | from [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer#method_warmUpPhpArrayAdapter "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer") |
| bool | [doWarmUp](#method_doWarmUp)(string $cacheDir, [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") $arrayAdapter) | |
Details
-------
###
\_\_construct(array $loaders, string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
#### Parameters
| | | |
| --- | --- | --- |
| array | $loaders | The serializer metadata loaders |
| string | $phpArrayFile | The PHP file where metadata are cached |
| CacheItemPoolInterface | $fallbackPool | The pool where runtime-discovered metadata are cached |
### bool
isOptional()
Checks whether this warmer is optional or not.
Optional warmers can be ignored on certain conditions.
A warmer should return true if the cache can be generated incrementally and on-demand.
#### Return Value
| | |
| --- | --- |
| bool | true if the warmer is optional, false otherwise |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### protected
warmUpPhpArrayAdapter([PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") $phpArrayAdapter, array $values)
#### Parameters
| | | |
| --- | --- | --- |
| [PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") | $phpArrayAdapter | |
| array | $values | |
### protected bool
doWarmUp(string $cacheDir, [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") $arrayAdapter)
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | |
| [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") | $arrayAdapter | |
#### Return Value
| | |
| --- | --- |
| bool | false if there is nothing to warm-up |
symfony AnnotationsCacheWarmer AnnotationsCacheWarmer
=======================
class **AnnotationsCacheWarmer** extends [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer")
Warms up annotation caches for classes found in composer's autoload class map and declared in DI bundle extensions using the addAnnotatedClassesToCache method.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(Reader $annotationReader, string $phpArrayFile, CacheItemPoolInterface $fallbackPool, string $excludeRegexp = null, bool $debug = false) | |
| bool | [isOptional](#method_isOptional)() Checks whether this warmer is optional or not. | from [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer#method_isOptional "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer") |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | from [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer#method_warmUp "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer") |
| | [warmUpPhpArrayAdapter](#method_warmUpPhpArrayAdapter)([PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") $phpArrayAdapter, array $values) | from [AbstractPhpFileCacheWarmer](abstractphpfilecachewarmer#method_warmUpPhpArrayAdapter "Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer") |
| bool | [doWarmUp](#method_doWarmUp)(string $cacheDir, [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") $arrayAdapter) | |
Details
-------
###
\_\_construct(Reader $annotationReader, string $phpArrayFile, CacheItemPoolInterface $fallbackPool, string $excludeRegexp = null, bool $debug = false)
#### Parameters
| | | |
| --- | --- | --- |
| Reader | $annotationReader | |
| string | $phpArrayFile | The PHP file where metadata are cached |
| CacheItemPoolInterface | $fallbackPool | The pool where runtime-discovered metadata are cached |
| string | $excludeRegexp | |
| bool | $debug | |
### bool
isOptional()
Checks whether this warmer is optional or not.
Optional warmers can be ignored on certain conditions.
A warmer should return true if the cache can be generated incrementally and on-demand.
#### Return Value
| | |
| --- | --- |
| bool | true if the warmer is optional, false otherwise |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### protected
warmUpPhpArrayAdapter([PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") $phpArrayAdapter, array $values)
#### Parameters
| | | |
| --- | --- | --- |
| [PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") | $phpArrayAdapter | |
| array | $values | |
### protected bool
doWarmUp(string $cacheDir, [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") $arrayAdapter)
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | |
| [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") | $arrayAdapter | |
#### Return Value
| | |
| --- | --- |
| bool | false if there is nothing to warm-up |
symfony AbstractPhpFileCacheWarmer AbstractPhpFileCacheWarmer
===========================
abstract class **AbstractPhpFileCacheWarmer** implements [CacheWarmerInterface](../../../component/httpkernel/cachewarmer/cachewarmerinterface "Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(string $phpArrayFile, CacheItemPoolInterface $fallbackPool) | |
| bool | [isOptional](#method_isOptional)() Checks whether this warmer is optional or not. | |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | |
| | [warmUpPhpArrayAdapter](#method_warmUpPhpArrayAdapter)([PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") $phpArrayAdapter, array $values) | |
| bool | [doWarmUp](#method_doWarmUp)(string $cacheDir, [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") $arrayAdapter) | |
Details
-------
###
\_\_construct(string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
#### Parameters
| | | |
| --- | --- | --- |
| string | $phpArrayFile | The PHP file where metadata are cached |
| CacheItemPoolInterface | $fallbackPool | The pool where runtime-discovered metadata are cached |
### bool
isOptional()
Checks whether this warmer is optional or not.
Optional warmers can be ignored on certain conditions.
A warmer should return true if the cache can be generated incrementally and on-demand.
#### Return Value
| | |
| --- | --- |
| bool | true if the warmer is optional, false otherwise |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### protected
warmUpPhpArrayAdapter([PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") $phpArrayAdapter, array $values)
#### Parameters
| | | |
| --- | --- | --- |
| [PhpArrayAdapter](../../../component/cache/adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") | $phpArrayAdapter | |
| array | $values | |
### abstract protected bool
doWarmUp(string $cacheDir, [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") $arrayAdapter)
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | |
| [ArrayAdapter](../../../component/cache/adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") | $arrayAdapter | |
#### Return Value
| | |
| --- | --- |
| bool | false if there is nothing to warm-up |
| programming_docs |
symfony GlobalVariables GlobalVariables
================
class **GlobalVariables**
GlobalVariables is the entry point for Symfony global variables in PHP templates.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $container | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container) | |
| [TokenInterface](../../../component/security/core/authentication/token/tokeninterface "Symfony\Component\Security\Core\Authentication\Token\TokenInterface")|null | [getToken](#method_getToken)() | |
| | [getUser](#method_getUser)() | |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request")|null | [getRequest](#method_getRequest)() | |
| [Session](../../../component/httpfoundation/session/session "Symfony\Component\HttpFoundation\Session\Session")|null | [getSession](#method_getSession)() | |
| string | [getEnvironment](#method_getEnvironment)() | |
| bool | [getDebug](#method_getDebug)() | |
Details
-------
###
\_\_construct([ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | |
### [TokenInterface](../../../component/security/core/authentication/token/tokeninterface "Symfony\Component\Security\Core\Authentication\Token\TokenInterface")|null
getToken()
#### Return Value
| | |
| --- | --- |
| [TokenInterface](../../../component/security/core/authentication/token/tokeninterface "Symfony\Component\Security\Core\Authentication\Token\TokenInterface")|null | |
###
getUser()
### [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request")|null
getRequest()
#### Return Value
| | |
| --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request")|null | The HTTP request object |
### [Session](../../../component/httpfoundation/session/session "Symfony\Component\HttpFoundation\Session\Session")|null
getSession()
#### Return Value
| | |
| --- | --- |
| [Session](../../../component/httpfoundation/session/session "Symfony\Component\HttpFoundation\Session\Session")|null | The session |
### string
getEnvironment()
#### Return Value
| | |
| --- | --- |
| string | The current environment string (e.g 'dev') |
### bool
getDebug()
#### Return Value
| | |
| --- | --- |
| bool | The current debug mode |
symfony Symfony\Bundle\FrameworkBundle\Templating\Helper Symfony\Bundle\FrameworkBundle\Templating\Helper
================================================
Classes
-------
| | |
| --- | --- |
| [ActionsHelper](helper/actionshelper "Symfony\Bundle\FrameworkBundle\Templating\Helper\ActionsHelper") | ActionsHelper manages action inclusions. |
| [AssetsHelper](helper/assetshelper "Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper") | AssetsHelper helps manage asset URLs. |
| [CodeHelper](helper/codehelper "Symfony\Bundle\FrameworkBundle\Templating\Helper\CodeHelper") | |
| [FormHelper](helper/formhelper "Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper") | FormHelper provides helpers to help display forms. |
| [RequestHelper](helper/requesthelper "Symfony\Bundle\FrameworkBundle\Templating\Helper\RequestHelper") | RequestHelper provides access to the current request parameters. |
| [RouterHelper](helper/routerhelper "Symfony\Bundle\FrameworkBundle\Templating\Helper\RouterHelper") | RouterHelper manages links between pages in a template context. |
| [SessionHelper](helper/sessionhelper "Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper") | SessionHelper provides read-only access to the session attributes. |
| [StopwatchHelper](helper/stopwatchhelper "Symfony\Bundle\FrameworkBundle\Templating\Helper\StopwatchHelper") | StopwatchHelper provides methods time your PHP templates. |
| [TranslatorHelper](helper/translatorhelper "Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper") | |
symfony Symfony\Bundle\FrameworkBundle\Templating\Loader Symfony\Bundle\FrameworkBundle\Templating\Loader
================================================
Classes
-------
| | |
| --- | --- |
| [FilesystemLoader](loader/filesystemloader "Symfony\Bundle\FrameworkBundle\Templating\Loader\FilesystemLoader") | FilesystemLoader is a loader that read templates from the filesystem. |
| [TemplateLocator](loader/templatelocator "Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator") | TemplateLocator locates templates in bundles. |
symfony TemplateNameParser TemplateNameParser
===================
class **TemplateNameParser** extends [TemplateNameParser](../../../component/templating/templatenameparser "Symfony\Component\Templating\TemplateNameParser")
TemplateNameParser converts template names from the short notation "bundle:section:template.format.engine" to TemplateReferenceInterface instances.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $kernel | | |
| protected | $cache | | |
Methods
-------
| | | |
| --- | --- | --- |
| [TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | [parse](#method_parse)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Convert a template name to a TemplateReferenceInterface instance. | |
| | [\_\_construct](#method___construct)([KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel) | |
Details
-------
### [TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface")
parse(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Convert a template name to a TemplateReferenceInterface instance.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| [TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | A template |
###
\_\_construct([KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel)
#### Parameters
| | | |
| --- | --- | --- |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | $kernel | |
symfony TimedPhpEngine TimedPhpEngine
===============
class **TimedPhpEngine** extends [PhpEngine](phpengine "Symfony\Bundle\FrameworkBundle\Templating\PhpEngine")
Times the time spent to render a template.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $loader | | from [PhpEngine](../../../component/templating/phpengine#property_loader "Symfony\Component\Templating\PhpEngine") |
| protected | $current | | from [PhpEngine](../../../component/templating/phpengine#property_current "Symfony\Component\Templating\PhpEngine") |
| protected [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface")[] | $helpers | | from [PhpEngine](../../../component/templating/phpengine#property_helpers "Symfony\Component\Templating\PhpEngine") |
| protected | $parents | | from [PhpEngine](../../../component/templating/phpengine#property_parents "Symfony\Component\Templating\PhpEngine") |
| protected | $stack | | from [PhpEngine](../../../component/templating/phpengine#property_stack "Symfony\Component\Templating\PhpEngine") |
| protected | $charset | | from [PhpEngine](../../../component/templating/phpengine#property_charset "Symfony\Component\Templating\PhpEngine") |
| protected | $cache | | from [PhpEngine](../../../component/templating/phpengine#property_cache "Symfony\Component\Templating\PhpEngine") |
| protected | $escapers | | from [PhpEngine](../../../component/templating/phpengine#property_escapers "Symfony\Component\Templating\PhpEngine") |
| static protected | $escaperCache | | from [PhpEngine](../../../component/templating/phpengine#property_escaperCache "Symfony\Component\Templating\PhpEngine") |
| protected | $globals | | from [PhpEngine](../../../component/templating/phpengine#property_globals "Symfony\Component\Templating\PhpEngine") |
| protected | $parser | | from [PhpEngine](../../../component/templating/phpengine#property_parser "Symfony\Component\Templating\PhpEngine") |
| protected | $container | | from [PhpEngine](phpengine#property_container "Symfony\Bundle\FrameworkBundle\Templating\PhpEngine") |
| protected | $stopwatch | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") $parser, ContainerInterface $container, [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface") $loader, [Stopwatch](../../../component/stopwatch/stopwatch "Symfony\Component\Stopwatch\Stopwatch") $stopwatch, [GlobalVariables](globalvariables "Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables") $globals = null) | |
| string | [render](#method_render)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array()) Renders a template. | |
| bool | [exists](#method_exists)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Returns true if the template exists. | from [PhpEngine](../../../component/templating/phpengine#method_exists "Symfony\Component\Templating\PhpEngine") |
| bool | [supports](#method_supports)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Returns true if this class is able to render the given template. | from [PhpEngine](../../../component/templating/phpengine#method_supports "Symfony\Component\Templating\PhpEngine") |
| string|false | [evaluate](#method_evaluate)([Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage") $template, array $parameters = array()) Evaluates a template. | from [PhpEngine](../../../component/templating/phpengine#method_evaluate "Symfony\Component\Templating\PhpEngine") |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | [offsetGet](#method_offsetGet)(string $name) Gets a helper value. | from [PhpEngine](../../../component/templating/phpengine#method_offsetGet "Symfony\Component\Templating\PhpEngine") |
| bool | [offsetExists](#method_offsetExists)(string $name) Returns true if the helper is defined. | from [PhpEngine](../../../component/templating/phpengine#method_offsetExists "Symfony\Component\Templating\PhpEngine") |
| | [offsetSet](#method_offsetSet)([HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") $name, string $value) Sets a helper. | from [PhpEngine](../../../component/templating/phpengine#method_offsetSet "Symfony\Component\Templating\PhpEngine") |
| | [offsetUnset](#method_offsetUnset)(string $name) Removes a helper. | from [PhpEngine](../../../component/templating/phpengine#method_offsetUnset "Symfony\Component\Templating\PhpEngine") |
| | [addHelpers](#method_addHelpers)(array $helpers) Adds some helpers. | from [PhpEngine](../../../component/templating/phpengine#method_addHelpers "Symfony\Component\Templating\PhpEngine") |
| | [setHelpers](#method_setHelpers)(array $helpers) Sets the helpers. | from [PhpEngine](phpengine#method_setHelpers "Symfony\Bundle\FrameworkBundle\Templating\PhpEngine") |
| | [set](#method_set)([HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") $helper, string $alias = null) Sets a helper. | from [PhpEngine](../../../component/templating/phpengine#method_set "Symfony\Component\Templating\PhpEngine") |
| bool | [has](#method_has)(string $name) Returns true if the helper if defined. | from [PhpEngine](../../../component/templating/phpengine#method_has "Symfony\Component\Templating\PhpEngine") |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | [get](#method_get)(string $name) Gets a helper value. | from [PhpEngine](phpengine#method_get "Symfony\Bundle\FrameworkBundle\Templating\PhpEngine") |
| | [extend](#method_extend)(string $template) Decorates the current template with another one. | from [PhpEngine](../../../component/templating/phpengine#method_extend "Symfony\Component\Templating\PhpEngine") |
| string | [escape](#method_escape)(mixed $value, string $context = 'html') Escapes a string by using the current charset. | from [PhpEngine](../../../component/templating/phpengine#method_escape "Symfony\Component\Templating\PhpEngine") |
| | [setCharset](#method_setCharset)(string $charset) Sets the charset to use. | from [PhpEngine](../../../component/templating/phpengine#method_setCharset "Symfony\Component\Templating\PhpEngine") |
| string | [getCharset](#method_getCharset)() Gets the current charset. | from [PhpEngine](../../../component/templating/phpengine#method_getCharset "Symfony\Component\Templating\PhpEngine") |
| | [setEscaper](#method_setEscaper)(string $context, callable $escaper) Adds an escaper for the given context. | from [PhpEngine](../../../component/templating/phpengine#method_setEscaper "Symfony\Component\Templating\PhpEngine") |
| callable | [getEscaper](#method_getEscaper)(string $context) Gets an escaper for a given context. | from [PhpEngine](../../../component/templating/phpengine#method_getEscaper "Symfony\Component\Templating\PhpEngine") |
| | [addGlobal](#method_addGlobal)(string $name, mixed $value) | from [PhpEngine](../../../component/templating/phpengine#method_addGlobal "Symfony\Component\Templating\PhpEngine") |
| array | [getGlobals](#method_getGlobals)() Returns the assigned globals. | from [PhpEngine](../../../component/templating/phpengine#method_getGlobals "Symfony\Component\Templating\PhpEngine") |
| | [initializeEscapers](#method_initializeEscapers)() Initializes the built-in escapers. | from [PhpEngine](../../../component/templating/phpengine#method_initializeEscapers "Symfony\Component\Templating\PhpEngine") |
| [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface") | [getLoader](#method_getLoader)() Gets the loader associated with this engine. | from [PhpEngine](../../../component/templating/phpengine#method_getLoader "Symfony\Component\Templating\PhpEngine") |
| [Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage") | [load](#method_load)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Loads the given template. | from [PhpEngine](../../../component/templating/phpengine#method_load "Symfony\Component\Templating\PhpEngine") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [renderResponse](#method_renderResponse)(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null) Renders a view and returns a Response. | from [PhpEngine](phpengine#method_renderResponse "Symfony\Bundle\FrameworkBundle\Templating\PhpEngine") |
Details
-------
###
\_\_construct([TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") $parser, ContainerInterface $container, [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface") $loader, [Stopwatch](../../../component/stopwatch/stopwatch "Symfony\Component\Stopwatch\Stopwatch") $stopwatch, [GlobalVariables](globalvariables "Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables") $globals = null)
#### Parameters
| | | |
| --- | --- | --- |
| [TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") | $parser | A TemplateNameParserInterface instance |
| ContainerInterface | $container | |
| [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface") | $loader | A loader instance |
| [Stopwatch](../../../component/stopwatch/stopwatch "Symfony\Component\Stopwatch\Stopwatch") | $stopwatch | |
| [GlobalVariables](globalvariables "Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables") | $globals | |
### string
render(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array())
Renders a template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
| array | $parameters | An array of parameters to pass to the template |
#### Return Value
| | |
| --- | --- |
| string | The evaluated template as a string |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
### bool
exists(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Returns true if the template exists.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| bool | true if the template exists, false otherwise |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the engine cannot handle the template name |
### bool
supports(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Returns true if this class is able to render the given template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| bool | true if this class supports the given template, false otherwise |
### protected string|false
evaluate([Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage") $template, array $parameters = array())
Evaluates a template.
#### Parameters
| | | |
| --- | --- | --- |
| [Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage") | $template | The template to render |
| array | $parameters | An array of parameters to pass to the template |
#### Return Value
| | |
| --- | --- |
| string|false | The evaluated template, or false if the engine is unable to render the template |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
### [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface")
offsetGet(string $name)
Gets a helper value.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | The helper value |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | if the helper is not defined |
### bool
offsetExists(string $name)
Returns true if the helper is defined.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| bool | true if the helper is defined, false otherwise |
###
offsetSet([HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") $name, string $value)
Sets a helper.
#### Parameters
| | | |
| --- | --- | --- |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | $name | The helper instance |
| string | $value | An alias |
###
offsetUnset(string $name)
Removes a helper.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
###
addHelpers(array $helpers)
Adds some helpers.
#### Parameters
| | | |
| --- | --- | --- |
| array | $helpers | An array of helper |
###
setHelpers(array $helpers)
Sets the helpers.
#### Parameters
| | | |
| --- | --- | --- |
| array | $helpers | An array of helper |
###
set([HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") $helper, string $alias = null)
Sets a helper.
#### Parameters
| | | |
| --- | --- | --- |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | $helper | The helper instance |
| string | $alias | An alias |
### bool
has(string $name)
Returns true if the helper if defined.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| bool | true if the helper is defined, false otherwise |
### [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface")
get(string $name)
Gets a helper value.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | The helper instance |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | if the helper is not defined |
###
extend(string $template)
Decorates the current template with another one.
#### Parameters
| | | |
| --- | --- | --- |
| string | $template | The decorator logical name |
### string
escape(mixed $value, string $context = 'html')
Escapes a string by using the current charset.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | A variable to escape |
| string | $context | The context name |
#### Return Value
| | |
| --- | --- |
| string | The escaped value |
###
setCharset(string $charset)
Sets the charset to use.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the current charset.
#### Return Value
| | |
| --- | --- |
| string | The current charset |
###
setEscaper(string $context, callable $escaper)
Adds an escaper for the given context.
#### Parameters
| | | |
| --- | --- | --- |
| string | $context | The escaper context (html, js, ...) |
| callable | $escaper | A PHP callable |
### callable
getEscaper(string $context)
Gets an escaper for a given context.
#### Parameters
| | | |
| --- | --- | --- |
| string | $context | The context name |
#### Return Value
| | |
| --- | --- |
| callable | $escaper A PHP callable |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
###
addGlobal(string $name, mixed $value)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | |
| mixed | $value | |
### array
getGlobals()
Returns the assigned globals.
#### Return Value
| | |
| --- | --- |
| array | |
### protected
initializeEscapers()
Initializes the built-in escapers.
Each function specifies a way for applying a transformation to a string passed to it. The purpose is for the string to be "escaped" so it is suitable for the format it is being displayed in.
For example, the string: "It's required that you enter a username & password.\n" If this were to be displayed as HTML it would be sensible to turn the ampersand into '&' and the apostrophe into '&aps;'. However if it were going to be used as a string in JavaScript to be displayed in an alert box it would be right to leave the string as-is, but c-escape the apostrophe and the new line.
For each function there is a define to avoid problems with strings being incorrectly specified.
### [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface")
getLoader()
Gets the loader associated with this engine.
#### Return Value
| | |
| --- | --- |
| [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface") | A LoaderInterface instance |
### protected [Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage")
load(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Loads the given template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| [Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage") | A Storage instance |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | if the template cannot be found |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
renderResponse(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null)
Renders a view and returns a Response.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | The view name |
| array | $parameters | An array of parameters to pass to the view |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | A Response instance |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
| programming_docs |
symfony EngineInterface EngineInterface
================
interface **EngineInterface** implements [EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface")
EngineInterface is the interface each engine must implement.
Methods
-------
| | | |
| --- | --- | --- |
| string | [render](#method_render)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array()) Renders a template. | from [EngineInterface](../../../component/templating/engineinterface#method_render "Symfony\Component\Templating\EngineInterface") |
| bool | [exists](#method_exists)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Returns true if the template exists. | from [EngineInterface](../../../component/templating/engineinterface#method_exists "Symfony\Component\Templating\EngineInterface") |
| bool | [supports](#method_supports)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Returns true if this class is able to render the given template. | from [EngineInterface](../../../component/templating/engineinterface#method_supports "Symfony\Component\Templating\EngineInterface") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [renderResponse](#method_renderResponse)(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null) Renders a view and returns a Response. | |
Details
-------
### string
render(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array())
Renders a template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
| array | $parameters | An array of parameters to pass to the template |
#### Return Value
| | |
| --- | --- |
| string | The evaluated template as a string |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
### bool
exists(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Returns true if the template exists.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| bool | true if the template exists, false otherwise |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the engine cannot handle the template name |
### bool
supports(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Returns true if this class is able to render the given template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| bool | true if this class supports the given template, false otherwise |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
renderResponse(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null)
Renders a view and returns a Response.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | The view name |
| array | $parameters | An array of parameters to pass to the view |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | A Response instance |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
symfony PhpEngine PhpEngine
==========
class **PhpEngine** extends [PhpEngine](../../../component/templating/phpengine "Symfony\Component\Templating\PhpEngine") implements [EngineInterface](engineinterface "Symfony\Bundle\FrameworkBundle\Templating\EngineInterface")
This engine knows how to render Symfony templates.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $loader | | from [PhpEngine](../../../component/templating/phpengine#property_loader "Symfony\Component\Templating\PhpEngine") |
| protected | $current | | from [PhpEngine](../../../component/templating/phpengine#property_current "Symfony\Component\Templating\PhpEngine") |
| protected [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface")[] | $helpers | | from [PhpEngine](../../../component/templating/phpengine#property_helpers "Symfony\Component\Templating\PhpEngine") |
| protected | $parents | | from [PhpEngine](../../../component/templating/phpengine#property_parents "Symfony\Component\Templating\PhpEngine") |
| protected | $stack | | from [PhpEngine](../../../component/templating/phpengine#property_stack "Symfony\Component\Templating\PhpEngine") |
| protected | $charset | | from [PhpEngine](../../../component/templating/phpengine#property_charset "Symfony\Component\Templating\PhpEngine") |
| protected | $cache | | from [PhpEngine](../../../component/templating/phpengine#property_cache "Symfony\Component\Templating\PhpEngine") |
| protected | $escapers | | from [PhpEngine](../../../component/templating/phpengine#property_escapers "Symfony\Component\Templating\PhpEngine") |
| static protected | $escaperCache | | from [PhpEngine](../../../component/templating/phpengine#property_escaperCache "Symfony\Component\Templating\PhpEngine") |
| protected | $globals | | from [PhpEngine](../../../component/templating/phpengine#property_globals "Symfony\Component\Templating\PhpEngine") |
| protected | $parser | | from [PhpEngine](../../../component/templating/phpengine#property_parser "Symfony\Component\Templating\PhpEngine") |
| protected | $container | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") $parser, ContainerInterface $container, [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface") $loader, [GlobalVariables](globalvariables "Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables") $globals = null) | |
| string | [render](#method_render)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array()) Renders a template. | from [PhpEngine](../../../component/templating/phpengine#method_render "Symfony\Component\Templating\PhpEngine") |
| bool | [exists](#method_exists)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Returns true if the template exists. | from [PhpEngine](../../../component/templating/phpengine#method_exists "Symfony\Component\Templating\PhpEngine") |
| bool | [supports](#method_supports)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Returns true if this class is able to render the given template. | from [PhpEngine](../../../component/templating/phpengine#method_supports "Symfony\Component\Templating\PhpEngine") |
| string|false | [evaluate](#method_evaluate)([Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage") $template, array $parameters = array()) Evaluates a template. | from [PhpEngine](../../../component/templating/phpengine#method_evaluate "Symfony\Component\Templating\PhpEngine") |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | [offsetGet](#method_offsetGet)(string $name) Gets a helper value. | from [PhpEngine](../../../component/templating/phpengine#method_offsetGet "Symfony\Component\Templating\PhpEngine") |
| bool | [offsetExists](#method_offsetExists)(string $name) Returns true if the helper is defined. | from [PhpEngine](../../../component/templating/phpengine#method_offsetExists "Symfony\Component\Templating\PhpEngine") |
| | [offsetSet](#method_offsetSet)([HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") $name, string $value) Sets a helper. | from [PhpEngine](../../../component/templating/phpengine#method_offsetSet "Symfony\Component\Templating\PhpEngine") |
| | [offsetUnset](#method_offsetUnset)(string $name) Removes a helper. | from [PhpEngine](../../../component/templating/phpengine#method_offsetUnset "Symfony\Component\Templating\PhpEngine") |
| | [addHelpers](#method_addHelpers)(array $helpers) Adds some helpers. | from [PhpEngine](../../../component/templating/phpengine#method_addHelpers "Symfony\Component\Templating\PhpEngine") |
| | [setHelpers](#method_setHelpers)(array $helpers) Sets the helpers. | |
| | [set](#method_set)([HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") $helper, string $alias = null) Sets a helper. | from [PhpEngine](../../../component/templating/phpengine#method_set "Symfony\Component\Templating\PhpEngine") |
| bool | [has](#method_has)(string $name) Returns true if the helper if defined. | from [PhpEngine](../../../component/templating/phpengine#method_has "Symfony\Component\Templating\PhpEngine") |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | [get](#method_get)(string $name) Gets a helper value. | |
| | [extend](#method_extend)(string $template) Decorates the current template with another one. | from [PhpEngine](../../../component/templating/phpengine#method_extend "Symfony\Component\Templating\PhpEngine") |
| string | [escape](#method_escape)(mixed $value, string $context = 'html') Escapes a string by using the current charset. | from [PhpEngine](../../../component/templating/phpengine#method_escape "Symfony\Component\Templating\PhpEngine") |
| | [setCharset](#method_setCharset)(string $charset) Sets the charset to use. | from [PhpEngine](../../../component/templating/phpengine#method_setCharset "Symfony\Component\Templating\PhpEngine") |
| string | [getCharset](#method_getCharset)() Gets the current charset. | from [PhpEngine](../../../component/templating/phpengine#method_getCharset "Symfony\Component\Templating\PhpEngine") |
| | [setEscaper](#method_setEscaper)(string $context, callable $escaper) Adds an escaper for the given context. | from [PhpEngine](../../../component/templating/phpengine#method_setEscaper "Symfony\Component\Templating\PhpEngine") |
| callable | [getEscaper](#method_getEscaper)(string $context) Gets an escaper for a given context. | from [PhpEngine](../../../component/templating/phpengine#method_getEscaper "Symfony\Component\Templating\PhpEngine") |
| | [addGlobal](#method_addGlobal)(string $name, mixed $value) | from [PhpEngine](../../../component/templating/phpengine#method_addGlobal "Symfony\Component\Templating\PhpEngine") |
| array | [getGlobals](#method_getGlobals)() Returns the assigned globals. | from [PhpEngine](../../../component/templating/phpengine#method_getGlobals "Symfony\Component\Templating\PhpEngine") |
| | [initializeEscapers](#method_initializeEscapers)() Initializes the built-in escapers. | from [PhpEngine](../../../component/templating/phpengine#method_initializeEscapers "Symfony\Component\Templating\PhpEngine") |
| [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface") | [getLoader](#method_getLoader)() Gets the loader associated with this engine. | from [PhpEngine](../../../component/templating/phpengine#method_getLoader "Symfony\Component\Templating\PhpEngine") |
| [Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage") | [load](#method_load)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Loads the given template. | from [PhpEngine](../../../component/templating/phpengine#method_load "Symfony\Component\Templating\PhpEngine") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [renderResponse](#method_renderResponse)(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null) Renders a view and returns a Response. | |
Details
-------
###
\_\_construct([TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") $parser, ContainerInterface $container, [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface") $loader, [GlobalVariables](globalvariables "Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables") $globals = null)
#### Parameters
| | | |
| --- | --- | --- |
| [TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface") | $parser | A TemplateNameParserInterface instance |
| ContainerInterface | $container | |
| [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface") | $loader | A loader instance |
| [GlobalVariables](globalvariables "Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables") | $globals | |
### string
render(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array())
Renders a template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
| array | $parameters | An array of parameters to pass to the template |
#### Return Value
| | |
| --- | --- |
| string | The evaluated template as a string |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
### bool
exists(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Returns true if the template exists.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| bool | true if the template exists, false otherwise |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the engine cannot handle the template name |
### bool
supports(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Returns true if this class is able to render the given template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| bool | true if this class supports the given template, false otherwise |
### protected string|false
evaluate([Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage") $template, array $parameters = array())
Evaluates a template.
#### Parameters
| | | |
| --- | --- | --- |
| [Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage") | $template | The template to render |
| array | $parameters | An array of parameters to pass to the template |
#### Return Value
| | |
| --- | --- |
| string|false | The evaluated template, or false if the engine is unable to render the template |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
### [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface")
offsetGet(string $name)
Gets a helper value.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | The helper value |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | if the helper is not defined |
### bool
offsetExists(string $name)
Returns true if the helper is defined.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| bool | true if the helper is defined, false otherwise |
###
offsetSet([HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") $name, string $value)
Sets a helper.
#### Parameters
| | | |
| --- | --- | --- |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | $name | The helper instance |
| string | $value | An alias |
###
offsetUnset(string $name)
Removes a helper.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
###
addHelpers(array $helpers)
Adds some helpers.
#### Parameters
| | | |
| --- | --- | --- |
| array | $helpers | An array of helper |
###
setHelpers(array $helpers)
Sets the helpers.
#### Parameters
| | | |
| --- | --- | --- |
| array | $helpers | An array of helper |
###
set([HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") $helper, string $alias = null)
Sets a helper.
#### Parameters
| | | |
| --- | --- | --- |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | $helper | The helper instance |
| string | $alias | An alias |
### bool
has(string $name)
Returns true if the helper if defined.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| bool | true if the helper is defined, false otherwise |
### [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface")
get(string $name)
Gets a helper value.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| [HelperInterface](../../../component/templating/helper/helperinterface "Symfony\Component\Templating\Helper\HelperInterface") | The helper instance |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | if the helper is not defined |
###
extend(string $template)
Decorates the current template with another one.
#### Parameters
| | | |
| --- | --- | --- |
| string | $template | The decorator logical name |
### string
escape(mixed $value, string $context = 'html')
Escapes a string by using the current charset.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | A variable to escape |
| string | $context | The context name |
#### Return Value
| | |
| --- | --- |
| string | The escaped value |
###
setCharset(string $charset)
Sets the charset to use.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the current charset.
#### Return Value
| | |
| --- | --- |
| string | The current charset |
###
setEscaper(string $context, callable $escaper)
Adds an escaper for the given context.
#### Parameters
| | | |
| --- | --- | --- |
| string | $context | The escaper context (html, js, ...) |
| callable | $escaper | A PHP callable |
### callable
getEscaper(string $context)
Gets an escaper for a given context.
#### Parameters
| | | |
| --- | --- | --- |
| string | $context | The context name |
#### Return Value
| | |
| --- | --- |
| callable | $escaper A PHP callable |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
###
addGlobal(string $name, mixed $value)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | |
| mixed | $value | |
### array
getGlobals()
Returns the assigned globals.
#### Return Value
| | |
| --- | --- |
| array | |
### protected
initializeEscapers()
Initializes the built-in escapers.
Each function specifies a way for applying a transformation to a string passed to it. The purpose is for the string to be "escaped" so it is suitable for the format it is being displayed in.
For example, the string: "It's required that you enter a username & password.\n" If this were to be displayed as HTML it would be sensible to turn the ampersand into '&' and the apostrophe into '&aps;'. However if it were going to be used as a string in JavaScript to be displayed in an alert box it would be right to leave the string as-is, but c-escape the apostrophe and the new line.
For each function there is a define to avoid problems with strings being incorrectly specified.
### [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface")
getLoader()
Gets the loader associated with this engine.
#### Return Value
| | |
| --- | --- |
| [LoaderInterface](../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface") | A LoaderInterface instance |
### protected [Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage")
load(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Loads the given template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| [Storage](../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage") | A Storage instance |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | if the template cannot be found |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
renderResponse(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null)
Renders a view and returns a Response.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | The view name |
| array | $parameters | An array of parameters to pass to the view |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | A Response instance |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
| programming_docs |
symfony DelegatingEngine DelegatingEngine
=================
class **DelegatingEngine** extends [DelegatingEngine](../../../component/templating/delegatingengine "Symfony\Component\Templating\DelegatingEngine") implements [EngineInterface](engineinterface "Symfony\Bundle\FrameworkBundle\Templating\EngineInterface")
DelegatingEngine selects an engine for a given template.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface")[] | $engines | | from [DelegatingEngine](../../../component/templating/delegatingengine#property_engines "Symfony\Component\Templating\DelegatingEngine") |
| protected | $container | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(ContainerInterface $container, array $engineIds) | |
| string | [render](#method_render)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array()) Renders a template. | from [DelegatingEngine](../../../component/templating/delegatingengine#method_render "Symfony\Component\Templating\DelegatingEngine") |
| | [stream](#method_stream)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array()) Streams a template. | from [DelegatingEngine](../../../component/templating/delegatingengine#method_stream "Symfony\Component\Templating\DelegatingEngine") |
| bool | [exists](#method_exists)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Returns true if the template exists. | from [DelegatingEngine](../../../component/templating/delegatingengine#method_exists "Symfony\Component\Templating\DelegatingEngine") |
| | [addEngine](#method_addEngine)([EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface") $engine) | from [DelegatingEngine](../../../component/templating/delegatingengine#method_addEngine "Symfony\Component\Templating\DelegatingEngine") |
| bool | [supports](#method_supports)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Returns true if this class is able to render the given template. | from [DelegatingEngine](../../../component/templating/delegatingengine#method_supports "Symfony\Component\Templating\DelegatingEngine") |
| [EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface") | [getEngine](#method_getEngine)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Get an engine able to render the given template. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [renderResponse](#method_renderResponse)(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null) Renders a view and returns a Response. | |
Details
-------
###
\_\_construct(ContainerInterface $container, array $engineIds)
#### Parameters
| | | |
| --- | --- | --- |
| ContainerInterface | $container | |
| array | $engineIds | |
### string
render(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array())
Renders a template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
| array | $parameters | An array of parameters to pass to the template |
#### Return Value
| | |
| --- | --- |
| string | The evaluated template as a string |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
###
stream(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name, array $parameters = array())
Streams a template.
The implementation should output the content directly to the client.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
| array | $parameters | An array of parameters to pass to the template |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
| [LogicException](http://php.net/LogicException) | if the template cannot be streamed |
### bool
exists(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Returns true if the template exists.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| bool | true if the template exists, false otherwise |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the engine cannot handle the template name |
###
addEngine([EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface") $engine)
#### Parameters
| | | |
| --- | --- | --- |
| [EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface") | $engine | |
### bool
supports(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Returns true if this class is able to render the given template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| bool | true if this class supports the given template, false otherwise |
### [EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface")
getEngine(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Get an engine able to render the given template.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| [EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface") | The engine |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if no engine able to work with the template is found |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
renderResponse(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null)
Renders a view and returns a Response.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | The view name |
| array | $parameters | An array of parameters to pass to the view |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | A Response instance |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [RuntimeException](http://php.net/RuntimeException) | if the template cannot be rendered |
symfony TemplateFilenameParser TemplateFilenameParser
=======================
class **TemplateFilenameParser** implements [TemplateNameParserInterface](../../../component/templating/templatenameparserinterface "Symfony\Component\Templating\TemplateNameParserInterface")
TemplateFilenameParser converts template filenames to TemplateReferenceInterface instances.
Methods
-------
| | | |
| --- | --- | --- |
| [TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | [parse](#method_parse)(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name) Convert a template name to a TemplateReferenceInterface instance. | |
Details
-------
### [TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface")
parse(string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $name)
Convert a template name to a TemplateReferenceInterface instance.
#### Parameters
| | | |
| --- | --- | --- |
| string|[TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $name | A template name or a TemplateReferenceInterface instance |
#### Return Value
| | |
| --- | --- |
| [TemplateReferenceInterface](../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | A template |
symfony TemplateReference TemplateReference
==================
class **TemplateReference** extends [TemplateReference](../../../component/templating/templatereference "Symfony\Component\Templating\TemplateReference")
Internal representation of a template.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $parameters | | from [TemplateReference](../../../component/templating/templatereference#property_parameters "Symfony\Component\Templating\TemplateReference") |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(string $bundle = null, string $controller = null, string $name = null, string $format = null, string $engine = null) | |
| string | [\_\_toString](#method___toString)() Returns the string representation as shortcut for getLogicalName(). | from [TemplateReference](../../../component/templating/templatereference#method___toString "Symfony\Component\Templating\TemplateReference") |
| $this | [set](#method_set)(string $name, string $value) Sets a template parameter. | from [TemplateReference](../../../component/templating/templatereference#method_set "Symfony\Component\Templating\TemplateReference") |
| string | [get](#method_get)(string $name) Gets a template parameter. | from [TemplateReference](../../../component/templating/templatereference#method_get "Symfony\Component\Templating\TemplateReference") |
| array | [all](#method_all)() Gets the template parameters. | from [TemplateReference](../../../component/templating/templatereference#method_all "Symfony\Component\Templating\TemplateReference") |
| string | [getPath](#method_getPath)() Returns the path to the template - as a path when the template is not part of a bundle - as a resource when the template is part of a bundle. | |
| string | [getLogicalName](#method_getLogicalName)() Returns the "logical" template name. | |
Details
-------
###
\_\_construct(string $bundle = null, string $controller = null, string $name = null, string $format = null, string $engine = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $bundle | |
| string | $controller | |
| string | $name | |
| string | $format | |
| string | $engine | |
### string
\_\_toString()
Returns the string representation as shortcut for getLogicalName().
Alias of getLogicalName().
#### Return Value
| | |
| --- | --- |
| string | The template name |
### $this
set(string $name, string $value)
Sets a template parameter.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The parameter name |
| string | $value | The parameter value |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | if the parameter name is not supported |
### string
get(string $name)
Gets a template parameter.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The parameter name |
#### Return Value
| | |
| --- | --- |
| string | The parameter value |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | if the parameter name is not supported |
### array
all()
Gets the template parameters.
#### Return Value
| | |
| --- | --- |
| array | An array of parameters |
### string
getPath()
Returns the path to the template - as a path when the template is not part of a bundle - as a resource when the template is part of a bundle.
#### Return Value
| | |
| --- | --- |
| string | A path to the template or a resource |
### string
getLogicalName()
Returns the "logical" template name.
The template name acts as a unique identifier for the template.
#### Return Value
| | |
| --- | --- |
| string | The template name |
symfony FilesystemLoader FilesystemLoader
=================
class **FilesystemLoader** implements [LoaderInterface](../../../../component/templating/loader/loaderinterface "Symfony\Component\Templating\Loader\LoaderInterface")
FilesystemLoader is a loader that read templates from the filesystem.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $locator | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([FileLocatorInterface](../../../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") $locator) | |
| [Storage](../../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage")|bool | [load](#method_load)([TemplateReferenceInterface](../../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $template) Loads a template. | |
| bool | [isFresh](#method_isFresh)([TemplateReferenceInterface](../../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $template, int $time) Returns true if the template is still fresh. | |
Details
-------
###
\_\_construct([FileLocatorInterface](../../../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") $locator)
#### Parameters
| | | |
| --- | --- | --- |
| [FileLocatorInterface](../../../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") | $locator | |
### [Storage](../../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage")|bool
load([TemplateReferenceInterface](../../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $template)
Loads a template.
#### Parameters
| | | |
| --- | --- | --- |
| [TemplateReferenceInterface](../../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $template | |
#### Return Value
| | |
| --- | --- |
| [Storage](../../../../component/templating/storage/storage "Symfony\Component\Templating\Storage\Storage")|bool | false if the template cannot be loaded, a Storage instance otherwise |
### bool
isFresh([TemplateReferenceInterface](../../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $template, int $time)
Returns true if the template is still fresh.
#### Parameters
| | | |
| --- | --- | --- |
| [TemplateReferenceInterface](../../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $template | A template |
| int | $time | The last modification time of the cached template (timestamp) |
#### Return Value
| | |
| --- | --- |
| bool | |
symfony TemplateLocator TemplateLocator
================
class **TemplateLocator** implements [FileLocatorInterface](../../../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface")
TemplateLocator locates templates in bundles.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $locator | | |
| protected | $cache | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([FileLocatorInterface](../../../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") $locator, string $cacheDir = null) | |
| string | [getCacheKey](#method_getCacheKey)($template) Returns a full path for a given file. | |
| string|array | [locate](#method_locate)([TemplateReferenceInterface](../../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $template, string|null $currentPath = null, bool $first = true) Returns a full path for a given file. | |
Details
-------
###
\_\_construct([FileLocatorInterface](../../../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") $locator, string $cacheDir = null)
#### Parameters
| | | |
| --- | --- | --- |
| [FileLocatorInterface](../../../../component/config/filelocatorinterface "Symfony\Component\Config\FileLocatorInterface") | $locator | A FileLocatorInterface instance |
| string | $cacheDir | The cache path |
### protected string
getCacheKey($template)
Returns a full path for a given file.
#### Parameters
| | | |
| --- | --- | --- |
| | $template | |
#### Return Value
| | |
| --- | --- |
| string | The full path for the file |
### string|array
locate([TemplateReferenceInterface](../../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") $template, string|null $currentPath = null, bool $first = true)
Returns a full path for a given file.
#### Parameters
| | | |
| --- | --- | --- |
| [TemplateReferenceInterface](../../../../component/templating/templatereferenceinterface "Symfony\Component\Templating\TemplateReferenceInterface") | $template | A template |
| string|null | $currentPath | The current path |
| bool | $first | Whether to return the first occurrence or an array of filenames |
#### Return Value
| | |
| --- | --- |
| string|array | The full path to the file or an array of file paths |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | When the template is not an instance of TemplateReferenceInterface |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | When the template file can not be found |
| programming_docs |
symfony AssetsHelper AssetsHelper
=============
class **AssetsHelper** extends [Helper](../../../../component/templating/helper/helper "Symfony\Component\Templating\Helper\Helper")
AssetsHelper helps manage asset URLs.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $charset | | from [Helper](../../../../component/templating/helper/helper#property_charset "Symfony\Component\Templating\Helper\Helper") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setCharset](#method_setCharset)(string $charset) Sets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_setCharset "Symfony\Component\Templating\Helper\Helper") |
| string | [getCharset](#method_getCharset)() Gets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_getCharset "Symfony\Component\Templating\Helper\Helper") |
| | [\_\_construct](#method___construct)([Packages](../../../../component/asset/packages "Symfony\Component\Asset\Packages") $packages) | |
| string | [getUrl](#method_getUrl)(string $path, string $packageName = null) Returns the public url/path of an asset. | |
| string | [getVersion](#method_getVersion)(string $path, string $packageName = null) Returns the version of an asset. | |
| string | [getName](#method_getName)() Returns the canonical name of this helper. | |
Details
-------
###
setCharset(string $charset)
Sets the default charset.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the default charset.
#### Return Value
| | |
| --- | --- |
| string | The default charset |
###
\_\_construct([Packages](../../../../component/asset/packages "Symfony\Component\Asset\Packages") $packages)
#### Parameters
| | | |
| --- | --- | --- |
| [Packages](../../../../component/asset/packages "Symfony\Component\Asset\Packages") | $packages | |
### string
getUrl(string $path, string $packageName = null)
Returns the public url/path of an asset.
If the package used to generate the path is an instance of UrlPackage, you will always get a URL and not a path.
#### Parameters
| | | |
| --- | --- | --- |
| string | $path | A public path |
| string | $packageName | The name of the asset package to use |
#### Return Value
| | |
| --- | --- |
| string | The public path of the asset |
### string
getVersion(string $path, string $packageName = null)
Returns the version of an asset.
#### Parameters
| | | |
| --- | --- | --- |
| string | $path | A public path |
| string | $packageName | The name of the asset package to use |
#### Return Value
| | |
| --- | --- |
| string | The asset version |
### string
getName()
Returns the canonical name of this helper.
#### Return Value
| | |
| --- | --- |
| string | The canonical name |
symfony CodeHelper CodeHelper
===========
class **CodeHelper** extends [Helper](../../../../component/templating/helper/helper "Symfony\Component\Templating\Helper\Helper")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $charset | | |
| protected | $fileLinkFormat | | |
| protected | $rootDir | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [setCharset](#method_setCharset)(string $charset) Sets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_setCharset "Symfony\Component\Templating\Helper\Helper") |
| string | [getCharset](#method_getCharset)() Gets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_getCharset "Symfony\Component\Templating\Helper\Helper") |
| | [\_\_construct](#method___construct)(string|[FileLinkFormatter](../../../../component/httpkernel/debug/filelinkformatter "Symfony\Component\HttpKernel\Debug\FileLinkFormatter") $fileLinkFormat, string $rootDir, string $charset) | |
| string | [formatArgsAsText](#method_formatArgsAsText)(array $args) Formats an array as a string. | |
| | [abbrClass](#method_abbrClass)($class) | |
| | [abbrMethod](#method_abbrMethod)($method) | |
| string | [formatArgs](#method_formatArgs)(array $args) Formats an array as a string. | |
| string | [fileExcerpt](#method_fileExcerpt)(string $file, int $line) Returns an excerpt of a code file around the given line number. | |
| string | [formatFile](#method_formatFile)(string $file, int $line, string $text = null) Formats a file path. | |
| string | [getFileLink](#method_getFileLink)(string $file, int $line) Returns the link for a given file/line pair. | |
| | [formatFileFromText](#method_formatFileFromText)($text) | |
| string | [getName](#method_getName)() Returns the canonical name of this helper. | |
| static | [fixCodeMarkup](#method_fixCodeMarkup)($line) | |
Details
-------
###
setCharset(string $charset)
Sets the default charset.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the default charset.
#### Return Value
| | |
| --- | --- |
| string | The default charset |
###
\_\_construct(string|[FileLinkFormatter](../../../../component/httpkernel/debug/filelinkformatter "Symfony\Component\HttpKernel\Debug\FileLinkFormatter") $fileLinkFormat, string $rootDir, string $charset)
#### Parameters
| | | |
| --- | --- | --- |
| string|[FileLinkFormatter](../../../../component/httpkernel/debug/filelinkformatter "Symfony\Component\HttpKernel\Debug\FileLinkFormatter") | $fileLinkFormat | The format for links to source files |
| string | $rootDir | The project root directory |
| string | $charset | The charset |
### string
formatArgsAsText(array $args)
Formats an array as a string.
#### Parameters
| | | |
| --- | --- | --- |
| array | $args | The argument array |
#### Return Value
| | |
| --- | --- |
| string | |
###
abbrClass($class)
#### Parameters
| | | |
| --- | --- | --- |
| | $class | |
###
abbrMethod($method)
#### Parameters
| | | |
| --- | --- | --- |
| | $method | |
### string
formatArgs(array $args)
Formats an array as a string.
#### Parameters
| | | |
| --- | --- | --- |
| array | $args | The argument array |
#### Return Value
| | |
| --- | --- |
| string | |
### string
fileExcerpt(string $file, int $line)
Returns an excerpt of a code file around the given line number.
#### Parameters
| | | |
| --- | --- | --- |
| string | $file | A file path |
| int | $line | The selected line number |
#### Return Value
| | |
| --- | --- |
| string | An HTML string |
### string
formatFile(string $file, int $line, string $text = null)
Formats a file path.
#### Parameters
| | | |
| --- | --- | --- |
| string | $file | An absolute file path |
| int | $line | The line number |
| string | $text | Use this text for the link rather than the file path |
#### Return Value
| | |
| --- | --- |
| string | |
### string
getFileLink(string $file, int $line)
Returns the link for a given file/line pair.
#### Parameters
| | | |
| --- | --- | --- |
| string | $file | An absolute file path |
| int | $line | The line number |
#### Return Value
| | |
| --- | --- |
| string | A link of false |
###
formatFileFromText($text)
#### Parameters
| | | |
| --- | --- | --- |
| | $text | |
### string
getName()
Returns the canonical name of this helper.
#### Return Value
| | |
| --- | --- |
| string | The canonical name |
### static protected
fixCodeMarkup($line)
#### Parameters
| | | |
| --- | --- | --- |
| | $line | |
symfony TranslatorHelper TranslatorHelper
=================
class **TranslatorHelper** extends [Helper](../../../../component/templating/helper/helper "Symfony\Component\Templating\Helper\Helper")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $charset | | from [Helper](../../../../component/templating/helper/helper#property_charset "Symfony\Component\Templating\Helper\Helper") |
| protected | $translator | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [setCharset](#method_setCharset)(string $charset) Sets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_setCharset "Symfony\Component\Templating\Helper\Helper") |
| string | [getCharset](#method_getCharset)() Gets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_getCharset "Symfony\Component\Templating\Helper\Helper") |
| | [\_\_construct](#method___construct)([TranslatorInterface](../../../../component/translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator) | |
| | [trans](#method_trans)($id, array $parameters = array(), $domain = 'messages', $locale = null) | |
| | [transChoice](#method_transChoice)($id, $number, array $parameters = array(), $domain = 'messages', $locale = null) | |
| string | [getName](#method_getName)() Returns the canonical name of this helper. | |
Details
-------
###
setCharset(string $charset)
Sets the default charset.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the default charset.
#### Return Value
| | |
| --- | --- |
| string | The default charset |
###
\_\_construct([TranslatorInterface](../../../../component/translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator)
#### Parameters
| | | |
| --- | --- | --- |
| [TranslatorInterface](../../../../component/translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | |
###
trans($id, array $parameters = array(), $domain = 'messages', $locale = null)
#### Parameters
| | | |
| --- | --- | --- |
| | $id | |
| array | $parameters | |
| | $domain | |
| | $locale | |
#### See also
| | |
| --- | --- |
| [TranslatorInterface::trans](../../../../component/translation/translatorinterface#method_trans "Symfony\Component\Translation\TranslatorInterface") | |
###
transChoice($id, $number, array $parameters = array(), $domain = 'messages', $locale = null)
#### Parameters
| | | |
| --- | --- | --- |
| | $id | |
| | $number | |
| array | $parameters | |
| | $domain | |
| | $locale | |
#### See also
| | |
| --- | --- |
| [TranslatorInterface::transChoice](../../../../component/translation/translatorinterface#method_transChoice "Symfony\Component\Translation\TranslatorInterface") | |
### string
getName()
Returns the canonical name of this helper.
#### Return Value
| | |
| --- | --- |
| string | The canonical name |
symfony StopwatchHelper StopwatchHelper
================
class **StopwatchHelper** extends [Helper](../../../../component/templating/helper/helper "Symfony\Component\Templating\Helper\Helper")
StopwatchHelper provides methods time your PHP templates.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $charset | | from [Helper](../../../../component/templating/helper/helper#property_charset "Symfony\Component\Templating\Helper\Helper") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setCharset](#method_setCharset)(string $charset) Sets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_setCharset "Symfony\Component\Templating\Helper\Helper") |
| string | [getCharset](#method_getCharset)() Gets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_getCharset "Symfony\Component\Templating\Helper\Helper") |
| | [\_\_construct](#method___construct)([Stopwatch](../../../../component/stopwatch/stopwatch "Symfony\Component\Stopwatch\Stopwatch") $stopwatch = null) | |
| string | [getName](#method_getName)() Returns the canonical name of this helper. | |
| | [\_\_call](#method___call)($method, $arguments = array()) | |
Details
-------
###
setCharset(string $charset)
Sets the default charset.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the default charset.
#### Return Value
| | |
| --- | --- |
| string | The default charset |
###
\_\_construct([Stopwatch](../../../../component/stopwatch/stopwatch "Symfony\Component\Stopwatch\Stopwatch") $stopwatch = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Stopwatch](../../../../component/stopwatch/stopwatch "Symfony\Component\Stopwatch\Stopwatch") | $stopwatch | |
### string
getName()
Returns the canonical name of this helper.
#### Return Value
| | |
| --- | --- |
| string | The canonical name |
###
\_\_call($method, $arguments = array())
#### Parameters
| | | |
| --- | --- | --- |
| | $method | |
| | $arguments | |
symfony FormHelper FormHelper
===========
class **FormHelper** extends [Helper](../../../../component/templating/helper/helper "Symfony\Component\Templating\Helper\Helper")
FormHelper provides helpers to help display forms.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $charset | | from [Helper](../../../../component/templating/helper/helper#property_charset "Symfony\Component\Templating\Helper\Helper") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setCharset](#method_setCharset)(string $charset) Sets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_setCharset "Symfony\Component\Templating\Helper\Helper") |
| string | [getCharset](#method_getCharset)() Gets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_getCharset "Symfony\Component\Templating\Helper\Helper") |
| | [\_\_construct](#method___construct)([FormRendererInterface](../../../../component/form/formrendererinterface "Symfony\Component\Form\FormRendererInterface") $renderer) | |
| string | [getName](#method_getName)() Returns the canonical name of this helper. | |
| | [setTheme](#method_setTheme)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, string|array $themes, bool $useDefaultThemes = true) Sets a theme for a given view. | |
| string | [form](#method_form)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array()) Renders the HTML for a form. | |
| string | [start](#method_start)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array()) Renders the form start tag. | |
| string | [end](#method_end)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array()) Renders the form end tag. | |
| string | [widget](#method_widget)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array()) Renders the HTML for a given view. | |
| string | [row](#method_row)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array()) Renders the entire form field "row". | |
| string | [label](#method_label)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, string $label = null, array $variables = array()) Renders the label of the given view. | |
| string | [help](#method_help)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view) Renders the help of the given view. | |
| string | [errors](#method_errors)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view) Renders the errors of the given view. | |
| string | [rest](#method_rest)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array()) Renders views which have not already been rendered. | |
| string | [block](#method_block)([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, string $blockName, array $variables = array()) Renders a block of the template. | |
| string | [csrfToken](#method_csrfToken)(string $tokenId) Returns a CSRF token. | |
| | [humanize](#method_humanize)($text) | |
| | [formEncodeCurrency](#method_formEncodeCurrency)($text, $widget = '') | |
Details
-------
###
setCharset(string $charset)
Sets the default charset.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the default charset.
#### Return Value
| | |
| --- | --- |
| string | The default charset |
###
\_\_construct([FormRendererInterface](../../../../component/form/formrendererinterface "Symfony\Component\Form\FormRendererInterface") $renderer)
#### Parameters
| | | |
| --- | --- | --- |
| [FormRendererInterface](../../../../component/form/formrendererinterface "Symfony\Component\Form\FormRendererInterface") | $renderer | |
### string
getName()
Returns the canonical name of this helper.
#### Return Value
| | |
| --- | --- |
| string | The canonical name |
###
setTheme([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, string|array $themes, bool $useDefaultThemes = true)
Sets a theme for a given view.
The theme format is ":".
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | A FormView instance |
| string|array | $themes | A theme or an array of theme |
| bool | $useDefaultThemes | If true, will use default themes defined in the renderer |
### string
form([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array())
Renders the HTML for a form.
Example usage:
```
<?php echo view['form']->form($form) ?>
```
You can pass options during the call:
```
<?php echo view['form']->form($form, array('attr' => array('class' => 'foo'))) ?>
<?php echo view['form']->form($form, array('separator' => '+++++')) ?>
```
This method is mainly intended for prototyping purposes. If you want to control the layout of a form in a more fine-grained manner, you are advised to use the other helper methods for rendering the parts of the form individually. You can also create a custom form theme to adapt the look of the form.
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | The view for which to render the form |
| array | $variables | Additional variables passed to the template |
#### Return Value
| | |
| --- | --- |
| string | The HTML markup |
### string
start([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array())
Renders the form start tag.
Example usage templates:
```
<?php echo $view['form']->start($form) ?>>
```
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | The view for which to render the start tag |
| array | $variables | Additional variables passed to the template |
#### Return Value
| | |
| --- | --- |
| string | The HTML markup |
### string
end([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array())
Renders the form end tag.
Example usage templates:
```
<?php echo $view['form']->end($form) ?>>
```
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | The view for which to render the end tag |
| array | $variables | Additional variables passed to the template |
#### Return Value
| | |
| --- | --- |
| string | The HTML markup |
### string
widget([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array())
Renders the HTML for a given view.
Example usage:
```
<?php echo $view['form']->widget($form) ?>
```
You can pass options during the call:
```
<?php echo $view['form']->widget($form, array('attr' => array('class' => 'foo'))) ?>
<?php echo $view['form']->widget($form, array('separator' => '+++++')) ?>
```
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | The view for which to render the widget |
| array | $variables | Additional variables passed to the template |
#### Return Value
| | |
| --- | --- |
| string | The HTML markup |
### string
row([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array())
Renders the entire form field "row".
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | The view for which to render the row |
| array | $variables | Additional variables passed to the template |
#### Return Value
| | |
| --- | --- |
| string | The HTML markup |
### string
label([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, string $label = null, array $variables = array())
Renders the label of the given view.
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | The view for which to render the label |
| string | $label | The label |
| array | $variables | Additional variables passed to the template |
#### Return Value
| | |
| --- | --- |
| string | The HTML markup |
### string
help([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view)
Renders the help of the given view.
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | The parent view |
#### Return Value
| | |
| --- | --- |
| string | The HTML markup |
### string
errors([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view)
Renders the errors of the given view.
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | |
#### Return Value
| | |
| --- | --- |
| string | The HTML markup |
### string
rest([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, array $variables = array())
Renders views which have not already been rendered.
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | The parent view |
| array | $variables | An array of variables |
#### Return Value
| | |
| --- | --- |
| string | The HTML markup |
### string
block([FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") $view, string $blockName, array $variables = array())
Renders a block of the template.
#### Parameters
| | | |
| --- | --- | --- |
| [FormView](../../../../component/form/formview "Symfony\Component\Form\FormView") | $view | The view for determining the used themes |
| string | $blockName | The name of the block to render |
| array | $variables | The variable to pass to the template |
#### Return Value
| | |
| --- | --- |
| string | The HTML markup |
### string
csrfToken(string $tokenId)
Returns a CSRF token.
Use this helper for CSRF protection without the overhead of creating a form.
```
echo $view['form']->csrfToken('rm_user_'.$user->getId());
```
Check the token in your action using the same CSRF token id.
```
// $csrfProvider being an instance of Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface
if (!$csrfProvider->isCsrfTokenValid('rm_user_'.$user->getId(), $token)) {
throw new \RuntimeException('CSRF attack detected.');
}
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $tokenId | The CSRF token id of the protected action |
#### Return Value
| | |
| --- | --- |
| string | A CSRF token |
#### Exceptions
| | |
| --- | --- |
| [BadMethodCallException](http://php.net/BadMethodCallException) | when no CSRF provider was injected in the constructor |
###
humanize($text)
#### Parameters
| | | |
| --- | --- | --- |
| | $text | |
###
formEncodeCurrency($text, $widget = '')
#### Parameters
| | | |
| --- | --- | --- |
| | $text | |
| | $widget | |
| programming_docs |
symfony RouterHelper RouterHelper
=============
class **RouterHelper** extends [Helper](../../../../component/templating/helper/helper "Symfony\Component\Templating\Helper\Helper")
RouterHelper manages links between pages in a template context.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $charset | | from [Helper](../../../../component/templating/helper/helper#property_charset "Symfony\Component\Templating\Helper\Helper") |
| protected | $generator | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [setCharset](#method_setCharset)(string $charset) Sets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_setCharset "Symfony\Component\Templating\Helper\Helper") |
| string | [getCharset](#method_getCharset)() Gets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_getCharset "Symfony\Component\Templating\Helper\Helper") |
| | [\_\_construct](#method___construct)([UrlGeneratorInterface](../../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") $router) | |
| string | [path](#method_path)(string $name, mixed $parameters = array(), bool $relative = false) Generates a URL reference (as an absolute or relative path) to the route with the given parameters. | |
| string | [url](#method_url)(string $name, mixed $parameters = array(), bool $schemeRelative = false) Generates a URL reference (as an absolute URL or network path) to the route with the given parameters. | |
| string | [getName](#method_getName)() Returns the canonical name of this helper. | |
Details
-------
###
setCharset(string $charset)
Sets the default charset.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the default charset.
#### Return Value
| | |
| --- | --- |
| string | The default charset |
###
\_\_construct([UrlGeneratorInterface](../../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") $router)
#### Parameters
| | | |
| --- | --- | --- |
| [UrlGeneratorInterface](../../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") | $router | |
### string
path(string $name, mixed $parameters = array(), bool $relative = false)
Generates a URL reference (as an absolute or relative path) to the route with the given parameters.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the route |
| mixed | $parameters | An array of parameters |
| bool | $relative | Whether to generate a relative or absolute path |
#### Return Value
| | |
| --- | --- |
| string | The generated URL reference |
#### See also
| | |
| --- | --- |
| [UrlGeneratorInterface](../../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") | |
### string
url(string $name, mixed $parameters = array(), bool $schemeRelative = false)
Generates a URL reference (as an absolute URL or network path) to the route with the given parameters.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the route |
| mixed | $parameters | An array of parameters |
| bool | $schemeRelative | Whether to omit the scheme in the generated URL reference |
#### Return Value
| | |
| --- | --- |
| string | The generated URL reference |
#### See also
| | |
| --- | --- |
| [UrlGeneratorInterface](../../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") | |
### string
getName()
Returns the canonical name of this helper.
#### Return Value
| | |
| --- | --- |
| string | The canonical name |
symfony SessionHelper SessionHelper
==============
class **SessionHelper** extends [Helper](../../../../component/templating/helper/helper "Symfony\Component\Templating\Helper\Helper")
SessionHelper provides read-only access to the session attributes.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $charset | | from [Helper](../../../../component/templating/helper/helper#property_charset "Symfony\Component\Templating\Helper\Helper") |
| protected | $session | | |
| protected | $requestStack | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [setCharset](#method_setCharset)(string $charset) Sets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_setCharset "Symfony\Component\Templating\Helper\Helper") |
| string | [getCharset](#method_getCharset)() Gets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_getCharset "Symfony\Component\Templating\Helper\Helper") |
| | [\_\_construct](#method___construct)([RequestStack](../../../../component/httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") $requestStack) | |
| mixed | [get](#method_get)(string $name, mixed $default = null) Returns an attribute. | |
| | [getFlash](#method_getFlash)($name, array $default = array()) | |
| | [getFlashes](#method_getFlashes)() | |
| | [hasFlash](#method_hasFlash)($name) | |
| string | [getName](#method_getName)() Returns the canonical name of this helper. | |
Details
-------
###
setCharset(string $charset)
Sets the default charset.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the default charset.
#### Return Value
| | |
| --- | --- |
| string | The default charset |
###
\_\_construct([RequestStack](../../../../component/httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") $requestStack)
#### Parameters
| | | |
| --- | --- | --- |
| [RequestStack](../../../../component/httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") | $requestStack | |
### mixed
get(string $name, mixed $default = null)
Returns an attribute.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The attribute name |
| mixed | $default | The default value |
#### Return Value
| | |
| --- | --- |
| mixed | |
###
getFlash($name, array $default = array())
#### Parameters
| | | |
| --- | --- | --- |
| | $name | |
| array | $default | |
###
getFlashes()
###
hasFlash($name)
#### Parameters
| | | |
| --- | --- | --- |
| | $name | |
### string
getName()
Returns the canonical name of this helper.
#### Return Value
| | |
| --- | --- |
| string | The canonical name |
symfony ActionsHelper ActionsHelper
==============
class **ActionsHelper** extends [Helper](../../../../component/templating/helper/helper "Symfony\Component\Templating\Helper\Helper")
ActionsHelper manages action inclusions.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $charset | | from [Helper](../../../../component/templating/helper/helper#property_charset "Symfony\Component\Templating\Helper\Helper") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setCharset](#method_setCharset)(string $charset) Sets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_setCharset "Symfony\Component\Templating\Helper\Helper") |
| string | [getCharset](#method_getCharset)() Gets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_getCharset "Symfony\Component\Templating\Helper\Helper") |
| | [\_\_construct](#method___construct)([FragmentHandler](../../../../component/httpkernel/fragment/fragmenthandler "Symfony\Component\HttpKernel\Fragment\FragmentHandler") $handler) | |
| string | [render](#method_render)(string $uri, array $options = array()) Returns the fragment content for a given URI. | |
| | [controller](#method_controller)($controller, $attributes = array(), $query = array()) | |
| string | [getName](#method_getName)() Returns the canonical name of this helper. | |
Details
-------
###
setCharset(string $charset)
Sets the default charset.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the default charset.
#### Return Value
| | |
| --- | --- |
| string | The default charset |
###
\_\_construct([FragmentHandler](../../../../component/httpkernel/fragment/fragmenthandler "Symfony\Component\HttpKernel\Fragment\FragmentHandler") $handler)
#### Parameters
| | | |
| --- | --- | --- |
| [FragmentHandler](../../../../component/httpkernel/fragment/fragmenthandler "Symfony\Component\HttpKernel\Fragment\FragmentHandler") | $handler | |
### string
render(string $uri, array $options = array())
Returns the fragment content for a given URI.
#### Parameters
| | | |
| --- | --- | --- |
| string | $uri | A URI |
| array | $options | An array of options |
#### Return Value
| | |
| --- | --- |
| string | The fragment content |
#### See also
| | |
| --- | --- |
| [FragmentHandler::render](../../../../component/httpkernel/fragment/fragmenthandler#method_render "Symfony\Component\HttpKernel\Fragment\FragmentHandler") | |
###
controller($controller, $attributes = array(), $query = array())
#### Parameters
| | | |
| --- | --- | --- |
| | $controller | |
| | $attributes | |
| | $query | |
### string
getName()
Returns the canonical name of this helper.
#### Return Value
| | |
| --- | --- |
| string | The canonical name |
symfony RequestHelper RequestHelper
==============
class **RequestHelper** extends [Helper](../../../../component/templating/helper/helper "Symfony\Component\Templating\Helper\Helper")
RequestHelper provides access to the current request parameters.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $charset | | from [Helper](../../../../component/templating/helper/helper#property_charset "Symfony\Component\Templating\Helper\Helper") |
| protected | $requestStack | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [setCharset](#method_setCharset)(string $charset) Sets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_setCharset "Symfony\Component\Templating\Helper\Helper") |
| string | [getCharset](#method_getCharset)() Gets the default charset. | from [Helper](../../../../component/templating/helper/helper#method_getCharset "Symfony\Component\Templating\Helper\Helper") |
| | [\_\_construct](#method___construct)([RequestStack](../../../../component/httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") $requestStack) | |
| mixed | [getParameter](#method_getParameter)(string $key, string $default = null) Returns a parameter from the current request object. | |
| string | [getLocale](#method_getLocale)() Returns the locale. | |
| string | [getName](#method_getName)() Returns the canonical name of this helper. | |
Details
-------
###
setCharset(string $charset)
Sets the default charset.
#### Parameters
| | | |
| --- | --- | --- |
| string | $charset | The charset |
### string
getCharset()
Gets the default charset.
#### Return Value
| | |
| --- | --- |
| string | The default charset |
###
\_\_construct([RequestStack](../../../../component/httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") $requestStack)
#### Parameters
| | | |
| --- | --- | --- |
| [RequestStack](../../../../component/httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") | $requestStack | |
### mixed
getParameter(string $key, string $default = null)
Returns a parameter from the current request object.
#### Parameters
| | | |
| --- | --- | --- |
| string | $key | The name of the parameter |
| string | $default | A default value |
#### Return Value
| | |
| --- | --- |
| mixed | |
#### See also
| | |
| --- | --- |
| Request::get() | |
### string
getLocale()
Returns the locale.
#### Return Value
| | |
| --- | --- |
| string | |
### string
getName()
Returns the canonical name of this helper.
#### Return Value
| | |
| --- | --- |
| string | The canonical name |
symfony AbstractController AbstractController
===================
abstract class **AbstractController** implements [ServiceSubscriberInterface](../../../component/dependencyinjection/servicesubscriberinterface "Symfony\Component\DependencyInjection\ServiceSubscriberInterface")
Provides common features needed in controllers.
Traits
------
| | |
| --- | --- |
| [ControllerTrait](controllertrait "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") | Common features needed in controllers. |
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected ContainerInterface | $container | | |
Methods
-------
| | | |
| --- | --- | --- |
| bool | [has](#method_has)(string $id) Returns true if the service id is defined. | from [ControllerTrait](controllertrait#method_has "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| object | [get](#method_get)(string $id) Gets a container service by its id. | from [ControllerTrait](controllertrait#method_get "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| string | [generateUrl](#method_generateUrl)(string $route, array $parameters = array(), int $referenceType = UrlGeneratorInterface::ABSOLUTE\_PATH) Generates a URL from the given parameters. | from [ControllerTrait](controllertrait#method_generateUrl "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [forward](#method_forward)(string $controller, array $path = array(), array $query = array()) Forwards the request to another controller. | from [ControllerTrait](controllertrait#method_forward "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | [redirect](#method_redirect)(string $url, int $status = 302) Returns a RedirectResponse to the given URL. | from [ControllerTrait](controllertrait#method_redirect "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | [redirectToRoute](#method_redirectToRoute)(string $route, array $parameters = array(), int $status = 302) Returns a RedirectResponse to the given route with the given parameters. | from [ControllerTrait](controllertrait#method_redirectToRoute "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [JsonResponse](../../../component/httpfoundation/jsonresponse "Symfony\Component\HttpFoundation\JsonResponse") | [json](#method_json)($data, int $status = 200, array $headers = array(), array $context = array()) Returns a JsonResponse that uses the serializer component if enabled, or json\_encode. | from [ControllerTrait](controllertrait#method_json "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [BinaryFileResponse](../../../component/httpfoundation/binaryfileresponse "Symfony\Component\HttpFoundation\BinaryFileResponse") | [file](#method_file)($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION\_ATTACHMENT) Returns a BinaryFileResponse object with original or customized file name and disposition header. | from [ControllerTrait](controllertrait#method_file "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| | [addFlash](#method_addFlash)(string $type, string $message) Adds a flash message to the current session for type. | from [ControllerTrait](controllertrait#method_addFlash "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| bool | [isGranted](#method_isGranted)($attributes, $subject = null) Checks if the attributes are granted against the current authentication token and optionally supplied subject. | from [ControllerTrait](controllertrait#method_isGranted "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| | [denyAccessUnlessGranted](#method_denyAccessUnlessGranted)($attributes, $subject = null, string $message = 'Access Denied.') Throws an exception unless the attributes are granted against the current authentication token and optionally supplied subject. | from [ControllerTrait](controllertrait#method_denyAccessUnlessGranted "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| string | [renderView](#method_renderView)(string $view, array $parameters = array()) Returns a rendered view. | from [ControllerTrait](controllertrait#method_renderView "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [render](#method_render)(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null) Renders a view. | from [ControllerTrait](controllertrait#method_render "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") | [stream](#method_stream)(string $view, array $parameters = array(), [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") $response = null) Streams a view. | from [ControllerTrait](controllertrait#method_stream "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | [createNotFoundException](#method_createNotFoundException)(string $message = 'Not Found', [Exception](http://php.net/Exception) $previous = null) Returns a NotFoundHttpException. | from [ControllerTrait](controllertrait#method_createNotFoundException "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException") | [createAccessDeniedException](#method_createAccessDeniedException)(string $message = 'Access Denied.', [Exception](http://php.net/Exception) $previous = null) Returns an AccessDeniedException. | from [ControllerTrait](controllertrait#method_createAccessDeniedException "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [FormInterface](../../../component/form/forminterface "Symfony\Component\Form\FormInterface") | [createForm](#method_createForm)(string $type, $data = null, array $options = array()) Creates and returns a Form instance from the type of the form. | from [ControllerTrait](controllertrait#method_createForm "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [FormBuilderInterface](../../../component/form/formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createFormBuilder](#method_createFormBuilder)($data = null, array $options = array()) Creates and returns a form builder instance. | from [ControllerTrait](controllertrait#method_createFormBuilder "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| ManagerRegistry | [getDoctrine](#method_getDoctrine)() Shortcut to return the Doctrine Registry service. | from [ControllerTrait](controllertrait#method_getDoctrine "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| mixed | [getUser](#method_getUser)() Get a user from the Security Token Storage. | from [ControllerTrait](controllertrait#method_getUser "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| bool | [isCsrfTokenValid](#method_isCsrfTokenValid)(string $id, string|null $token) Checks the validity of a CSRF token. | from [ControllerTrait](controllertrait#method_isCsrfTokenValid "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| | [dispatchMessage](#method_dispatchMessage)(object $message) Dispatches a message to the bus. | from [ControllerTrait](controllertrait#method_dispatchMessage "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| | [setContainer](#method_setContainer)(ContainerInterface $container) | |
| mixed | [getParameter](#method_getParameter)(string $name) Gets a container parameter by its name. | |
| static array | [getSubscribedServices](#method_getSubscribedServices)() Returns an array of service types required by such instances, optionally keyed by the service names used internally. | |
Details
-------
### protected bool
has(string $id)
Returns true if the service id is defined.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | |
#### Return Value
| | |
| --- | --- |
| bool | |
### protected object
get(string $id)
Gets a container service by its id.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | |
#### Return Value
| | |
| --- | --- |
| object | The service |
### protected string
generateUrl(string $route, array $parameters = array(), int $referenceType = UrlGeneratorInterface::ABSOLUTE\_PATH)
Generates a URL from the given parameters.
#### Parameters
| | | |
| --- | --- | --- |
| string | $route | |
| array | $parameters | |
| int | $referenceType | |
#### Return Value
| | |
| --- | --- |
| string | |
#### See also
| | |
| --- | --- |
| [UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") | |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
forward(string $controller, array $path = array(), array $query = array())
Forwards the request to another controller.
#### Parameters
| | | |
| --- | --- | --- |
| string | $controller | |
| array | $path | |
| array | $query | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
### protected [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse")
redirect(string $url, int $status = 302)
Returns a RedirectResponse to the given URL.
#### Parameters
| | | |
| --- | --- | --- |
| string | $url | |
| int | $status | |
#### Return Value
| | |
| --- | --- |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | |
### protected [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse")
redirectToRoute(string $route, array $parameters = array(), int $status = 302)
Returns a RedirectResponse to the given route with the given parameters.
#### Parameters
| | | |
| --- | --- | --- |
| string | $route | |
| array | $parameters | |
| int | $status | |
#### Return Value
| | |
| --- | --- |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | |
### protected [JsonResponse](../../../component/httpfoundation/jsonresponse "Symfony\Component\HttpFoundation\JsonResponse")
json($data, int $status = 200, array $headers = array(), array $context = array())
Returns a JsonResponse that uses the serializer component if enabled, or json\_encode.
#### Parameters
| | | |
| --- | --- | --- |
| | $data | |
| int | $status | |
| array | $headers | |
| array | $context | |
#### Return Value
| | |
| --- | --- |
| [JsonResponse](../../../component/httpfoundation/jsonresponse "Symfony\Component\HttpFoundation\JsonResponse") | |
### protected [BinaryFileResponse](../../../component/httpfoundation/binaryfileresponse "Symfony\Component\HttpFoundation\BinaryFileResponse")
file($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION\_ATTACHMENT)
Returns a BinaryFileResponse object with original or customized file name and disposition header.
#### Parameters
| | | |
| --- | --- | --- |
| | $file | |
| string | $fileName | |
| string | $disposition | |
#### Return Value
| | |
| --- | --- |
| [BinaryFileResponse](../../../component/httpfoundation/binaryfileresponse "Symfony\Component\HttpFoundation\BinaryFileResponse") | |
### protected
addFlash(string $type, string $message)
Adds a flash message to the current session for type.
#### Parameters
| | | |
| --- | --- | --- |
| string | $type | |
| string | $message | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### protected bool
isGranted($attributes, $subject = null)
Checks if the attributes are granted against the current authentication token and optionally supplied subject.
#### Parameters
| | | |
| --- | --- | --- |
| | $attributes | |
| | $subject | |
#### Return Value
| | |
| --- | --- |
| bool | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### protected
denyAccessUnlessGranted($attributes, $subject = null, string $message = 'Access Denied.')
Throws an exception unless the attributes are granted against the current authentication token and optionally supplied subject.
#### Parameters
| | | |
| --- | --- | --- |
| | $attributes | |
| | $subject | |
| string | $message | |
#### Exceptions
| | |
| --- | --- |
| [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException") | |
### protected string
renderView(string $view, array $parameters = array())
Returns a rendered view.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | |
| array | $parameters | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
render(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null)
Renders a view.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | |
| array | $parameters | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
### protected [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse")
stream(string $view, array $parameters = array(), [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") $response = null)
Streams a view.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | |
| array | $parameters | |
| [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") | $response | |
#### Return Value
| | |
| --- | --- |
| [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") | |
### protected [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException")
createNotFoundException(string $message = 'Not Found', [Exception](http://php.net/Exception) $previous = null)
Returns a NotFoundHttpException.
This will result in a 404 response code. Usage example:
```
throw $this->createNotFoundException('Page not found!');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $message | |
| [Exception](http://php.net/Exception) | $previous | |
#### Return Value
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### protected [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException")
createAccessDeniedException(string $message = 'Access Denied.', [Exception](http://php.net/Exception) $previous = null)
Returns an AccessDeniedException.
This will result in a 403 response code. Usage example:
```
throw $this->createAccessDeniedException('Unable to access this page!');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $message | |
| [Exception](http://php.net/Exception) | $previous | |
#### Return Value
| | |
| --- | --- |
| [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException") | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If the Security component is not available |
### protected [FormInterface](../../../component/form/forminterface "Symfony\Component\Form\FormInterface")
createForm(string $type, $data = null, array $options = array())
Creates and returns a Form instance from the type of the form.
#### Parameters
| | | |
| --- | --- | --- |
| string | $type | |
| | $data | |
| array | $options | |
#### Return Value
| | |
| --- | --- |
| [FormInterface](../../../component/form/forminterface "Symfony\Component\Form\FormInterface") | |
### protected [FormBuilderInterface](../../../component/form/formbuilderinterface "Symfony\Component\Form\FormBuilderInterface")
createFormBuilder($data = null, array $options = array())
Creates and returns a form builder instance.
#### Parameters
| | | |
| --- | --- | --- |
| | $data | |
| array | $options | |
#### Return Value
| | |
| --- | --- |
| [FormBuilderInterface](../../../component/form/formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | |
### protected ManagerRegistry
getDoctrine()
Shortcut to return the Doctrine Registry service.
#### Return Value
| | |
| --- | --- |
| ManagerRegistry | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If DoctrineBundle is not available |
### protected mixed
getUser()
Get a user from the Security Token Storage.
#### Return Value
| | |
| --- | --- |
| mixed | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If SecurityBundle is not available |
#### See also
| | |
| --- | --- |
| TokenInterface::getUser() | |
### protected bool
isCsrfTokenValid(string $id, string|null $token)
Checks the validity of a CSRF token.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | The id used when generating the token |
| string|null | $token | The actual token sent with the request that should be validated |
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
dispatchMessage(object $message)
Dispatches a message to the bus.
#### Parameters
| | | |
| --- | --- | --- |
| object | $message | The message to dispatch |
###
setContainer(ContainerInterface $container)
#### Parameters
| | | |
| --- | --- | --- |
| ContainerInterface | $container | |
### protected mixed
getParameter(string $name)
Gets a container parameter by its name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | |
#### Return Value
| | |
| --- | --- |
| mixed | |
### static array
getSubscribedServices()
Returns an array of service types required by such instances, optionally keyed by the service names used internally.
For mandatory dependencies:
* array('logger' => 'Psr\Log\LoggerInterface') means the objects use the "logger" name internally to fetch a service which must implement Psr\Log\LoggerInterface.
* array('Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface')
otherwise:
* array('logger' => '?Psr\Log\LoggerInterface') denotes an optional dependency
* array('?Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface')
#### Return Value
| | |
| --- | --- |
| array | The required service types, optionally keyed by service names |
| programming_docs |
symfony ControllerNameParser deprecated ControllerNameParser deprecated
================================
class **ControllerNameParser**
deprecated
| since | Symfony 4.1 |
ControllerNameParser converts controller from the short notation a:b:c (BlogBundle:Post:index) to a fully-qualified class::method string (Bundle\BlogBundle\Controller\PostController::indexAction).
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $kernel | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel) | |
| string | [parse](#method_parse)(string $controller) Converts a short notation a:b:c to a class::method. | |
| string | [build](#method_build)(string $controller) Converts a class::method notation to a short one (a:b:c). | |
Details
-------
###
\_\_construct([KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel)
#### Parameters
| | | |
| --- | --- | --- |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | $kernel | |
### string
parse(string $controller)
Converts a short notation a:b:c to a class::method.
#### Parameters
| | | |
| --- | --- | --- |
| string | $controller | A short notation controller (a:b:c) |
#### Return Value
| | |
| --- | --- |
| string | A string in the class::method notation |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | when the specified bundle is not enabled or the controller cannot be found |
### string
build(string $controller)
Converts a class::method notation to a short one (a:b:c).
#### Parameters
| | | |
| --- | --- | --- |
| string | $controller | A string in the class::method notation |
#### Return Value
| | |
| --- | --- |
| string | A short notation controller (a:b:c) |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | when the controller is not valid or cannot be found in any bundle |
symfony RedirectController RedirectController
===================
class **RedirectController**
Redirects a request to another URL.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") $router = null, int $httpPort = null, int $httpsPort = null) | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [redirectAction](#method_redirectAction)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $route, bool $permanent = false, $ignoreAttributes = false, bool $keepRequestMethod = false, bool $keepQueryParams = false) Redirects to another route with the given name. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [urlRedirectAction](#method_urlRedirectAction)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $path, bool $permanent = false, string $scheme = null, int $httpPort = null, int $httpsPort = null, bool $keepRequestMethod = false) Redirects to a URL. | |
Details
-------
###
\_\_construct([UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") $router = null, int $httpPort = null, int $httpsPort = null)
#### Parameters
| | | |
| --- | --- | --- |
| [UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") | $router | |
| int | $httpPort | |
| int | $httpsPort | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
redirectAction([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $route, bool $permanent = false, $ignoreAttributes = false, bool $keepRequestMethod = false, bool $keepQueryParams = false)
Redirects to another route with the given name.
The response status code is 302 if the permanent parameter is false (default), and 301 if the redirection is permanent.
In case the route name is empty, the status code will be 404 when permanent is false and 410 otherwise.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| string | $route | |
| bool | $permanent | |
| | $ignoreAttributes | |
| bool | $keepRequestMethod | |
| bool | $keepQueryParams | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
#### Exceptions
| | |
| --- | --- |
| [HttpException](../../../component/httpkernel/exception/httpexception "Symfony\Component\HttpKernel\Exception\HttpException") | In case the route name is empty |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
urlRedirectAction([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $path, bool $permanent = false, string $scheme = null, int $httpPort = null, int $httpsPort = null, bool $keepRequestMethod = false)
Redirects to a URL.
The response status code is 302 if the permanent parameter is false (default), and 301 if the redirection is permanent.
In case the path is empty, the status code will be 404 when permanent is false and 410 otherwise.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | The request instance |
| string | $path | The absolute path or URL to redirect to |
| bool | $permanent | Whether the redirect is permanent or not |
| string | $scheme | The URL scheme (null to keep the current one) |
| int | $httpPort | The HTTP port (null to keep the current one for the same scheme or the default configured port) |
| int | $httpsPort | The HTTPS port (null to keep the current one for the same scheme or the default configured port) |
| bool | $keepRequestMethod | Wheter redirect action should keep HTTP request method |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
#### Exceptions
| | |
| --- | --- |
| [HttpException](../../../component/httpkernel/exception/httpexception "Symfony\Component\HttpKernel\Exception\HttpException") | In case the path is empty |
symfony ControllerTrait ControllerTrait
================
trait **ControllerTrait**
Common features needed in controllers.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| ContainerInterface | $container | | |
Methods
-------
| | | |
| --- | --- | --- |
| bool | [has](#method_has)(string $id) Returns true if the service id is defined. | |
| object | [get](#method_get)(string $id) Gets a container service by its id. | |
| string | [generateUrl](#method_generateUrl)(string $route, array $parameters = array(), int $referenceType = UrlGeneratorInterface::ABSOLUTE\_PATH) Generates a URL from the given parameters. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [forward](#method_forward)(string $controller, array $path = array(), array $query = array()) Forwards the request to another controller. | |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | [redirect](#method_redirect)(string $url, int $status = 302) Returns a RedirectResponse to the given URL. | |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | [redirectToRoute](#method_redirectToRoute)(string $route, array $parameters = array(), int $status = 302) Returns a RedirectResponse to the given route with the given parameters. | |
| [JsonResponse](../../../component/httpfoundation/jsonresponse "Symfony\Component\HttpFoundation\JsonResponse") | [json](#method_json)($data, int $status = 200, array $headers = array(), array $context = array()) Returns a JsonResponse that uses the serializer component if enabled, or json\_encode. | |
| [BinaryFileResponse](../../../component/httpfoundation/binaryfileresponse "Symfony\Component\HttpFoundation\BinaryFileResponse") | [file](#method_file)($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION\_ATTACHMENT) Returns a BinaryFileResponse object with original or customized file name and disposition header. | |
| | [addFlash](#method_addFlash)(string $type, string $message) Adds a flash message to the current session for type. | |
| bool | [isGranted](#method_isGranted)($attributes, $subject = null) Checks if the attributes are granted against the current authentication token and optionally supplied subject. | |
| | [denyAccessUnlessGranted](#method_denyAccessUnlessGranted)($attributes, $subject = null, string $message = 'Access Denied.') Throws an exception unless the attributes are granted against the current authentication token and optionally supplied subject. | |
| string | [renderView](#method_renderView)(string $view, array $parameters = array()) Returns a rendered view. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [render](#method_render)(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null) Renders a view. | |
| [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") | [stream](#method_stream)(string $view, array $parameters = array(), [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") $response = null) Streams a view. | |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | [createNotFoundException](#method_createNotFoundException)(string $message = 'Not Found', [Exception](http://php.net/Exception) $previous = null) Returns a NotFoundHttpException. | |
| [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException") | [createAccessDeniedException](#method_createAccessDeniedException)(string $message = 'Access Denied.', [Exception](http://php.net/Exception) $previous = null) Returns an AccessDeniedException. | |
| [FormInterface](../../../component/form/forminterface "Symfony\Component\Form\FormInterface") | [createForm](#method_createForm)(string $type, $data = null, array $options = array()) Creates and returns a Form instance from the type of the form. | |
| [FormBuilderInterface](../../../component/form/formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createFormBuilder](#method_createFormBuilder)($data = null, array $options = array()) Creates and returns a form builder instance. | |
| ManagerRegistry | [getDoctrine](#method_getDoctrine)() Shortcut to return the Doctrine Registry service. | |
| mixed | [getUser](#method_getUser)() Get a user from the Security Token Storage. | |
| bool | [isCsrfTokenValid](#method_isCsrfTokenValid)(string $id, string|null $token) Checks the validity of a CSRF token. | |
| | [dispatchMessage](#method_dispatchMessage)(object $message) Dispatches a message to the bus. | |
Details
-------
### protected bool
has(string $id)
Returns true if the service id is defined.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | |
#### Return Value
| | |
| --- | --- |
| bool | |
### protected object
get(string $id)
Gets a container service by its id.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | |
#### Return Value
| | |
| --- | --- |
| object | The service |
### protected string
generateUrl(string $route, array $parameters = array(), int $referenceType = UrlGeneratorInterface::ABSOLUTE\_PATH)
Generates a URL from the given parameters.
#### Parameters
| | | |
| --- | --- | --- |
| string | $route | |
| array | $parameters | |
| int | $referenceType | |
#### Return Value
| | |
| --- | --- |
| string | |
#### See also
| | |
| --- | --- |
| [UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") | |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
forward(string $controller, array $path = array(), array $query = array())
Forwards the request to another controller.
#### Parameters
| | | |
| --- | --- | --- |
| string | $controller | |
| array | $path | |
| array | $query | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
### protected [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse")
redirect(string $url, int $status = 302)
Returns a RedirectResponse to the given URL.
#### Parameters
| | | |
| --- | --- | --- |
| string | $url | |
| int | $status | |
#### Return Value
| | |
| --- | --- |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | |
### protected [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse")
redirectToRoute(string $route, array $parameters = array(), int $status = 302)
Returns a RedirectResponse to the given route with the given parameters.
#### Parameters
| | | |
| --- | --- | --- |
| string | $route | |
| array | $parameters | |
| int | $status | |
#### Return Value
| | |
| --- | --- |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | |
### protected [JsonResponse](../../../component/httpfoundation/jsonresponse "Symfony\Component\HttpFoundation\JsonResponse")
json($data, int $status = 200, array $headers = array(), array $context = array())
Returns a JsonResponse that uses the serializer component if enabled, or json\_encode.
#### Parameters
| | | |
| --- | --- | --- |
| | $data | |
| int | $status | |
| array | $headers | |
| array | $context | |
#### Return Value
| | |
| --- | --- |
| [JsonResponse](../../../component/httpfoundation/jsonresponse "Symfony\Component\HttpFoundation\JsonResponse") | |
### protected [BinaryFileResponse](../../../component/httpfoundation/binaryfileresponse "Symfony\Component\HttpFoundation\BinaryFileResponse")
file($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION\_ATTACHMENT)
Returns a BinaryFileResponse object with original or customized file name and disposition header.
#### Parameters
| | | |
| --- | --- | --- |
| | $file | |
| string | $fileName | |
| string | $disposition | |
#### Return Value
| | |
| --- | --- |
| [BinaryFileResponse](../../../component/httpfoundation/binaryfileresponse "Symfony\Component\HttpFoundation\BinaryFileResponse") | |
### protected
addFlash(string $type, string $message)
Adds a flash message to the current session for type.
#### Parameters
| | | |
| --- | --- | --- |
| string | $type | |
| string | $message | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### protected bool
isGranted($attributes, $subject = null)
Checks if the attributes are granted against the current authentication token and optionally supplied subject.
#### Parameters
| | | |
| --- | --- | --- |
| | $attributes | |
| | $subject | |
#### Return Value
| | |
| --- | --- |
| bool | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### protected
denyAccessUnlessGranted($attributes, $subject = null, string $message = 'Access Denied.')
Throws an exception unless the attributes are granted against the current authentication token and optionally supplied subject.
#### Parameters
| | | |
| --- | --- | --- |
| | $attributes | |
| | $subject | |
| string | $message | |
#### Exceptions
| | |
| --- | --- |
| [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException") | |
### protected string
renderView(string $view, array $parameters = array())
Returns a rendered view.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | |
| array | $parameters | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
render(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null)
Renders a view.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | |
| array | $parameters | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
### protected [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse")
stream(string $view, array $parameters = array(), [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") $response = null)
Streams a view.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | |
| array | $parameters | |
| [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") | $response | |
#### Return Value
| | |
| --- | --- |
| [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") | |
### protected [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException")
createNotFoundException(string $message = 'Not Found', [Exception](http://php.net/Exception) $previous = null)
Returns a NotFoundHttpException.
This will result in a 404 response code. Usage example:
```
throw $this->createNotFoundException('Page not found!');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $message | |
| [Exception](http://php.net/Exception) | $previous | |
#### Return Value
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### protected [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException")
createAccessDeniedException(string $message = 'Access Denied.', [Exception](http://php.net/Exception) $previous = null)
Returns an AccessDeniedException.
This will result in a 403 response code. Usage example:
```
throw $this->createAccessDeniedException('Unable to access this page!');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $message | |
| [Exception](http://php.net/Exception) | $previous | |
#### Return Value
| | |
| --- | --- |
| [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException") | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If the Security component is not available |
### protected [FormInterface](../../../component/form/forminterface "Symfony\Component\Form\FormInterface")
createForm(string $type, $data = null, array $options = array())
Creates and returns a Form instance from the type of the form.
#### Parameters
| | | |
| --- | --- | --- |
| string | $type | |
| | $data | |
| array | $options | |
#### Return Value
| | |
| --- | --- |
| [FormInterface](../../../component/form/forminterface "Symfony\Component\Form\FormInterface") | |
### protected [FormBuilderInterface](../../../component/form/formbuilderinterface "Symfony\Component\Form\FormBuilderInterface")
createFormBuilder($data = null, array $options = array())
Creates and returns a form builder instance.
#### Parameters
| | | |
| --- | --- | --- |
| | $data | |
| array | $options | |
#### Return Value
| | |
| --- | --- |
| [FormBuilderInterface](../../../component/form/formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | |
### protected ManagerRegistry
getDoctrine()
Shortcut to return the Doctrine Registry service.
#### Return Value
| | |
| --- | --- |
| ManagerRegistry | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If DoctrineBundle is not available |
### protected mixed
getUser()
Get a user from the Security Token Storage.
#### Return Value
| | |
| --- | --- |
| mixed | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If SecurityBundle is not available |
#### See also
| | |
| --- | --- |
| TokenInterface::getUser() | |
### protected bool
isCsrfTokenValid(string $id, string|null $token)
Checks the validity of a CSRF token.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | The id used when generating the token |
| string|null | $token | The actual token sent with the request that should be validated |
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
dispatchMessage(object $message)
Dispatches a message to the bus.
#### Parameters
| | | |
| --- | --- | --- |
| object | $message | The message to dispatch |
| programming_docs |
symfony TemplateController TemplateController
===================
class **TemplateController**
TemplateController.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(Environment $twig = null, [EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface") $templating = null) | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [templateAction](#method_templateAction)(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null) Renders a template. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [\_\_invoke](#method___invoke)(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null) | |
Details
-------
###
\_\_construct(Environment $twig = null, [EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface") $templating = null)
#### Parameters
| | | |
| --- | --- | --- |
| Environment | $twig | |
| [EngineInterface](../../../component/templating/engineinterface "Symfony\Component\Templating\EngineInterface") | $templating | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
templateAction(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null)
Renders a template.
#### Parameters
| | | |
| --- | --- | --- |
| string | $template | The template name |
| int | $maxAge | Max age for client caching |
| int | $sharedAge | Max age for shared (proxy) caching |
| bool | $private | Whether or not caching should apply for client caches only |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
\_\_invoke(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $template | |
| int | $maxAge | |
| int | $sharedAge | |
| bool | $private | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
symfony ControllerResolver ControllerResolver
===================
class **ControllerResolver** extends [ContainerControllerResolver](../../../component/httpkernel/controller/containercontrollerresolver "Symfony\Component\HttpKernel\Controller\ContainerControllerResolver")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $container | | from [ContainerControllerResolver](../../../component/httpkernel/controller/containercontrollerresolver#property_container "Symfony\Component\HttpKernel\Controller\ContainerControllerResolver") |
| protected | $parser | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(ContainerInterface $container, [ControllerNameParser](controllernameparser "Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser") $parser, LoggerInterface $logger = null) | |
| callable|false | [getController](#method_getController)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request) Returns the Controller instance associated with a Request. | from [ControllerResolver](../../../component/httpkernel/controller/controllerresolver#method_getController "Symfony\Component\HttpKernel\Controller\ControllerResolver") |
| callable | [createController](#method_createController)(string $controller) Returns a callable for the given controller. | |
| object | [instantiateController](#method_instantiateController)(string $class) Returns an instantiated controller. | |
Details
-------
###
\_\_construct(ContainerInterface $container, [ControllerNameParser](controllernameparser "Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser") $parser, LoggerInterface $logger = null)
#### Parameters
| | | |
| --- | --- | --- |
| ContainerInterface | $container | |
| [ControllerNameParser](controllernameparser "Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser") | $parser | |
| LoggerInterface | $logger | |
### callable|false
getController([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request)
Returns the Controller instance associated with a Request.
As several resolvers can exist for a single application, a resolver must return false when it is not able to determine the controller.
The resolver must only throw an exception when it should be able to load controller but cannot because of some errors made by the developer.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
#### Return Value
| | |
| --- | --- |
| callable|false | A PHP callable representing the Controller, or false if this resolver is not able to determine the controller |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If a controller was found based on the request but it is not callable |
### protected callable
createController(string $controller)
Returns a callable for the given controller.
#### Parameters
| | | |
| --- | --- | --- |
| string | $controller | A Controller string |
#### Return Value
| | |
| --- | --- |
| callable | A PHP callable |
### protected object
instantiateController(string $class)
Returns an instantiated controller.
#### Parameters
| | | |
| --- | --- | --- |
| string | $class | A class name |
#### Return Value
| | |
| --- | --- |
| object | |
symfony Controller Controller
===========
abstract class **Controller** implements [ContainerAwareInterface](../../../component/dependencyinjection/containerawareinterface "Symfony\Component\DependencyInjection\ContainerAwareInterface")
Controller is a simple implementation of a Controller.
It provides methods to common features needed in controllers.
Traits
------
| | |
| --- | --- |
| [ContainerAwareTrait](../../../component/dependencyinjection/containerawaretrait "Symfony\Component\DependencyInjection\ContainerAwareTrait") | ContainerAware trait. |
| [ControllerTrait](controllertrait "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") | Common features needed in controllers. |
Properties
----------
| | | | |
| --- | --- | --- | --- |
| ContainerInterface | $container | | from [ControllerTrait](controllertrait#property_container "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setContainer](#method_setContainer)([ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null) | from [ContainerAwareTrait](../../../component/dependencyinjection/containerawaretrait#method_setContainer "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| bool | [has](#method_has)(string $id) Returns true if the service id is defined. | from [ControllerTrait](controllertrait#method_has "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| object | [get](#method_get)(string $id) Gets a container service by its id. | from [ControllerTrait](controllertrait#method_get "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| string | [generateUrl](#method_generateUrl)(string $route, array $parameters = array(), int $referenceType = UrlGeneratorInterface::ABSOLUTE\_PATH) Generates a URL from the given parameters. | from [ControllerTrait](controllertrait#method_generateUrl "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [forward](#method_forward)(string $controller, array $path = array(), array $query = array()) Forwards the request to another controller. | from [ControllerTrait](controllertrait#method_forward "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | [redirect](#method_redirect)(string $url, int $status = 302) Returns a RedirectResponse to the given URL. | from [ControllerTrait](controllertrait#method_redirect "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | [redirectToRoute](#method_redirectToRoute)(string $route, array $parameters = array(), int $status = 302) Returns a RedirectResponse to the given route with the given parameters. | from [ControllerTrait](controllertrait#method_redirectToRoute "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [JsonResponse](../../../component/httpfoundation/jsonresponse "Symfony\Component\HttpFoundation\JsonResponse") | [json](#method_json)($data, int $status = 200, array $headers = array(), array $context = array()) Returns a JsonResponse that uses the serializer component if enabled, or json\_encode. | from [ControllerTrait](controllertrait#method_json "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [BinaryFileResponse](../../../component/httpfoundation/binaryfileresponse "Symfony\Component\HttpFoundation\BinaryFileResponse") | [file](#method_file)($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION\_ATTACHMENT) Returns a BinaryFileResponse object with original or customized file name and disposition header. | from [ControllerTrait](controllertrait#method_file "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| | [addFlash](#method_addFlash)(string $type, string $message) Adds a flash message to the current session for type. | from [ControllerTrait](controllertrait#method_addFlash "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| bool | [isGranted](#method_isGranted)($attributes, $subject = null) Checks if the attributes are granted against the current authentication token and optionally supplied subject. | from [ControllerTrait](controllertrait#method_isGranted "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| | [denyAccessUnlessGranted](#method_denyAccessUnlessGranted)($attributes, $subject = null, string $message = 'Access Denied.') Throws an exception unless the attributes are granted against the current authentication token and optionally supplied subject. | from [ControllerTrait](controllertrait#method_denyAccessUnlessGranted "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| string | [renderView](#method_renderView)(string $view, array $parameters = array()) Returns a rendered view. | from [ControllerTrait](controllertrait#method_renderView "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [render](#method_render)(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null) Renders a view. | from [ControllerTrait](controllertrait#method_render "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") | [stream](#method_stream)(string $view, array $parameters = array(), [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") $response = null) Streams a view. | from [ControllerTrait](controllertrait#method_stream "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | [createNotFoundException](#method_createNotFoundException)(string $message = 'Not Found', [Exception](http://php.net/Exception) $previous = null) Returns a NotFoundHttpException. | from [ControllerTrait](controllertrait#method_createNotFoundException "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException") | [createAccessDeniedException](#method_createAccessDeniedException)(string $message = 'Access Denied.', [Exception](http://php.net/Exception) $previous = null) Returns an AccessDeniedException. | from [ControllerTrait](controllertrait#method_createAccessDeniedException "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [FormInterface](../../../component/form/forminterface "Symfony\Component\Form\FormInterface") | [createForm](#method_createForm)(string $type, $data = null, array $options = array()) Creates and returns a Form instance from the type of the form. | from [ControllerTrait](controllertrait#method_createForm "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| [FormBuilderInterface](../../../component/form/formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createFormBuilder](#method_createFormBuilder)($data = null, array $options = array()) Creates and returns a form builder instance. | from [ControllerTrait](controllertrait#method_createFormBuilder "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| ManagerRegistry | [getDoctrine](#method_getDoctrine)() Shortcut to return the Doctrine Registry service. | from [ControllerTrait](controllertrait#method_getDoctrine "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| mixed | [getUser](#method_getUser)() Get a user from the Security Token Storage. | from [ControllerTrait](controllertrait#method_getUser "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| bool | [isCsrfTokenValid](#method_isCsrfTokenValid)(string $id, string|null $token) Checks the validity of a CSRF token. | from [ControllerTrait](controllertrait#method_isCsrfTokenValid "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| | [dispatchMessage](#method_dispatchMessage)(object $message) Dispatches a message to the bus. | from [ControllerTrait](controllertrait#method_dispatchMessage "Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait") |
| mixed | [getParameter](#method_getParameter)(string $name) Gets a container configuration parameter by its name. | |
Details
-------
###
setContainer([ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | |
### protected bool
has(string $id)
Returns true if the service id is defined.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | |
#### Return Value
| | |
| --- | --- |
| bool | |
### protected object
get(string $id)
Gets a container service by its id.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | |
#### Return Value
| | |
| --- | --- |
| object | The service |
### protected string
generateUrl(string $route, array $parameters = array(), int $referenceType = UrlGeneratorInterface::ABSOLUTE\_PATH)
Generates a URL from the given parameters.
#### Parameters
| | | |
| --- | --- | --- |
| string | $route | |
| array | $parameters | |
| int | $referenceType | |
#### Return Value
| | |
| --- | --- |
| string | |
#### See also
| | |
| --- | --- |
| [UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") | |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
forward(string $controller, array $path = array(), array $query = array())
Forwards the request to another controller.
#### Parameters
| | | |
| --- | --- | --- |
| string | $controller | |
| array | $path | |
| array | $query | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
### protected [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse")
redirect(string $url, int $status = 302)
Returns a RedirectResponse to the given URL.
#### Parameters
| | | |
| --- | --- | --- |
| string | $url | |
| int | $status | |
#### Return Value
| | |
| --- | --- |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | |
### protected [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse")
redirectToRoute(string $route, array $parameters = array(), int $status = 302)
Returns a RedirectResponse to the given route with the given parameters.
#### Parameters
| | | |
| --- | --- | --- |
| string | $route | |
| array | $parameters | |
| int | $status | |
#### Return Value
| | |
| --- | --- |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | |
### protected [JsonResponse](../../../component/httpfoundation/jsonresponse "Symfony\Component\HttpFoundation\JsonResponse")
json($data, int $status = 200, array $headers = array(), array $context = array())
Returns a JsonResponse that uses the serializer component if enabled, or json\_encode.
#### Parameters
| | | |
| --- | --- | --- |
| | $data | |
| int | $status | |
| array | $headers | |
| array | $context | |
#### Return Value
| | |
| --- | --- |
| [JsonResponse](../../../component/httpfoundation/jsonresponse "Symfony\Component\HttpFoundation\JsonResponse") | |
### protected [BinaryFileResponse](../../../component/httpfoundation/binaryfileresponse "Symfony\Component\HttpFoundation\BinaryFileResponse")
file($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION\_ATTACHMENT)
Returns a BinaryFileResponse object with original or customized file name and disposition header.
#### Parameters
| | | |
| --- | --- | --- |
| | $file | |
| string | $fileName | |
| string | $disposition | |
#### Return Value
| | |
| --- | --- |
| [BinaryFileResponse](../../../component/httpfoundation/binaryfileresponse "Symfony\Component\HttpFoundation\BinaryFileResponse") | |
### protected
addFlash(string $type, string $message)
Adds a flash message to the current session for type.
#### Parameters
| | | |
| --- | --- | --- |
| string | $type | |
| string | $message | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### protected bool
isGranted($attributes, $subject = null)
Checks if the attributes are granted against the current authentication token and optionally supplied subject.
#### Parameters
| | | |
| --- | --- | --- |
| | $attributes | |
| | $subject | |
#### Return Value
| | |
| --- | --- |
| bool | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### protected
denyAccessUnlessGranted($attributes, $subject = null, string $message = 'Access Denied.')
Throws an exception unless the attributes are granted against the current authentication token and optionally supplied subject.
#### Parameters
| | | |
| --- | --- | --- |
| | $attributes | |
| | $subject | |
| string | $message | |
#### Exceptions
| | |
| --- | --- |
| [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException") | |
### protected string
renderView(string $view, array $parameters = array())
Returns a rendered view.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | |
| array | $parameters | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
render(string $view, array $parameters = array(), [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response = null)
Renders a view.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | |
| array | $parameters | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | |
### protected [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse")
stream(string $view, array $parameters = array(), [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") $response = null)
Streams a view.
#### Parameters
| | | |
| --- | --- | --- |
| string | $view | |
| array | $parameters | |
| [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") | $response | |
#### Return Value
| | |
| --- | --- |
| [StreamedResponse](../../../component/httpfoundation/streamedresponse "Symfony\Component\HttpFoundation\StreamedResponse") | |
### protected [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException")
createNotFoundException(string $message = 'Not Found', [Exception](http://php.net/Exception) $previous = null)
Returns a NotFoundHttpException.
This will result in a 404 response code. Usage example:
```
throw $this->createNotFoundException('Page not found!');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $message | |
| [Exception](http://php.net/Exception) | $previous | |
#### Return Value
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### protected [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException")
createAccessDeniedException(string $message = 'Access Denied.', [Exception](http://php.net/Exception) $previous = null)
Returns an AccessDeniedException.
This will result in a 403 response code. Usage example:
```
throw $this->createAccessDeniedException('Unable to access this page!');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $message | |
| [Exception](http://php.net/Exception) | $previous | |
#### Return Value
| | |
| --- | --- |
| [AccessDeniedException](../../../component/security/core/exception/accessdeniedexception "Symfony\Component\Security\Core\Exception\AccessDeniedException") | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If the Security component is not available |
### protected [FormInterface](../../../component/form/forminterface "Symfony\Component\Form\FormInterface")
createForm(string $type, $data = null, array $options = array())
Creates and returns a Form instance from the type of the form.
#### Parameters
| | | |
| --- | --- | --- |
| string | $type | |
| | $data | |
| array | $options | |
#### Return Value
| | |
| --- | --- |
| [FormInterface](../../../component/form/forminterface "Symfony\Component\Form\FormInterface") | |
### protected [FormBuilderInterface](../../../component/form/formbuilderinterface "Symfony\Component\Form\FormBuilderInterface")
createFormBuilder($data = null, array $options = array())
Creates and returns a form builder instance.
#### Parameters
| | | |
| --- | --- | --- |
| | $data | |
| array | $options | |
#### Return Value
| | |
| --- | --- |
| [FormBuilderInterface](../../../component/form/formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | |
### protected ManagerRegistry
getDoctrine()
Shortcut to return the Doctrine Registry service.
#### Return Value
| | |
| --- | --- |
| ManagerRegistry | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If DoctrineBundle is not available |
### protected mixed
getUser()
Get a user from the Security Token Storage.
#### Return Value
| | |
| --- | --- |
| mixed | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | If SecurityBundle is not available |
#### See also
| | |
| --- | --- |
| TokenInterface::getUser() | |
### protected bool
isCsrfTokenValid(string $id, string|null $token)
Checks the validity of a CSRF token.
#### Parameters
| | | |
| --- | --- | --- |
| string | $id | The id used when generating the token |
| string|null | $token | The actual token sent with the request that should be validated |
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
dispatchMessage(object $message)
Dispatches a message to the bus.
#### Parameters
| | | |
| --- | --- | --- |
| object | $message | The message to dispatch |
### protected mixed
getParameter(string $name)
Gets a container configuration parameter by its name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | |
#### Return Value
| | |
| --- | --- |
| mixed | |
| programming_docs |
symfony HttpCache HttpCache
==========
class **HttpCache** extends [HttpCache](../../../component/httpkernel/httpcache/httpcache "Symfony\Component\HttpKernel\HttpCache\HttpCache")
Manages HTTP cache objects in a Container.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $cacheDir | | |
| protected | $kernel | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([HttpKernelInterface](../../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") $kernel, string $cacheDir = null) | |
| [StoreInterface](../../../component/httpkernel/httpcache/storeinterface "Symfony\Component\HttpKernel\HttpCache\StoreInterface") | [getStore](#method_getStore)() Gets the current store. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_getStore "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| array | [getTraces](#method_getTraces)() Returns an array of events that took place during processing of the last request. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_getTraces "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| string | [getLog](#method_getLog)() Returns a log message for the events of the last request processing. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_getLog "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | [getRequest](#method_getRequest)() Gets the Request instance associated with the master request. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_getRequest "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| [HttpKernelInterface](../../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") | [getKernel](#method_getKernel)() Gets the Kernel instance. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_getKernel "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| [SurrogateInterface](../../../component/httpkernel/httpcache/surrogateinterface "Symfony\Component\HttpKernel\HttpCache\SurrogateInterface") | [getSurrogate](#method_getSurrogate)() Gets the Surrogate instance. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_getSurrogate "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [handle](#method_handle)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, int $type = HttpKernelInterface::MASTER\_REQUEST, bool $catch = true) Handles a Request to convert it to a Response. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_handle "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| | [terminate](#method_terminate)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response) Terminates a request/response cycle. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_terminate "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [pass](#method_pass)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, bool $catch = false) Forwards the Request to the backend without storing the Response in the cache. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_pass "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [invalidate](#method_invalidate)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, bool $catch = false) Invalidates non-safe methods (like POST, PUT, and DELETE). | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_invalidate "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [lookup](#method_lookup)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, bool $catch = false) Lookups a Response from the cache for the given Request. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_lookup "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [validate](#method_validate)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $entry, bool $catch = false) Validates that a cache entry is fresh. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_validate "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [fetch](#method_fetch)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, bool $catch = false) Unconditionally fetches a fresh response from the backend and stores it in the cache if is cacheable. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_fetch "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [forward](#method_forward)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, bool $raw = false, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $entry = null) Forwards the Request to the backend and returns the Response. | |
| bool | [isFreshEnough](#method_isFreshEnough)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $entry) Checks whether the cache entry is "fresh enough" to satisfy the Request. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_isFreshEnough "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| bool | [lock](#method_lock)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $entry) Locks a Request during the call to the backend. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_lock "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| | [store](#method_store)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response) Writes the Response to the cache. | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_store "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| | [processResponseBody](#method_processResponseBody)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response) | from [HttpCache](../../../component/httpkernel/httpcache/httpcache#method_processResponseBody "Symfony\Component\HttpKernel\HttpCache\HttpCache") |
| array | [getOptions](#method_getOptions)() Returns an array of options to customize the Cache configuration. | |
| | [createSurrogate](#method_createSurrogate)() | |
| | [createStore](#method_createStore)() | |
Details
-------
###
\_\_construct([HttpKernelInterface](../../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") $kernel, string $cacheDir = null)
#### Parameters
| | | |
| --- | --- | --- |
| [HttpKernelInterface](../../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") | $kernel | |
| string | $cacheDir | The cache directory (default used if null) |
### [StoreInterface](../../../component/httpkernel/httpcache/storeinterface "Symfony\Component\HttpKernel\HttpCache\StoreInterface")
getStore()
Gets the current store.
#### Return Value
| | |
| --- | --- |
| [StoreInterface](../../../component/httpkernel/httpcache/storeinterface "Symfony\Component\HttpKernel\HttpCache\StoreInterface") | $store A StoreInterface instance |
### array
getTraces()
Returns an array of events that took place during processing of the last request.
#### Return Value
| | |
| --- | --- |
| array | An array of events |
### string
getLog()
Returns a log message for the events of the last request processing.
#### Return Value
| | |
| --- | --- |
| string | A log message |
### [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request")
getRequest()
Gets the Request instance associated with the master request.
#### Return Value
| | |
| --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | A Request instance |
### [HttpKernelInterface](../../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface")
getKernel()
Gets the Kernel instance.
#### Return Value
| | |
| --- | --- |
| [HttpKernelInterface](../../../component/httpkernel/httpkernelinterface "Symfony\Component\HttpKernel\HttpKernelInterface") | An HttpKernelInterface instance |
### [SurrogateInterface](../../../component/httpkernel/httpcache/surrogateinterface "Symfony\Component\HttpKernel\HttpCache\SurrogateInterface")
getSurrogate()
Gets the Surrogate instance.
#### Return Value
| | |
| --- | --- |
| [SurrogateInterface](../../../component/httpkernel/httpcache/surrogateinterface "Symfony\Component\HttpKernel\HttpCache\SurrogateInterface") | A Surrogate instance |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
handle([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, int $type = HttpKernelInterface::MASTER\_REQUEST, bool $catch = true)
Handles a Request to convert it to a Response.
When $catch is true, the implementation must catch all exceptions and do its best to convert them to a Response instance.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | A Request instance |
| int | $type | The type of the request (one of HttpKernelInterface::MASTER\_REQUEST or HttpKernelInterface::SUB\_REQUEST) |
| bool | $catch | Whether to catch exceptions or not |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When an Exception occurs during processing |
###
terminate([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response)
Terminates a request/response cycle.
Should be called after sending the response and before shutting down the kernel.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
pass([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, bool $catch = false)
Forwards the Request to the backend without storing the Response in the cache.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | A Request instance |
| bool | $catch | Whether to process exceptions |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
invalidate([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, bool $catch = false)
Invalidates non-safe methods (like POST, PUT, and DELETE).
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | A Request instance |
| bool | $catch | Whether to process exceptions |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | |
#### See also
| | |
| --- | --- |
| RFC2616 | 13.10 |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
lookup([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, bool $catch = false)
Lookups a Response from the cache for the given Request.
When a matching cache entry is found and is fresh, it uses it as the response without forwarding any request to the backend. When a matching cache entry is found but is stale, it attempts to "validate" the entry with the backend using conditional GET. When no matching cache entry is found, it triggers "miss" processing.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | A Request instance |
| bool | $catch | Whether to process exceptions |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
validate([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $entry, bool $catch = false)
Validates that a cache entry is fresh.
The original request is used as a template for a conditional GET request with the backend.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | A Request instance |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $entry | A Response instance to validate |
| bool | $catch | Whether to process exceptions |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
fetch([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, bool $catch = false)
Unconditionally fetches a fresh response from the backend and stores it in the cache if is cacheable.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | A Request instance |
| bool | $catch | Whether to process exceptions |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
### protected [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
forward([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, bool $raw = false, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $entry = null)
Forwards the Request to the backend and returns the Response.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | A Request instance |
| bool | $raw | Whether to catch exceptions or not |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $entry | A Response instance (the stale entry if present, null otherwise) |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
### protected bool
isFreshEnough([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $entry)
Checks whether the cache entry is "fresh enough" to satisfy the Request.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $entry | |
#### Return Value
| | |
| --- | --- |
| bool | true if the cache entry if fresh enough, false otherwise |
### protected bool
lock([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $entry)
Locks a Request during the call to the backend.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $entry | |
#### Return Value
| | |
| --- | --- |
| bool | true if the cache entry can be returned even if it is staled, false otherwise |
### protected
store([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response)
Writes the Response to the cache.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | |
### protected
processResponseBody([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response)
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | |
### protected array
getOptions()
Returns an array of options to customize the Cache configuration.
#### Return Value
| | |
| --- | --- |
| array | An array of options |
### protected
createSurrogate()
### protected
createStore()
| programming_docs |
symfony CachePoolClearCommand CachePoolClearCommand
======================
class **CachePoolClearCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Clear cache pools.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([Psr6CacheClearer](../../../component/httpkernel/cacheclearer/psr6cacheclearer "Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer") $poolClearer) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([Psr6CacheClearer](../../../component/httpkernel/cacheclearer/psr6cacheclearer "Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer") $poolClearer)
#### Parameters
| | | |
| --- | --- | --- |
| [Psr6CacheClearer](../../../component/httpkernel/cacheclearer/psr6cacheclearer "Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer") | $poolClearer | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony CacheClearCommand CacheClearCommand
==================
class **CacheClearCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Clear and Warmup the cache.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([CacheClearerInterface](../../../component/httpkernel/cacheclearer/cacheclearerinterface "Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface") $cacheClearer, [Filesystem](../../../component/filesystem/filesystem "Symfony\Component\Filesystem\Filesystem") $filesystem = null) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([CacheClearerInterface](../../../component/httpkernel/cacheclearer/cacheclearerinterface "Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface") $cacheClearer, [Filesystem](../../../component/filesystem/filesystem "Symfony\Component\Filesystem\Filesystem") $filesystem = null)
#### Parameters
| | | |
| --- | --- | --- |
| [CacheClearerInterface](../../../component/httpkernel/cacheclearer/cacheclearerinterface "Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface") | $cacheClearer | |
| [Filesystem](../../../component/filesystem/filesystem "Symfony\Component\Filesystem\Filesystem") | $filesystem | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony CachePoolPruneCommand CachePoolPruneCommand
======================
class **CachePoolPruneCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Cache pool pruner command.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(iterable $pools) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(iterable $pools)
#### Parameters
| | | |
| --- | --- | --- |
| iterable | $pools | |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony CacheWarmupCommand CacheWarmupCommand
===================
class **CacheWarmupCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Warmup the cache.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([CacheWarmerAggregate](../../../component/httpkernel/cachewarmer/cachewarmeraggregate "Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate") $cacheWarmer) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([CacheWarmerAggregate](../../../component/httpkernel/cachewarmer/cachewarmeraggregate "Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate") $cacheWarmer)
#### Parameters
| | | |
| --- | --- | --- |
| [CacheWarmerAggregate](../../../component/httpkernel/cachewarmer/cachewarmeraggregate "Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate") | $cacheWarmer | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony RouterDebugCommand RouterDebugCommand
===================
class **RouterDebugCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
A console command for retrieving information about routes.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([RouterInterface](../../../component/routing/routerinterface "Symfony\Component\Routing\RouterInterface") $router) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([RouterInterface](../../../component/routing/routerinterface "Symfony\Component\Routing\RouterInterface") $router)
#### Parameters
| | | |
| --- | --- | --- |
| [RouterInterface](../../../component/routing/routerinterface "Symfony\Component\Routing\RouterInterface") | $router | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony YamlLintCommand YamlLintCommand
================
class **YamlLintCommand** extends [LintCommand](../../../component/yaml/command/lintcommand "Symfony\Component\Yaml\Command\LintCommand")
Validates YAML files syntax and outputs encountered errors.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)() | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | from [LintCommand](../../../component/yaml/command/lintcommand#method_execute "Symfony\Component\Yaml\Command\LintCommand") |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct()
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony ContainerDebugCommand ContainerDebugCommand
======================
class **ContainerDebugCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
A console command for retrieving information about services.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
| protected [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder")|null | $containerBuilder | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
| | [validateInput](#method_validateInput)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input) Validates input arguments and options. | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | [getContainerBuilder](#method_getContainerBuilder)() Loads the ContainerBuilder from the cache. | |
| | [filterToServiceTypes](#method_filterToServiceTypes)($serviceId) | |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
### protected
validateInput([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input)
Validates input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
### protected [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder")
getContainerBuilder()
Loads the ContainerBuilder from the cache.
#### Return Value
| | |
| --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
###
filterToServiceTypes($serviceId)
#### Parameters
| | | |
| --- | --- | --- |
| | $serviceId | |
| programming_docs |
symfony DebugAutowiringCommand DebugAutowiringCommand
=======================
class **DebugAutowiringCommand** extends [ContainerDebugCommand](containerdebugcommand "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand")
A console command for autowiring information.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
| protected [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder")|null | $containerBuilder | | from [ContainerDebugCommand](containerdebugcommand#property_containerBuilder "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
| | [validateInput](#method_validateInput)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input) Validates input arguments and options. | from [ContainerDebugCommand](containerdebugcommand#method_validateInput "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | [getContainerBuilder](#method_getContainerBuilder)() Loads the ContainerBuilder from the cache. | from [ContainerDebugCommand](containerdebugcommand#method_getContainerBuilder "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| | [filterToServiceTypes](#method_filterToServiceTypes)($serviceId) | from [ContainerDebugCommand](containerdebugcommand#method_filterToServiceTypes "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
### protected
validateInput([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input)
Validates input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
### protected [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder")
getContainerBuilder()
Loads the ContainerBuilder from the cache.
#### Return Value
| | |
| --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
###
filterToServiceTypes($serviceId)
#### Parameters
| | | |
| --- | --- | --- |
| | $serviceId | |
| programming_docs |
symfony XliffLintCommand XliffLintCommand
=================
class **XliffLintCommand** extends [XliffLintCommand](../../../component/translation/command/xlifflintcommand "Symfony\Component\Translation\Command\XliffLintCommand")
Validates XLIFF files syntax and outputs encountered errors.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)() | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | from [XliffLintCommand](../../../component/translation/command/xlifflintcommand#method_execute "Symfony\Component\Translation\Command\XliffLintCommand") |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct()
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony ConfigDebugCommand ConfigDebugCommand
===================
class **ConfigDebugCommand** extends [AbstractConfigCommand](abstractconfigcommand "Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand")
A console command for dumping available configuration reference.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
| protected [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder")|null | $containerBuilder | | from [ContainerDebugCommand](containerdebugcommand#property_containerBuilder "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
| | [validateInput](#method_validateInput)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input) Validates input arguments and options. | from [ContainerDebugCommand](containerdebugcommand#method_validateInput "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | [getContainerBuilder](#method_getContainerBuilder)() Loads the ContainerBuilder from the cache. | from [ContainerDebugCommand](containerdebugcommand#method_getContainerBuilder "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| | [filterToServiceTypes](#method_filterToServiceTypes)($serviceId) | from [ContainerDebugCommand](containerdebugcommand#method_filterToServiceTypes "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| | [listBundles](#method_listBundles)($output) | from [AbstractConfigCommand](abstractconfigcommand#method_listBundles "Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand") |
| | [findExtension](#method_findExtension)($name) | from [AbstractConfigCommand](abstractconfigcommand#method_findExtension "Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand") |
| | [validateConfiguration](#method_validateConfiguration)([ExtensionInterface](../../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface") $extension, $configuration) | from [AbstractConfigCommand](abstractconfigcommand#method_validateConfiguration "Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
### protected
validateInput([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input)
Validates input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
### protected [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder")
getContainerBuilder()
Loads the ContainerBuilder from the cache.
#### Return Value
| | |
| --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
###
filterToServiceTypes($serviceId)
#### Parameters
| | | |
| --- | --- | --- |
| | $serviceId | |
### protected
listBundles($output)
#### Parameters
| | | |
| --- | --- | --- |
| | $output | |
### protected
findExtension($name)
#### Parameters
| | | |
| --- | --- | --- |
| | $name | |
###
validateConfiguration([ExtensionInterface](../../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface") $extension, $configuration)
#### Parameters
| | | |
| --- | --- | --- |
| [ExtensionInterface](../../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface") | $extension | |
| | $configuration | |
| programming_docs |
symfony ContainerAwareCommand ContainerAwareCommand
======================
abstract class **ContainerAwareCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") implements [ContainerAwareInterface](../../../component/dependencyinjection/containerawareinterface "Symfony\Component\DependencyInjection\ContainerAwareInterface")
Command.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected string|null | $defaultName | | from [Command](../../../component/console/command/command#property_defaultName "Symfony\Component\Console\Command\Command") |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | from [Command](../../../component/console/command/command#method_configure "Symfony\Component\Console\Command\Command") |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | from [Command](../../../component/console/command/command#method_execute "Symfony\Component\Console\Command\Command") |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
| [ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | [getContainer](#method_getContainer)() | |
| | [setContainer](#method_setContainer)([ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null) Sets the container. | |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
#### See also
| | |
| --- | --- |
| setCode() | |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
### protected [ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface")
getContainer()
#### Return Value
| | |
| --- | --- |
| [ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
###
setContainer([ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null)
Sets the container.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerInterface](../../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | |
| programming_docs |
symfony ConfigDumpReferenceCommand ConfigDumpReferenceCommand
===========================
class **ConfigDumpReferenceCommand** extends [AbstractConfigCommand](abstractconfigcommand "Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand")
A console command for dumping available configuration reference.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
| protected [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder")|null | $containerBuilder | | from [ContainerDebugCommand](containerdebugcommand#property_containerBuilder "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
| | [validateInput](#method_validateInput)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input) Validates input arguments and options. | from [ContainerDebugCommand](containerdebugcommand#method_validateInput "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | [getContainerBuilder](#method_getContainerBuilder)() Loads the ContainerBuilder from the cache. | from [ContainerDebugCommand](containerdebugcommand#method_getContainerBuilder "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| | [filterToServiceTypes](#method_filterToServiceTypes)($serviceId) | from [ContainerDebugCommand](containerdebugcommand#method_filterToServiceTypes "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| | [listBundles](#method_listBundles)($output) | from [AbstractConfigCommand](abstractconfigcommand#method_listBundles "Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand") |
| | [findExtension](#method_findExtension)($name) | from [AbstractConfigCommand](abstractconfigcommand#method_findExtension "Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand") |
| | [validateConfiguration](#method_validateConfiguration)([ExtensionInterface](../../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface") $extension, $configuration) | from [AbstractConfigCommand](abstractconfigcommand#method_validateConfiguration "Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
### protected
validateInput([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input)
Validates input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
### protected [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder")
getContainerBuilder()
Loads the ContainerBuilder from the cache.
#### Return Value
| | |
| --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
###
filterToServiceTypes($serviceId)
#### Parameters
| | | |
| --- | --- | --- |
| | $serviceId | |
### protected
listBundles($output)
#### Parameters
| | | |
| --- | --- | --- |
| | $output | |
### protected
findExtension($name)
#### Parameters
| | | |
| --- | --- | --- |
| | $name | |
###
validateConfiguration([ExtensionInterface](../../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface") $extension, $configuration)
#### Parameters
| | | |
| --- | --- | --- |
| [ExtensionInterface](../../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface") | $extension | |
| | $configuration | |
| programming_docs |
symfony AboutCommand AboutCommand
=============
class **AboutCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
A console command to display information about the current installation.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony AssetsInstallCommand AssetsInstallCommand
=====================
class **AssetsInstallCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Command that places bundle web assets into a given directory.
Constants
---------
| | |
| --- | --- |
| METHOD\_COPY | |
| METHOD\_ABSOLUTE\_SYMLINK | |
| METHOD\_RELATIVE\_SYMLINK | |
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([Filesystem](../../../component/filesystem/filesystem "Symfony\Component\Filesystem\Filesystem") $filesystem) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([Filesystem](../../../component/filesystem/filesystem "Symfony\Component\Filesystem\Filesystem") $filesystem)
#### Parameters
| | | |
| --- | --- | --- |
| [Filesystem](../../../component/filesystem/filesystem "Symfony\Component\Filesystem\Filesystem") | $filesystem | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony EventDispatcherDebugCommand EventDispatcherDebugCommand
============================
class **EventDispatcherDebugCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
A console command for retrieving information about event dispatcher.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher)
#### Parameters
| | | |
| --- | --- | --- |
| [EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $dispatcher | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony TranslationUpdateCommand TranslationUpdateCommand
=========================
class **TranslationUpdateCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
A command that parses templates to extract translation messages and adds them into the translation files.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([TranslationWriterInterface](../../../component/translation/writer/translationwriterinterface "Symfony\Component\Translation\Writer\TranslationWriterInterface") $writer, [TranslationReaderInterface](../../../component/translation/reader/translationreaderinterface "Symfony\Component\Translation\Reader\TranslationReaderInterface") $reader, [ExtractorInterface](../../../component/translation/extractor/extractorinterface "Symfony\Component\Translation\Extractor\ExtractorInterface") $extractor, string $defaultLocale, string $defaultTransPath = null, string $defaultViewsPath = null) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([TranslationWriterInterface](../../../component/translation/writer/translationwriterinterface "Symfony\Component\Translation\Writer\TranslationWriterInterface") $writer, [TranslationReaderInterface](../../../component/translation/reader/translationreaderinterface "Symfony\Component\Translation\Reader\TranslationReaderInterface") $reader, [ExtractorInterface](../../../component/translation/extractor/extractorinterface "Symfony\Component\Translation\Extractor\ExtractorInterface") $extractor, string $defaultLocale, string $defaultTransPath = null, string $defaultViewsPath = null)
#### Parameters
| | | |
| --- | --- | --- |
| [TranslationWriterInterface](../../../component/translation/writer/translationwriterinterface "Symfony\Component\Translation\Writer\TranslationWriterInterface") | $writer | |
| [TranslationReaderInterface](../../../component/translation/reader/translationreaderinterface "Symfony\Component\Translation\Reader\TranslationReaderInterface") | $reader | |
| [ExtractorInterface](../../../component/translation/extractor/extractorinterface "Symfony\Component\Translation\Extractor\ExtractorInterface") | $extractor | |
| string | $defaultLocale | |
| string | $defaultTransPath | |
| string | $defaultViewsPath | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony AbstractConfigCommand AbstractConfigCommand
======================
abstract class **AbstractConfigCommand** extends [ContainerDebugCommand](containerdebugcommand "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand")
A console command for dumping available configuration reference.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | from [ContainerDebugCommand](containerdebugcommand#property_defaultName "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| protected [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder")|null | $containerBuilder | | from [ContainerDebugCommand](containerdebugcommand#property_containerBuilder "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | from [ContainerDebugCommand](containerdebugcommand#method_configure "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | from [ContainerDebugCommand](containerdebugcommand#method_execute "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
| | [validateInput](#method_validateInput)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input) Validates input arguments and options. | from [ContainerDebugCommand](containerdebugcommand#method_validateInput "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | [getContainerBuilder](#method_getContainerBuilder)() Loads the ContainerBuilder from the cache. | from [ContainerDebugCommand](containerdebugcommand#method_getContainerBuilder "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| | [filterToServiceTypes](#method_filterToServiceTypes)($serviceId) | from [ContainerDebugCommand](containerdebugcommand#method_filterToServiceTypes "Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand") |
| | [listBundles](#method_listBundles)($output) | |
| | [findExtension](#method_findExtension)($name) | |
| | [validateConfiguration](#method_validateConfiguration)([ExtensionInterface](../../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface") $extension, $configuration) | |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
### protected
validateInput([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input)
Validates input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
### protected [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder")
getContainerBuilder()
Loads the ContainerBuilder from the cache.
#### Return Value
| | |
| --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
###
filterToServiceTypes($serviceId)
#### Parameters
| | | |
| --- | --- | --- |
| | $serviceId | |
### protected
listBundles($output)
#### Parameters
| | | |
| --- | --- | --- |
| | $output | |
### protected
findExtension($name)
#### Parameters
| | | |
| --- | --- | --- |
| | $name | |
###
validateConfiguration([ExtensionInterface](../../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface") $extension, $configuration)
#### Parameters
| | | |
| --- | --- | --- |
| [ExtensionInterface](../../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface") | $extension | |
| | $configuration | |
| programming_docs |
symfony RouterMatchCommand RouterMatchCommand
===================
class **RouterMatchCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
A console command to test route matching.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([RouterInterface](../../../component/routing/routerinterface "Symfony\Component\Routing\RouterInterface") $router) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([RouterInterface](../../../component/routing/routerinterface "Symfony\Component\Routing\RouterInterface") $router)
#### Parameters
| | | |
| --- | --- | --- |
| [RouterInterface](../../../component/routing/routerinterface "Symfony\Component\Routing\RouterInterface") | $router | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony CachePoolDeleteCommand CachePoolDeleteCommand
=======================
class **CachePoolDeleteCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Delete an item from a cache pool.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([Psr6CacheClearer](../../../component/httpkernel/cacheclearer/psr6cacheclearer "Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer") $poolClearer) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([Psr6CacheClearer](../../../component/httpkernel/cacheclearer/psr6cacheclearer "Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer") $poolClearer)
#### Parameters
| | | |
| --- | --- | --- |
| [Psr6CacheClearer](../../../component/httpkernel/cacheclearer/psr6cacheclearer "Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer") | $poolClearer | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony TranslationDebugCommand TranslationDebugCommand
========================
class **TranslationDebugCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Helps finding unused or missing translation messages in a given locale and comparing them with the fallback ones.
Constants
---------
| | |
| --- | --- |
| MESSAGE\_MISSING | |
| MESSAGE\_UNUSED | |
| MESSAGE\_EQUALS\_FALLBACK | |
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([TranslatorInterface](../../../component/translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator, [TranslationReaderInterface](../../../component/translation/reader/translationreaderinterface "Symfony\Component\Translation\Reader\TranslationReaderInterface") $reader, [ExtractorInterface](../../../component/translation/extractor/extractorinterface "Symfony\Component\Translation\Extractor\ExtractorInterface") $extractor, string $defaultTransPath = null, string $defaultViewsPath = null) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([TranslatorInterface](../../../component/translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator, [TranslationReaderInterface](../../../component/translation/reader/translationreaderinterface "Symfony\Component\Translation\Reader\TranslationReaderInterface") $reader, [ExtractorInterface](../../../component/translation/extractor/extractorinterface "Symfony\Component\Translation\Extractor\ExtractorInterface") $extractor, string $defaultTransPath = null, string $defaultViewsPath = null)
#### Parameters
| | | |
| --- | --- | --- |
| [TranslatorInterface](../../../component/translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | |
| [TranslationReaderInterface](../../../component/translation/reader/translationreaderinterface "Symfony\Component\Translation\Reader\TranslationReaderInterface") | $reader | |
| [ExtractorInterface](../../../component/translation/extractor/extractorinterface "Symfony\Component\Translation\Extractor\ExtractorInterface") | $extractor | |
| string | $defaultTransPath | |
| string | $defaultViewsPath | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony WorkflowDumpCommand WorkflowDumpCommand
====================
class **WorkflowDumpCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected | $defaultName | | |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)(string $name = null) | from [Command](../../../component/console/command/command#method___construct "Symfony\Component\Console\Command\Command") |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct(string $name = null)
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the command; passing null means it must be set in configure() |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony Router Router
=======
class **Router** extends [Router](../../../component/routing/router "Symfony\Component\Routing\Router") implements [WarmableInterface](../../../component/httpkernel/cachewarmer/warmableinterface "Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface"), [ServiceSubscriberInterface](../../../component/dependencyinjection/servicesubscriberinterface "Symfony\Component\DependencyInjection\ServiceSubscriberInterface")
This Router creates the Loader only when the cache is empty.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [UrlMatcherInterface](../../../component/routing/matcher/urlmatcherinterface "Symfony\Component\Routing\Matcher\UrlMatcherInterface")|null | $matcher | | from [Router](../../../component/routing/router#property_matcher "Symfony\Component\Routing\Router") |
| protected [UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface")|null | $generator | | from [Router](../../../component/routing/router#property_generator "Symfony\Component\Routing\Router") |
| protected [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") | $context | | from [Router](../../../component/routing/router#property_context "Symfony\Component\Routing\Router") |
| protected [LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") | $loader | | from [Router](../../../component/routing/router#property_loader "Symfony\Component\Routing\Router") |
| protected [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection")|null | $collection | | from [Router](../../../component/routing/router#property_collection "Symfony\Component\Routing\Router") |
| protected mixed | $resource | | from [Router](../../../component/routing/router#property_resource "Symfony\Component\Routing\Router") |
| protected array | $options | | from [Router](../../../component/routing/router#property_options "Symfony\Component\Routing\Router") |
| protected LoggerInterface|null | $logger | | from [Router](../../../component/routing/router#property_logger "Symfony\Component\Routing\Router") |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(ContainerInterface $container, mixed $resource, array $options = array(), [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") $context = null, ContainerInterface $parameters = null, LoggerInterface $logger = null) | |
| | [setOptions](#method_setOptions)(array $options) Sets options. | from [Router](../../../component/routing/router#method_setOptions "Symfony\Component\Routing\Router") |
| | [setOption](#method_setOption)(string $key, mixed $value) Sets an option. | from [Router](../../../component/routing/router#method_setOption "Symfony\Component\Routing\Router") |
| mixed | [getOption](#method_getOption)(string $key) Gets an option value. | from [Router](../../../component/routing/router#method_getOption "Symfony\Component\Routing\Router") |
| [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | [getRouteCollection](#method_getRouteCollection)() Gets the RouteCollection instance associated with this Router. | |
| | [setContext](#method_setContext)([RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") $context) Sets the request context. | from [Router](../../../component/routing/router#method_setContext "Symfony\Component\Routing\Router") |
| [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") | [getContext](#method_getContext)() Gets the request context. | from [Router](../../../component/routing/router#method_getContext "Symfony\Component\Routing\Router") |
| | [setConfigCacheFactory](#method_setConfigCacheFactory)([ConfigCacheFactoryInterface](../../../component/config/configcachefactoryinterface "Symfony\Component\Config\ConfigCacheFactoryInterface") $configCacheFactory) Sets the ConfigCache factory to use. | from [Router](../../../component/routing/router#method_setConfigCacheFactory "Symfony\Component\Routing\Router") |
| string | [generate](#method_generate)(string $name, mixed $parameters = array(), int $referenceType = self::ABSOLUTE\_PATH) Generates a URL or path for a specific route based on the given parameters. | from [Router](../../../component/routing/router#method_generate "Symfony\Component\Routing\Router") |
| array | [match](#method_match)(string $pathinfo) Tries to match a URL path with a set of routes. | from [Router](../../../component/routing/router#method_match "Symfony\Component\Routing\Router") |
| array | [matchRequest](#method_matchRequest)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request) Tries to match a request with a set of routes. | from [Router](../../../component/routing/router#method_matchRequest "Symfony\Component\Routing\Router") |
| [UrlMatcherInterface](../../../component/routing/matcher/urlmatcherinterface "Symfony\Component\Routing\Matcher\UrlMatcherInterface") | [getMatcher](#method_getMatcher)() Gets the UrlMatcher instance associated with this Router. | from [Router](../../../component/routing/router#method_getMatcher "Symfony\Component\Routing\Router") |
| [UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") | [getGenerator](#method_getGenerator)() Gets the UrlGenerator instance associated with this Router. | from [Router](../../../component/routing/router#method_getGenerator "Symfony\Component\Routing\Router") |
| | [addExpressionLanguageProvider](#method_addExpressionLanguageProvider)([ExpressionFunctionProviderInterface](../../../component/expressionlanguage/expressionfunctionproviderinterface "Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface") $provider) | from [Router](../../../component/routing/router#method_addExpressionLanguageProvider "Symfony\Component\Routing\Router") |
| [GeneratorDumperInterface](../../../component/routing/generator/dumper/generatordumperinterface "Symfony\Component\Routing\Generator\Dumper\GeneratorDumperInterface") | [getGeneratorDumperInstance](#method_getGeneratorDumperInstance)() | from [Router](../../../component/routing/router#method_getGeneratorDumperInstance "Symfony\Component\Routing\Router") |
| [MatcherDumperInterface](../../../component/routing/matcher/dumper/matcherdumperinterface "Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface") | [getMatcherDumperInstance](#method_getMatcherDumperInstance)() | from [Router](../../../component/routing/router#method_getMatcherDumperInstance "Symfony\Component\Routing\Router") |
| | [warmUp](#method_warmUp)(string $cacheDir) Warms up the cache. | |
| static array | [getSubscribedServices](#method_getSubscribedServices)() Returns an array of service types required by such instances, optionally keyed by the service names used internally. | |
Details
-------
###
\_\_construct(ContainerInterface $container, mixed $resource, array $options = array(), [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") $context = null, ContainerInterface $parameters = null, LoggerInterface $logger = null)
#### Parameters
| | | |
| --- | --- | --- |
| ContainerInterface | $container | A ContainerInterface instance |
| mixed | $resource | The main resource to load |
| array | $options | An array of options |
| [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") | $context | The context |
| ContainerInterface | $parameters | A ContainerInterface instance allowing to fetch parameters |
| LoggerInterface | $logger | A logger instance |
###
setOptions(array $options)
Sets options.
Available options:
* cache\_dir: The cache directory (or null to disable caching)
* debug: Whether to enable debugging or not (false by default)
* generator\_class: The name of a UrlGeneratorInterface implementation
* generator\_base\_class: The base class for the dumped generator class
* generator\_cache\_class: The class name for the dumped generator class
* generator\_dumper\_class: The name of a GeneratorDumperInterface implementation
* matcher\_class: The name of a UrlMatcherInterface implementation
* matcher\_base\_class: The base class for the dumped matcher class
* matcher\_dumper\_class: The class name for the dumped matcher class
* matcher\_cache\_class: The name of a MatcherDumperInterface implementation
* resource\_type: Type hint for the main resource (optional)
* strict\_requirements: Configure strict requirement checking for generators implementing ConfigurableRequirementsInterface (default is true)
#### Parameters
| | | |
| --- | --- | --- |
| array | $options | An array of options |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | When unsupported option is provided |
###
setOption(string $key, mixed $value)
Sets an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $key | The key |
| mixed | $value | The value |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
### mixed
getOption(string $key)
Gets an option value.
#### Parameters
| | | |
| --- | --- | --- |
| string | $key | The key |
#### Return Value
| | |
| --- | --- |
| mixed | The value |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | |
### [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection")
getRouteCollection()
Gets the RouteCollection instance associated with this Router.
#### Return Value
| | |
| --- | --- |
| [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | A RouteCollection instance |
###
setContext([RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") $context)
Sets the request context.
#### Parameters
| | | |
| --- | --- | --- |
| [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") | $context | |
### [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext")
getContext()
Gets the request context.
#### Return Value
| | |
| --- | --- |
| [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") | The context |
###
setConfigCacheFactory([ConfigCacheFactoryInterface](../../../component/config/configcachefactoryinterface "Symfony\Component\Config\ConfigCacheFactoryInterface") $configCacheFactory)
Sets the ConfigCache factory to use.
#### Parameters
| | | |
| --- | --- | --- |
| [ConfigCacheFactoryInterface](../../../component/config/configcachefactoryinterface "Symfony\Component\Config\ConfigCacheFactoryInterface") | $configCacheFactory | |
### string
generate(string $name, mixed $parameters = array(), int $referenceType = self::ABSOLUTE\_PATH)
Generates a URL or path for a specific route based on the given parameters.
Parameters that reference placeholders in the route pattern will substitute them in the path or host. Extra params are added as query string to the URL.
When the passed reference type cannot be generated for the route because it requires a different host or scheme than the current one, the method will return a more comprehensive reference that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE\_PATH but the route requires the https scheme whereas the current scheme is http, it will instead return an ABSOLUTE\_URL with the https scheme and the current host. This makes sure the generated URL matches the route in any case.
If there is no route with the given name, the generator must throw the RouteNotFoundException.
The special parameter \_fragment will be used as the document fragment suffixed to the final URL.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The name of the route |
| mixed | $parameters | An array of parameters |
| int | $referenceType | The type of reference to be generated (one of the constants) |
#### Return Value
| | |
| --- | --- |
| string | The generated URL |
#### Exceptions
| | |
| --- | --- |
| [RouteNotFoundException](../../../component/routing/exception/routenotfoundexception "Symfony\Component\Routing\Exception\RouteNotFoundException") | If the named route doesn't exist |
| [MissingMandatoryParametersException](../../../component/routing/exception/missingmandatoryparametersexception "Symfony\Component\Routing\Exception\MissingMandatoryParametersException") | When some parameters are missing that are mandatory for the route |
| [InvalidParameterException](../../../component/routing/exception/invalidparameterexception "Symfony\Component\Routing\Exception\InvalidParameterException") | When a parameter value for a placeholder is not correct because it does not match the requirement |
### array
match(string $pathinfo)
Tries to match a URL path with a set of routes.
If the matcher can not find information, it must throw one of the exceptions documented below.
#### Parameters
| | | |
| --- | --- | --- |
| string | $pathinfo | The path info to be parsed (raw format, i.e. not urldecoded) |
#### Return Value
| | |
| --- | --- |
| array | An array of parameters |
#### Exceptions
| | |
| --- | --- |
| [NoConfigurationException](../../../component/routing/exception/noconfigurationexception "Symfony\Component\Routing\Exception\NoConfigurationException") | If no routing configuration could be found |
| [ResourceNotFoundException](../../../component/routing/exception/resourcenotfoundexception "Symfony\Component\Routing\Exception\ResourceNotFoundException") | If the resource could not be found |
| [MethodNotAllowedException](../../../component/routing/exception/methodnotallowedexception "Symfony\Component\Routing\Exception\MethodNotAllowedException") | If the resource was found but the request method is not allowed |
### array
matchRequest([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request)
Tries to match a request with a set of routes.
If the matcher can not find information, it must throw one of the exceptions documented below.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
#### Return Value
| | |
| --- | --- |
| array | An array of parameters |
#### Exceptions
| | |
| --- | --- |
| [NoConfigurationException](../../../component/routing/exception/noconfigurationexception "Symfony\Component\Routing\Exception\NoConfigurationException") | If no routing configuration could be found |
| [ResourceNotFoundException](../../../component/routing/exception/resourcenotfoundexception "Symfony\Component\Routing\Exception\ResourceNotFoundException") | If no matching resource could be found |
| [MethodNotAllowedException](../../../component/routing/exception/methodnotallowedexception "Symfony\Component\Routing\Exception\MethodNotAllowedException") | If a matching resource was found but the request method is not allowed |
### [UrlMatcherInterface](../../../component/routing/matcher/urlmatcherinterface "Symfony\Component\Routing\Matcher\UrlMatcherInterface")
getMatcher()
Gets the UrlMatcher instance associated with this Router.
#### Return Value
| | |
| --- | --- |
| [UrlMatcherInterface](../../../component/routing/matcher/urlmatcherinterface "Symfony\Component\Routing\Matcher\UrlMatcherInterface") | A UrlMatcherInterface instance |
### [UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface")
getGenerator()
Gets the UrlGenerator instance associated with this Router.
#### Return Value
| | |
| --- | --- |
| [UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") | A UrlGeneratorInterface instance |
###
addExpressionLanguageProvider([ExpressionFunctionProviderInterface](../../../component/expressionlanguage/expressionfunctionproviderinterface "Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface") $provider)
#### Parameters
| | | |
| --- | --- | --- |
| [ExpressionFunctionProviderInterface](../../../component/expressionlanguage/expressionfunctionproviderinterface "Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface") | $provider | |
### protected [GeneratorDumperInterface](../../../component/routing/generator/dumper/generatordumperinterface "Symfony\Component\Routing\Generator\Dumper\GeneratorDumperInterface")
getGeneratorDumperInstance()
#### Return Value
| | |
| --- | --- |
| [GeneratorDumperInterface](../../../component/routing/generator/dumper/generatordumperinterface "Symfony\Component\Routing\Generator\Dumper\GeneratorDumperInterface") | |
### protected [MatcherDumperInterface](../../../component/routing/matcher/dumper/matcherdumperinterface "Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface")
getMatcherDumperInstance()
#### Return Value
| | |
| --- | --- |
| [MatcherDumperInterface](../../../component/routing/matcher/dumper/matcherdumperinterface "Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface") | |
###
warmUp(string $cacheDir)
Warms up the cache.
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheDir | The cache directory |
### static array
getSubscribedServices()
Returns an array of service types required by such instances, optionally keyed by the service names used internally.
For mandatory dependencies:
* array('logger' => 'Psr\Log\LoggerInterface') means the objects use the "logger" name internally to fetch a service which must implement Psr\Log\LoggerInterface.
* array('Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface')
otherwise:
* array('logger' => '?Psr\Log\LoggerInterface') denotes an optional dependency
* array('?Psr\Log\LoggerInterface') is a shortcut for
* array('Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface')
#### Return Value
| | |
| --- | --- |
| array | The required service types, optionally keyed by service names |
symfony DelegatingLoader DelegatingLoader
=================
class **DelegatingLoader** extends [DelegatingLoader](../../../component/config/loader/delegatingloader "Symfony\Component\Config\Loader\DelegatingLoader")
DelegatingLoader delegates route loading to other loaders using a loader resolver.
This implementation resolves the \_controller attribute from the short notation to the fully-qualified form (from a:b:c to class::method).
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $resolver | | from [Loader](../../../component/config/loader/loader#property_resolver "Symfony\Component\Config\Loader\Loader") |
| protected | $parser | | |
Methods
-------
| | | |
| --- | --- | --- |
| [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") | [getResolver](#method_getResolver)() Gets the loader resolver. | from [Loader](../../../component/config/loader/loader#method_getResolver "Symfony\Component\Config\Loader\Loader") |
| | [setResolver](#method_setResolver)([LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") $resolver) Sets the loader resolver. | from [Loader](../../../component/config/loader/loader#method_setResolver "Symfony\Component\Config\Loader\Loader") |
| mixed | [import](#method_import)(mixed $resource, string|null $type = null) Imports a resource. | from [Loader](../../../component/config/loader/loader#method_import "Symfony\Component\Config\Loader\Loader") |
| $this|[LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") | [resolve](#method_resolve)(mixed $resource, string|null $type = null) Finds a loader able to load an imported resource. | from [Loader](../../../component/config/loader/loader#method_resolve "Symfony\Component\Config\Loader\Loader") |
| | [\_\_construct](#method___construct)([ControllerNameParser](../controller/controllernameparser "Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser") $parser, [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") $resolver) | |
| | [load](#method_load)(mixed $resource, string|null $type = null) Loads a resource. | |
| bool | [supports](#method_supports)(mixed $resource, string|null $type = null) Returns whether this class supports the given resource. | from [DelegatingLoader](../../../component/config/loader/delegatingloader#method_supports "Symfony\Component\Config\Loader\DelegatingLoader") |
Details
-------
### [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface")
getResolver()
Gets the loader resolver.
#### Return Value
| | |
| --- | --- |
| [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") | A LoaderResolverInterface instance |
###
setResolver([LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") $resolver)
Sets the loader resolver.
#### Parameters
| | | |
| --- | --- | --- |
| [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") | $resolver | |
### mixed
import(mixed $resource, string|null $type = null)
Imports a resource.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $resource | A resource |
| string|null | $type | The resource type or null if unknown |
#### Return Value
| | |
| --- | --- |
| mixed | |
### $this|[LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface")
resolve(mixed $resource, string|null $type = null)
Finds a loader able to load an imported resource.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $resource | A resource |
| string|null | $type | The resource type or null if unknown |
#### Return Value
| | |
| --- | --- |
| $this|[LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") | |
#### Exceptions
| | |
| --- | --- |
| [FileLoaderLoadException](../../../component/config/exception/fileloaderloadexception "Symfony\Component\Config\Exception\FileLoaderLoadException") | If no loader is found |
###
\_\_construct([ControllerNameParser](../controller/controllernameparser "Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser") $parser, [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") $resolver)
#### Parameters
| | | |
| --- | --- | --- |
| [ControllerNameParser](../controller/controllernameparser "Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser") | $parser | A ControllerNameParser instance |
| [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") | $resolver | |
###
load(mixed $resource, string|null $type = null)
Loads a resource.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $resource | The resource |
| string|null | $type | The resource type or null if unknown |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | If something went wrong |
### bool
supports(mixed $resource, string|null $type = null)
Returns whether this class supports the given resource.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $resource | A resource |
| string|null | $type | The resource type or null if unknown |
#### Return Value
| | |
| --- | --- |
| bool | True if this class supports the given resource, false otherwise |
| programming_docs |
symfony RedirectableUrlMatcher RedirectableUrlMatcher
=======================
class **RedirectableUrlMatcher** extends [RedirectableUrlMatcher](../../../component/routing/matcher/redirectableurlmatcher "Symfony\Component\Routing\Matcher\RedirectableUrlMatcher")
Constants
---------
| | |
| --- | --- |
| REQUIREMENT\_MATCH | |
| REQUIREMENT\_MISMATCH | |
| ROUTE\_MATCH | |
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $context | | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#property_context "Symfony\Component\Routing\Matcher\UrlMatcher") |
| protected | $allow | Collects HTTP methods that would be allowed for the request. | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#property_allow "Symfony\Component\Routing\Matcher\UrlMatcher") |
| protected | $allowSchemes | Collects URI schemes that would be allowed for the request. | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#property_allowSchemes "Symfony\Component\Routing\Matcher\UrlMatcher") |
| protected | $routes | | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#property_routes "Symfony\Component\Routing\Matcher\UrlMatcher") |
| protected | $request | | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#property_request "Symfony\Component\Routing\Matcher\UrlMatcher") |
| protected | $expressionLanguage | | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#property_expressionLanguage "Symfony\Component\Routing\Matcher\UrlMatcher") |
| protected [ExpressionFunctionProviderInterface](../../../component/expressionlanguage/expressionfunctionproviderinterface "Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface")[] | $expressionLanguageProviders | | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#property_expressionLanguageProviders "Symfony\Component\Routing\Matcher\UrlMatcher") |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") $context) | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method___construct "Symfony\Component\Routing\Matcher\UrlMatcher") |
| | [setContext](#method_setContext)([RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") $context) Sets the request context. | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method_setContext "Symfony\Component\Routing\Matcher\UrlMatcher") |
| [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") | [getContext](#method_getContext)() Gets the request context. | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method_getContext "Symfony\Component\Routing\Matcher\UrlMatcher") |
| array | [match](#method_match)(string $pathinfo) Tries to match a URL path with a set of routes. | from [RedirectableUrlMatcher](../../../component/routing/matcher/redirectableurlmatcher#method_match "Symfony\Component\Routing\Matcher\RedirectableUrlMatcher") |
| array | [matchRequest](#method_matchRequest)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request) Tries to match a request with a set of routes. | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method_matchRequest "Symfony\Component\Routing\Matcher\UrlMatcher") |
| | [addExpressionLanguageProvider](#method_addExpressionLanguageProvider)([ExpressionFunctionProviderInterface](../../../component/expressionlanguage/expressionfunctionproviderinterface "Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface") $provider) | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method_addExpressionLanguageProvider "Symfony\Component\Routing\Matcher\UrlMatcher") |
| array | [matchCollection](#method_matchCollection)(string $pathinfo, [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes) Tries to match a URL with a set of routes. | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method_matchCollection "Symfony\Component\Routing\Matcher\UrlMatcher") |
| array | [getAttributes](#method_getAttributes)([Route](../../../component/routing/route "Symfony\Component\Routing\Route") $route, string $name, array $attributes) Returns an array of values to use as request attributes. | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method_getAttributes "Symfony\Component\Routing\Matcher\UrlMatcher") |
| array | [handleRouteRequirements](#method_handleRouteRequirements)(string $pathinfo, string $name, [Route](../../../component/routing/route "Symfony\Component\Routing\Route") $route) Handles specific route requirements. | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method_handleRouteRequirements "Symfony\Component\Routing\Matcher\UrlMatcher") |
| array | [mergeDefaults](#method_mergeDefaults)(array $params, array $defaults) Get merged default parameters. | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method_mergeDefaults "Symfony\Component\Routing\Matcher\UrlMatcher") |
| | [getExpressionLanguage](#method_getExpressionLanguage)() | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method_getExpressionLanguage "Symfony\Component\Routing\Matcher\UrlMatcher") |
| | [createRequest](#method_createRequest)($pathinfo) | from [UrlMatcher](../../../component/routing/matcher/urlmatcher#method_createRequest "Symfony\Component\Routing\Matcher\UrlMatcher") |
| array | [redirect](#method_redirect)(string $path, string $route, string|null $scheme = null) Redirects the user to another URL. | |
Details
-------
###
\_\_construct([RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") $context)
#### Parameters
| | | |
| --- | --- | --- |
| [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | $routes | |
| [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") | $context | |
###
setContext([RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") $context)
Sets the request context.
#### Parameters
| | | |
| --- | --- | --- |
| [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") | $context | |
### [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext")
getContext()
Gets the request context.
#### Return Value
| | |
| --- | --- |
| [RequestContext](../../../component/routing/requestcontext "Symfony\Component\Routing\RequestContext") | The context |
### array
match(string $pathinfo)
Tries to match a URL path with a set of routes.
If the matcher can not find information, it must throw one of the exceptions documented below.
#### Parameters
| | | |
| --- | --- | --- |
| string | $pathinfo | The path info to be parsed (raw format, i.e. not urldecoded) |
#### Return Value
| | |
| --- | --- |
| array | An array of parameters |
#### Exceptions
| | |
| --- | --- |
| [NoConfigurationException](../../../component/routing/exception/noconfigurationexception "Symfony\Component\Routing\Exception\NoConfigurationException") | If no routing configuration could be found |
| [ResourceNotFoundException](../../../component/routing/exception/resourcenotfoundexception "Symfony\Component\Routing\Exception\ResourceNotFoundException") | If the resource could not be found |
| [MethodNotAllowedException](../../../component/routing/exception/methodnotallowedexception "Symfony\Component\Routing\Exception\MethodNotAllowedException") | If the resource was found but the request method is not allowed |
### array
matchRequest([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request)
Tries to match a request with a set of routes.
If the matcher can not find information, it must throw one of the exceptions documented below.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
#### Return Value
| | |
| --- | --- |
| array | An array of parameters |
#### Exceptions
| | |
| --- | --- |
| [NoConfigurationException](../../../component/routing/exception/noconfigurationexception "Symfony\Component\Routing\Exception\NoConfigurationException") | If no routing configuration could be found |
| [ResourceNotFoundException](../../../component/routing/exception/resourcenotfoundexception "Symfony\Component\Routing\Exception\ResourceNotFoundException") | If no matching resource could be found |
| [MethodNotAllowedException](../../../component/routing/exception/methodnotallowedexception "Symfony\Component\Routing\Exception\MethodNotAllowedException") | If a matching resource was found but the request method is not allowed |
###
addExpressionLanguageProvider([ExpressionFunctionProviderInterface](../../../component/expressionlanguage/expressionfunctionproviderinterface "Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface") $provider)
#### Parameters
| | | |
| --- | --- | --- |
| [ExpressionFunctionProviderInterface](../../../component/expressionlanguage/expressionfunctionproviderinterface "Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface") | $provider | |
### protected array
matchCollection(string $pathinfo, [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes)
Tries to match a URL with a set of routes.
#### Parameters
| | | |
| --- | --- | --- |
| string | $pathinfo | The path info to be parsed |
| [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | $routes | The set of routes |
#### Return Value
| | |
| --- | --- |
| array | An array of parameters |
#### Exceptions
| | |
| --- | --- |
| [NoConfigurationException](../../../component/routing/exception/noconfigurationexception "Symfony\Component\Routing\Exception\NoConfigurationException") | If no routing configuration could be found |
| [ResourceNotFoundException](../../../component/routing/exception/resourcenotfoundexception "Symfony\Component\Routing\Exception\ResourceNotFoundException") | If the resource could not be found |
| [MethodNotAllowedException](../../../component/routing/exception/methodnotallowedexception "Symfony\Component\Routing\Exception\MethodNotAllowedException") | If the resource was found but the request method is not allowed |
### protected array
getAttributes([Route](../../../component/routing/route "Symfony\Component\Routing\Route") $route, string $name, array $attributes)
Returns an array of values to use as request attributes.
As this method requires the Route object, it is not available in matchers that do not have access to the matched Route instance (like the PHP and Apache matcher dumpers).
#### Parameters
| | | |
| --- | --- | --- |
| [Route](../../../component/routing/route "Symfony\Component\Routing\Route") | $route | The route we are matching against |
| string | $name | The name of the route |
| array | $attributes | An array of attributes from the matcher |
#### Return Value
| | |
| --- | --- |
| array | An array of parameters |
### protected array
handleRouteRequirements(string $pathinfo, string $name, [Route](../../../component/routing/route "Symfony\Component\Routing\Route") $route)
Handles specific route requirements.
#### Parameters
| | | |
| --- | --- | --- |
| string | $pathinfo | The path |
| string | $name | The route name |
| [Route](../../../component/routing/route "Symfony\Component\Routing\Route") | $route | The route |
#### Return Value
| | |
| --- | --- |
| array | The first element represents the status, the second contains additional information |
### protected array
mergeDefaults(array $params, array $defaults)
Get merged default parameters.
#### Parameters
| | | |
| --- | --- | --- |
| array | $params | The parameters |
| array | $defaults | The defaults |
#### Return Value
| | |
| --- | --- |
| array | Merged default parameters |
### protected
getExpressionLanguage()
### protected
createRequest($pathinfo)
#### Parameters
| | | |
| --- | --- | --- |
| | $pathinfo | |
### array
redirect(string $path, string $route, string|null $scheme = null)
Redirects the user to another URL.
#### Parameters
| | | |
| --- | --- | --- |
| string | $path | The path info to redirect to |
| string | $route | The route name that matched |
| string|null | $scheme | The URL scheme (null to keep the current one) |
#### Return Value
| | |
| --- | --- |
| array | An array of parameters |
symfony AnnotatedRouteControllerLoader AnnotatedRouteControllerLoader
===============================
class **AnnotatedRouteControllerLoader** extends [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader "Symfony\Component\Routing\Loader\AnnotationClassLoader")
AnnotatedRouteControllerLoader is an implementation of AnnotationClassLoader that sets the '\_controller' default based on the class and method names.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $reader | | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#property_reader "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| protected string | $routeAnnotationClass | | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#property_routeAnnotationClass "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| protected int | $defaultRouteIndex | | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#property_defaultRouteIndex "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(Reader $reader) | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#method___construct "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| | [setRouteAnnotationClass](#method_setRouteAnnotationClass)(string $class) Sets the annotation class to read route properties from. | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#method_setRouteAnnotationClass "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| | [load](#method_load)(string $class, string|null $type = null) Loads from annotations from a class. | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#method_load "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| | [addRoute](#method_addRoute)([RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $collection, $annot, $globals, [ReflectionClass](http://php.net/ReflectionClass) $class, [ReflectionMethod](http://php.net/ReflectionMethod) $method) | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#method_addRoute "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| bool | [supports](#method_supports)(mixed $resource, string|null $type = null) Returns whether this class supports the given resource. | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#method_supports "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| | [setResolver](#method_setResolver)([LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") $resolver) Sets the loader resolver. | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#method_setResolver "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") | [getResolver](#method_getResolver)() Gets the loader resolver. | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#method_getResolver "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| string | [getDefaultRouteName](#method_getDefaultRouteName)([ReflectionClass](http://php.net/ReflectionClass) $class, [ReflectionMethod](http://php.net/ReflectionMethod) $method) Makes the default route name more sane by removing common keywords. | |
| | [getGlobals](#method_getGlobals)([ReflectionClass](http://php.net/ReflectionClass) $class) | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#method_getGlobals "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| | [createRoute](#method_createRoute)($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition) | from [AnnotationClassLoader](../../../component/routing/loader/annotationclassloader#method_createRoute "Symfony\Component\Routing\Loader\AnnotationClassLoader") |
| | [configureRoute](#method_configureRoute)([Route](../../../component/routing/route "Symfony\Component\Routing\Route") $route, [ReflectionClass](http://php.net/ReflectionClass) $class, [ReflectionMethod](http://php.net/ReflectionMethod) $method, $annot) Configures the \_controller default parameter of a given Route instance. | |
Details
-------
###
\_\_construct(Reader $reader)
#### Parameters
| | | |
| --- | --- | --- |
| Reader | $reader | |
###
setRouteAnnotationClass(string $class)
Sets the annotation class to read route properties from.
#### Parameters
| | | |
| --- | --- | --- |
| string | $class | A fully-qualified class name |
###
load(string $class, string|null $type = null)
Loads from annotations from a class.
#### Parameters
| | | |
| --- | --- | --- |
| string | $class | A class name |
| string|null | $type | The resource type or null if unknown |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | When route can't be parsed |
### protected
addRoute([RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $collection, $annot, $globals, [ReflectionClass](http://php.net/ReflectionClass) $class, [ReflectionMethod](http://php.net/ReflectionMethod) $method)
#### Parameters
| | | |
| --- | --- | --- |
| [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | $collection | |
| | $annot | |
| | $globals | |
| [ReflectionClass](http://php.net/ReflectionClass) | $class | |
| [ReflectionMethod](http://php.net/ReflectionMethod) | $method | |
### bool
supports(mixed $resource, string|null $type = null)
Returns whether this class supports the given resource.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $resource | A resource |
| string|null | $type | The resource type or null if unknown |
#### Return Value
| | |
| --- | --- |
| bool | True if this class supports the given resource, false otherwise |
###
setResolver([LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") $resolver)
Sets the loader resolver.
#### Parameters
| | | |
| --- | --- | --- |
| [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") | $resolver | |
### [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface")
getResolver()
Gets the loader resolver.
#### Return Value
| | |
| --- | --- |
| [LoaderResolverInterface](../../../component/config/loader/loaderresolverinterface "Symfony\Component\Config\Loader\LoaderResolverInterface") | A LoaderResolverInterface instance |
### protected string
getDefaultRouteName([ReflectionClass](http://php.net/ReflectionClass) $class, [ReflectionMethod](http://php.net/ReflectionMethod) $method)
Makes the default route name more sane by removing common keywords.
#### Parameters
| | | |
| --- | --- | --- |
| [ReflectionClass](http://php.net/ReflectionClass) | $class | |
| [ReflectionMethod](http://php.net/ReflectionMethod) | $method | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected
getGlobals([ReflectionClass](http://php.net/ReflectionClass) $class)
#### Parameters
| | | |
| --- | --- | --- |
| [ReflectionClass](http://php.net/ReflectionClass) | $class | |
### protected
createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition)
#### Parameters
| | | |
| --- | --- | --- |
| | $path | |
| | $defaults | |
| | $requirements | |
| | $options | |
| | $host | |
| | $schemes | |
| | $methods | |
| | $condition | |
### protected
configureRoute([Route](../../../component/routing/route "Symfony\Component\Routing\Route") $route, [ReflectionClass](http://php.net/ReflectionClass) $class, [ReflectionMethod](http://php.net/ReflectionMethod) $method, $annot)
Configures the \_controller default parameter of a given Route instance.
#### Parameters
| | | |
| --- | --- | --- |
| [Route](../../../component/routing/route "Symfony\Component\Routing\Route") | $route | |
| [ReflectionClass](http://php.net/ReflectionClass) | $class | |
| [ReflectionMethod](http://php.net/ReflectionMethod) | $method | |
| | $annot | |
| programming_docs |
symfony Configuration Configuration
==============
class **Configuration** implements [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")
FrameworkExtension configuration structure.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(bool $debug) | |
| [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder") | [getConfigTreeBuilder](#method_getConfigTreeBuilder)() Generates the configuration tree builder. | |
Details
-------
###
\_\_construct(bool $debug)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $debug | Whether debugging is enabled or not |
### [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder")
getConfigTreeBuilder()
Generates the configuration tree builder.
#### Return Value
| | |
| --- | --- |
| [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder") | The tree builder |
symfony Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler
===========================================================
Classes
-------
| | |
| --- | --- |
| [AddAnnotationsCachedReaderPass](compiler/addannotationscachedreaderpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddAnnotationsCachedReaderPass") | |
| [AddDebugLogProcessorPass](compiler/adddebuglogprocessorpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddDebugLogProcessorPass") | |
| [AddExpressionLanguageProvidersPass](compiler/addexpressionlanguageproviderspass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddExpressionLanguageProvidersPass") | Registers the expression language providers. |
| [CacheCollectorPass](compiler/cachecollectorpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CacheCollectorPass") | Inject a data collector to all the cache services to be able to get detailed statistics. |
| [CachePoolClearerPass](compiler/cachepoolclearerpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolClearerPass") | |
| [CachePoolPass](compiler/cachepoolpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPass") | |
| [CachePoolPrunerPass](compiler/cachepoolprunerpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPrunerPass") | |
| [ContainerBuilderDebugDumpPass](compiler/containerbuilderdebugdumppass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ContainerBuilderDebugDumpPass") | Dumps the ContainerBuilder to a cache file so that it can be used by debugging tools such as the debug:container console command. |
| [DataCollectorTranslatorPass](compiler/datacollectortranslatorpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\DataCollectorTranslatorPass") | |
| [LoggingTranslatorPass](compiler/loggingtranslatorpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\LoggingTranslatorPass") | |
| [ProfilerPass](compiler/profilerpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass") | Adds tagged data\_collector services to profiler service. |
| [TemplatingPass](compiler/templatingpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TemplatingPass") | |
| [TestServiceContainerRealRefPass](compiler/testservicecontainerrealrefpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TestServiceContainerRealRefPass") | |
| [TestServiceContainerWeakRefPass](compiler/testservicecontainerweakrefpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TestServiceContainerWeakRefPass") | |
| [UnusedTagsPass](compiler/unusedtagspass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\UnusedTagsPass") | Find all service tags which are defined, but not used and yield a warning log message. |
| [WorkflowGuardListenerPass](compiler/workflowguardlistenerpass "Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\WorkflowGuardListenerPass") | |
symfony FrameworkExtension FrameworkExtension
===================
class **FrameworkExtension** extends [Extension](../../../component/httpkernel/dependencyinjection/extension "Symfony\Component\HttpKernel\DependencyInjection\Extension")
FrameworkExtension.
Methods
-------
| | | |
| --- | --- | --- |
| string | [getXsdValidationBasePath](#method_getXsdValidationBasePath)() Returns the base path for the XSD files. | |
| string | [getNamespace](#method_getNamespace)() Returns the namespace to be used for this extension (XML namespace). | |
| string | [getAlias](#method_getAlias)() Returns the recommended alias to use in XML. | from [Extension](../../../component/dependencyinjection/extension/extension#method_getAlias "Symfony\Component\DependencyInjection\Extension\Extension") |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null | [getConfiguration](#method_getConfiguration)(array $config, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Returns extension configuration. | |
| | [processConfiguration](#method_processConfiguration)([ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") $configuration, array $configs) | from [Extension](../../../component/dependencyinjection/extension/extension#method_processConfiguration "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [getProcessedConfigs](#method_getProcessedConfigs)() | from [Extension](../../../component/dependencyinjection/extension/extension#method_getProcessedConfigs "Symfony\Component\DependencyInjection\Extension\Extension") |
| bool | [isConfigEnabled](#method_isConfigEnabled)([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, array $config) | from [Extension](../../../component/dependencyinjection/extension/extension#method_isConfigEnabled "Symfony\Component\DependencyInjection\Extension\Extension") |
| array | [getAnnotatedClassesToCompile](#method_getAnnotatedClassesToCompile)() Gets the annotated classes to cache. | from [Extension](../../../component/httpkernel/dependencyinjection/extension#method_getAnnotatedClassesToCompile "Symfony\Component\HttpKernel\DependencyInjection\Extension") |
| | [addAnnotatedClassesToCompile](#method_addAnnotatedClassesToCompile)(array $annotatedClasses) Adds annotated classes to the class cache. | from [Extension](../../../component/httpkernel/dependencyinjection/extension#method_addAnnotatedClassesToCompile "Symfony\Component\HttpKernel\DependencyInjection\Extension") |
| | [load](#method_load)(array $configs, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Responds to the app.config configuration parameter. | |
Details
-------
### string
getXsdValidationBasePath()
Returns the base path for the XSD files.
#### Return Value
| | |
| --- | --- |
| string | The XSD base path |
### string
getNamespace()
Returns the namespace to be used for this extension (XML namespace).
#### Return Value
| | |
| --- | --- |
| string | The XML namespace |
### string
getAlias()
Returns the recommended alias to use in XML.
This alias is also the mandatory prefix to use when using YAML.
This convention is to remove the "Extension" postfix from the class name and then lowercase and underscore the result. So:
```
AcmeHelloExtension
```
becomes
```
acme_hello
```
This can be overridden in a sub-class to specify the alias manually.
#### Return Value
| | |
| --- | --- |
| string | The alias |
#### Exceptions
| | |
| --- | --- |
| [BadMethodCallException](../../../component/dependencyinjection/exception/badmethodcallexception "Symfony\Component\DependencyInjection\Exception\BadMethodCallException") | When the extension name does not follow conventions |
### [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null
getConfiguration(array $config, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Returns extension configuration.
#### Parameters
| | | |
| --- | --- | --- |
| array | $config | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
#### Return Value
| | |
| --- | --- |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null | The configuration or null |
### final protected
processConfiguration([ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") $configuration, array $configs)
#### Parameters
| | | |
| --- | --- | --- |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") | $configuration | |
| array | $configs | |
### final
getProcessedConfigs()
### protected bool
isConfigEnabled([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, array $config)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
| array | $config | |
#### Return Value
| | |
| --- | --- |
| bool | Whether the configuration is enabled |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/dependencyinjection/exception/invalidargumentexception "Symfony\Component\DependencyInjection\Exception\InvalidArgumentException") | When the config is not enableable |
### array
getAnnotatedClassesToCompile()
Gets the annotated classes to cache.
#### Return Value
| | |
| --- | --- |
| array | An array of classes |
###
addAnnotatedClassesToCompile(array $annotatedClasses)
Adds annotated classes to the class cache.
#### Parameters
| | | |
| --- | --- | --- |
| array | $annotatedClasses | An array of class patterns |
###
load(array $configs, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Responds to the app.config configuration parameter.
#### Parameters
| | | |
| --- | --- | --- |
| array | $configs | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/dependencyinjection/exception/logicexception "Symfony\Component\DependencyInjection\Exception\LogicException") | |
symfony CachePoolClearerPass CachePoolClearerPass
=====================
class **CachePoolClearerPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony UnusedTagsPass UnusedTagsPass
===============
class **UnusedTagsPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Find all service tags which are defined, but not used and yield a warning log message.
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony AddAnnotationsCachedReaderPass AddAnnotationsCachedReaderPass
===============================
class **AddAnnotationsCachedReaderPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony AddExpressionLanguageProvidersPass AddExpressionLanguageProvidersPass
===================================
class **AddExpressionLanguageProvidersPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Registers the expression language providers.
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony TestServiceContainerRealRefPass TestServiceContainerRealRefPass
================================
class **TestServiceContainerRealRefPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony CachePoolPass CachePoolPass
==============
class **CachePoolPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
| static | [getServiceProvider](#method_getServiceProvider)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, $name) | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
### static
getServiceProvider([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, $name)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
| | $name | |
symfony ProfilerPass ProfilerPass
=============
class **ProfilerPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Adds tagged data\_collector services to profiler service.
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony DataCollectorTranslatorPass DataCollectorTranslatorPass
============================
class **DataCollectorTranslatorPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
| programming_docs |
symfony AddDebugLogProcessorPass AddDebugLogProcessorPass
=========================
class **AddDebugLogProcessorPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony WorkflowGuardListenerPass WorkflowGuardListenerPass
==========================
class **WorkflowGuardListenerPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony CachePoolPrunerPass CachePoolPrunerPass
====================
class **CachePoolPrunerPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)(string $cacheCommandServiceId = 'console.command.cache\_pool\_prune', string $cachePoolTag = 'cache.pool') | |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
\_\_construct(string $cacheCommandServiceId = 'console.command.cache\_pool\_prune', string $cachePoolTag = 'cache.pool')
#### Parameters
| | | |
| --- | --- | --- |
| string | $cacheCommandServiceId | |
| string | $cachePoolTag | |
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony TemplatingPass TemplatingPass
===============
class **TemplatingPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony CacheCollectorPass CacheCollectorPass
===================
class **CacheCollectorPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Inject a data collector to all the cache services to be able to get detailed statistics.
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony TestServiceContainerWeakRefPass TestServiceContainerWeakRefPass
================================
class **TestServiceContainerWeakRefPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony ContainerBuilderDebugDumpPass ContainerBuilderDebugDumpPass
==============================
class **ContainerBuilderDebugDumpPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Dumps the ContainerBuilder to a cache file so that it can be used by debugging tools such as the debug:container console command.
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony LoggingTranslatorPass LoggingTranslatorPass
======================
class **LoggingTranslatorPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony MicroKernelTrait MicroKernelTrait
=================
trait **MicroKernelTrait**
A Kernel that provides configuration hooks.
Methods
-------
| | | |
| --- | --- | --- |
| | [configureRoutes](#method_configureRoutes)([RouteCollectionBuilder](../../../component/routing/routecollectionbuilder "Symfony\Component\Routing\RouteCollectionBuilder") $routes) Add or import routes into your application. | |
| | [configureContainer](#method_configureContainer)([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $c, [LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") $loader) Configures the container. | |
| | [registerContainerConfiguration](#method_registerContainerConfiguration)([LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") $loader) {@inheritdoc} | |
| | [loadRoutes](#method_loadRoutes)([LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") $loader) | |
Details
-------
### abstract protected
configureRoutes([RouteCollectionBuilder](../../../component/routing/routecollectionbuilder "Symfony\Component\Routing\RouteCollectionBuilder") $routes)
Add or import routes into your application.
$routes->import('config/routing.yml'); $routes->add('/admin', 'App\Controller\AdminController::dashboard', 'admin\_dashboard');
#### Parameters
| | | |
| --- | --- | --- |
| [RouteCollectionBuilder](../../../component/routing/routecollectionbuilder "Symfony\Component\Routing\RouteCollectionBuilder") | $routes | |
### abstract protected
configureContainer([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $c, [LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") $loader)
Configures the container.
You can register extensions:
```
$c->loadFromExtension('framework', array(
'secret' => '%secret%'
));
```
Or services:
```
$c->register('halloween', 'FooBundle\HalloweenProvider');
```
Or parameters:
```
$c->setParameter('halloween', 'lot of fun');
```
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $c | |
| [LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") | $loader | |
###
registerContainerConfiguration([LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") $loader)
{@inheritdoc}
#### Parameters
| | | |
| --- | --- | --- |
| [LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") | $loader | |
###
loadRoutes([LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") $loader)
#### Parameters
| | | |
| --- | --- | --- |
| [LoaderInterface](../../../component/config/loader/loaderinterface "Symfony\Component\Config\Loader\LoaderInterface") | $loader | |
symfony Application Application
============
class **Application** extends [Application](../../../component/console/application "Symfony\Component\Console\Application")
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel) | |
| | [setDispatcher](#method_setDispatcher)([EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher) | from [Application](../../../component/console/application#method_setDispatcher "Symfony\Component\Console\Application") |
| | [setCommandLoader](#method_setCommandLoader)([CommandLoaderInterface](../../../component/console/commandloader/commandloaderinterface "Symfony\Component\Console\CommandLoader\CommandLoaderInterface") $commandLoader) | from [Application](../../../component/console/application#method_setCommandLoader "Symfony\Component\Console\Application") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input = null, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output = null) Runs the current application. | from [Application](../../../component/console/application#method_run "Symfony\Component\Console\Application") |
| int | [doRun](#method_doRun)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the current application. | |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Application](../../../component/console/application#method_setHelperSet "Symfony\Component\Console\Application") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Get the helper set associated with the command. | from [Application](../../../component/console/application#method_getHelperSet "Symfony\Component\Console\Application") |
| | [setDefinition](#method_setDefinition)([InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) | from [Application](../../../component/console/application#method_setDefinition "Symfony\Component\Console\Application") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition related to this Application. | from [Application](../../../component/console/application#method_getDefinition "Symfony\Component\Console\Application") |
| string | [getHelp](#method_getHelp)() Gets the help message. | from [Application](../../../component/console/application#method_getHelp "Symfony\Component\Console\Application") |
| bool | [areExceptionsCaught](#method_areExceptionsCaught)() Gets whether to catch exceptions or not during commands execution. | from [Application](../../../component/console/application#method_areExceptionsCaught "Symfony\Component\Console\Application") |
| | [setCatchExceptions](#method_setCatchExceptions)(bool $boolean) Sets whether to catch exceptions or not during commands execution. | from [Application](../../../component/console/application#method_setCatchExceptions "Symfony\Component\Console\Application") |
| bool | [isAutoExitEnabled](#method_isAutoExitEnabled)() Gets whether to automatically exit after a command execution or not. | from [Application](../../../component/console/application#method_isAutoExitEnabled "Symfony\Component\Console\Application") |
| | [setAutoExit](#method_setAutoExit)(bool $boolean) Sets whether to automatically exit after a command execution or not. | from [Application](../../../component/console/application#method_setAutoExit "Symfony\Component\Console\Application") |
| string | [getName](#method_getName)() Gets the name of the application. | from [Application](../../../component/console/application#method_getName "Symfony\Component\Console\Application") |
| | [setName](#method_setName)(string $name) Sets the application name. | from [Application](../../../component/console/application#method_setName "Symfony\Component\Console\Application") |
| string | [getVersion](#method_getVersion)() Gets the application version. | from [Application](../../../component/console/application#method_getVersion "Symfony\Component\Console\Application") |
| | [setVersion](#method_setVersion)(string $version) Sets the application version. | from [Application](../../../component/console/application#method_setVersion "Symfony\Component\Console\Application") |
| string | [getLongVersion](#method_getLongVersion)() Returns the long version of the application. | |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [register](#method_register)(string $name) Registers a new command. | from [Application](../../../component/console/application#method_register "Symfony\Component\Console\Application") |
| | [addCommands](#method_addCommands)(array $commands) Adds an array of command objects. | from [Application](../../../component/console/application#method_addCommands "Symfony\Component\Console\Application") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")|null | [add](#method_add)([Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") $command) Adds a command object. | |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [get](#method_get)(string $name) Returns a registered command by name or alias. | |
| bool | [has](#method_has)(string $name) Returns true if the command exists, false otherwise. | from [Application](../../../component/console/application#method_has "Symfony\Component\Console\Application") |
| string[] | [getNamespaces](#method_getNamespaces)() Returns an array of all unique namespaces used by currently registered commands. | from [Application](../../../component/console/application#method_getNamespaces "Symfony\Component\Console\Application") |
| string | [findNamespace](#method_findNamespace)(string $namespace) Finds a registered namespace by a name or an abbreviation. | from [Application](../../../component/console/application#method_findNamespace "Symfony\Component\Console\Application") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [find](#method_find)(string $name) Finds a command by name or alias. | |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")[] | [all](#method_all)(string $namespace = null) Gets the commands (registered in the given namespace if provided). | |
| static array | [getAbbreviations](#method_getAbbreviations)(array $names) Returns an array of possible abbreviations given a set of names. | from [Application](../../../component/console/application#method_getAbbreviations "Symfony\Component\Console\Application") |
| | [renderException](#method_renderException)([Exception](http://php.net/Exception) $e, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Renders a caught exception. | from [Application](../../../component/console/application#method_renderException "Symfony\Component\Console\Application") |
| | [doRenderException](#method_doRenderException)([Exception](http://php.net/Exception) $e, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) | from [Application](../../../component/console/application#method_doRenderException "Symfony\Component\Console\Application") |
| | [configureIO](#method_configureIO)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Configures the input and output instances based on the user arguments and options. | from [Application](../../../component/console/application#method_configureIO "Symfony\Component\Console\Application") |
| int | [doRunCommand](#method_doRunCommand)([Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") $command, [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the current command. | |
| string | [getCommandName](#method_getCommandName)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input) Gets the name of the command based on input. | from [Application](../../../component/console/application#method_getCommandName "Symfony\Component\Console\Application") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefaultInputDefinition](#method_getDefaultInputDefinition)() Gets the default input definition. | from [Application](../../../component/console/application#method_getDefaultInputDefinition "Symfony\Component\Console\Application") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")[] | [getDefaultCommands](#method_getDefaultCommands)() Gets the default commands that should always be available. | from [Application](../../../component/console/application#method_getDefaultCommands "Symfony\Component\Console\Application") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getDefaultHelperSet](#method_getDefaultHelperSet)() Gets the default helper set with the helpers that should always be available. | from [Application](../../../component/console/application#method_getDefaultHelperSet "Symfony\Component\Console\Application") |
| string | [extractNamespace](#method_extractNamespace)(string $name, string $limit = null) Returns the namespace part of the command name. | from [Application](../../../component/console/application#method_extractNamespace "Symfony\Component\Console\Application") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [setDefaultCommand](#method_setDefaultCommand)(string $commandName, bool $isSingleCommand = false) Sets the default Command name. | from [Application](../../../component/console/application#method_setDefaultCommand "Symfony\Component\Console\Application") |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | [getKernel](#method_getKernel)() Gets the Kernel associated with this Console. | |
| | [registerCommands](#method_registerCommands)() | |
Details
-------
###
\_\_construct([KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") $kernel)
#### Parameters
| | | |
| --- | --- | --- |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | $kernel | |
###
setDispatcher([EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher)
#### Parameters
| | | |
| --- | --- | --- |
| [EventDispatcherInterface](../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $dispatcher | |
###
setCommandLoader([CommandLoaderInterface](../../../component/console/commandloader/commandloaderinterface "Symfony\Component\Console\CommandLoader\CommandLoaderInterface") $commandLoader)
#### Parameters
| | | |
| --- | --- | --- |
| [CommandLoaderInterface](../../../component/console/commandloader/commandloaderinterface "Symfony\Component\Console\CommandLoader\CommandLoaderInterface") | $commandLoader | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input = null, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output = null)
Runs the current application.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When running fails. Bypass this when {@link setCatchExceptions()}. |
### int
doRun([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the current application.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | 0 if everything went fine, or an error code |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Get the helper set associated with the command.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | The HelperSet instance associated with this command |
###
setDefinition([InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
#### Parameters
| | | |
| --- | --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition related to this Application.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | The InputDefinition instance |
### string
getHelp()
Gets the help message.
#### Return Value
| | |
| --- | --- |
| string | A help message |
### bool
areExceptionsCaught()
Gets whether to catch exceptions or not during commands execution.
#### Return Value
| | |
| --- | --- |
| bool | Whether to catch exceptions or not during commands execution |
###
setCatchExceptions(bool $boolean)
Sets whether to catch exceptions or not during commands execution.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $boolean | Whether to catch exceptions or not during commands execution |
### bool
isAutoExitEnabled()
Gets whether to automatically exit after a command execution or not.
#### Return Value
| | |
| --- | --- |
| bool | Whether to automatically exit after a command execution or not |
###
setAutoExit(bool $boolean)
Sets whether to automatically exit after a command execution or not.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $boolean | Whether to automatically exit after a command execution or not |
### string
getName()
Gets the name of the application.
#### Return Value
| | |
| --- | --- |
| string | The application name |
###
setName(string $name)
Sets the application name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The application name |
### string
getVersion()
Gets the application version.
#### Return Value
| | |
| --- | --- |
| string | The application version |
###
setVersion(string $version)
Sets the application version.
#### Parameters
| | | |
| --- | --- | --- |
| string | $version | The application version |
### string
getLongVersion()
Returns the long version of the application.
#### Return Value
| | |
| --- | --- |
| string | The long application version |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
register(string $name)
Registers a new command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The newly created command |
###
addCommands(array $commands)
Adds an array of command objects.
If a Command is not enabled it will not be added.
#### Parameters
| | | |
| --- | --- | --- |
| array | $commands | An array of commands |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")|null
add([Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") $command)
Adds a command object.
If a command with the same name already exists, it will be overridden. If the command is not enabled it will not be added.
#### Parameters
| | | |
| --- | --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | $command | |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")|null | The registered command if enabled or null |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
get(string $name)
Returns a registered command by name or alias.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name or alias |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | A Command object |
#### Exceptions
| | |
| --- | --- |
| [CommandNotFoundException](../../../component/console/exception/commandnotfoundexception "Symfony\Component\Console\Exception\CommandNotFoundException") | When given command name does not exist |
### bool
has(string $name)
Returns true if the command exists, false otherwise.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name or alias |
#### Return Value
| | |
| --- | --- |
| bool | true if the command exists, false otherwise |
### string[]
getNamespaces()
Returns an array of all unique namespaces used by currently registered commands.
It does not return the global namespace which always exists.
#### Return Value
| | |
| --- | --- |
| string[] | An array of namespaces |
### string
findNamespace(string $namespace)
Finds a registered namespace by a name or an abbreviation.
#### Parameters
| | | |
| --- | --- | --- |
| string | $namespace | A namespace or abbreviation to search for |
#### Return Value
| | |
| --- | --- |
| string | A registered namespace |
#### Exceptions
| | |
| --- | --- |
| [NamespaceNotFoundException](../../../component/console/exception/namespacenotfoundexception "Symfony\Component\Console\Exception\NamespaceNotFoundException") | When namespace is incorrect or ambiguous |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
find(string $name)
Finds a command by name or alias.
Contrary to get, this command tries to find the best match if you give it an abbreviation of a name or alias.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | A command name or a command alias |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | A Command instance |
#### Exceptions
| | |
| --- | --- |
| [CommandNotFoundException](../../../component/console/exception/commandnotfoundexception "Symfony\Component\Console\Exception\CommandNotFoundException") | When command name is incorrect or ambiguous |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")[]
all(string $namespace = null)
Gets the commands (registered in the given namespace if provided).
The array keys are the full names and the values the command instances.
#### Parameters
| | | |
| --- | --- | --- |
| string | $namespace | A namespace name |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")[] | An array of Command instances |
### static array
getAbbreviations(array $names)
Returns an array of possible abbreviations given a set of names.
#### Parameters
| | | |
| --- | --- | --- |
| array | $names | An array of names |
#### Return Value
| | |
| --- | --- |
| array | An array of abbreviations |
###
renderException([Exception](http://php.net/Exception) $e, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Renders a caught exception.
#### Parameters
| | | |
| --- | --- | --- |
| [Exception](http://php.net/Exception) | $e | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
doRenderException([Exception](http://php.net/Exception) $e, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
#### Parameters
| | | |
| --- | --- | --- |
| [Exception](http://php.net/Exception) | $e | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
configureIO([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Configures the input and output instances based on the user arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected int
doRunCommand([Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") $command, [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the current command.
If an event dispatcher has been attached to the application, events are also dispatched during the life-cycle of the command.
#### Parameters
| | | |
| --- | --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | $command | |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | 0 if everything went fine, or an error code |
### protected string
getCommandName([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input)
Gets the name of the command based on input.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
#### Return Value
| | |
| --- | --- |
| string | The command name |
### protected [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefaultInputDefinition()
Gets the default input definition.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### protected [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")[]
getDefaultCommands()
Gets the default commands that should always be available.
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")[] | An array of default Command instances |
### protected [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getDefaultHelperSet()
Gets the default helper set with the helpers that should always be available.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### string
extractNamespace(string $name, string $limit = null)
Returns the namespace part of the command name.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The full name of the command |
| string | $limit | The maximum number of parts of the namespace |
#### Return Value
| | |
| --- | --- |
| string | The namespace of the command |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
setDefaultCommand(string $commandName, bool $isSingleCommand = false)
Sets the default Command name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $commandName | The Command name |
| bool | $isSingleCommand | Set to true if there is only one command in this application |
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | |
### [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface")
getKernel()
Gets the Kernel associated with this Console.
#### Return Value
| | |
| --- | --- |
| [KernelInterface](../../../component/httpkernel/kernelinterface "Symfony\Component\HttpKernel\KernelInterface") | A KernelInterface instance |
### protected
registerCommands()
| programming_docs |
symfony Symfony\Bundle\FrameworkBundle\Console\Descriptor Symfony\Bundle\FrameworkBundle\Console\Descriptor
=================================================
Classes
-------
| | |
| --- | --- |
| [Descriptor](descriptor/descriptor "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") | |
| [JsonDescriptor](descriptor/jsondescriptor "Symfony\Bundle\FrameworkBundle\Console\Descriptor\JsonDescriptor") | |
| [MarkdownDescriptor](descriptor/markdowndescriptor "Symfony\Bundle\FrameworkBundle\Console\Descriptor\MarkdownDescriptor") | |
| [TextDescriptor](descriptor/textdescriptor "Symfony\Bundle\FrameworkBundle\Console\Descriptor\TextDescriptor") | |
| [XmlDescriptor](descriptor/xmldescriptor "Symfony\Bundle\FrameworkBundle\Console\Descriptor\XmlDescriptor") | |
symfony Symfony\Bundle\FrameworkBundle\Console\Helper Symfony\Bundle\FrameworkBundle\Console\Helper
=============================================
Classes
-------
| | |
| --- | --- |
| [DescriptorHelper](helper/descriptorhelper "Symfony\Bundle\FrameworkBundle\Console\Helper\DescriptorHelper") | |
symfony Descriptor Descriptor
===========
abstract class **Descriptor** implements [DescriptorInterface](../../../../component/console/descriptor/descriptorinterface "Symfony\Component\Console\Descriptor\DescriptorInterface")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [describe](#method_describe)([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. | |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | [getOutput](#method_getOutput)() Returns the output. | |
| | [write](#method_write)(string $content, bool $decorated = false) Writes content to output. | |
| | [describeRouteCollection](#method_describeRouteCollection)([RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, array $options = array()) Describes an InputArgument instance. | |
| | [describeRoute](#method_describeRoute)([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route, array $options = array()) Describes an InputOption instance. | |
| | [describeContainerParameters](#method_describeContainerParameters)([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters, array $options = array()) Describes container parameters. | |
| | [describeContainerTags](#method_describeContainerTags)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array()) Describes container tags. | |
| | [describeContainerService](#method_describeContainerService)([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object $service, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null) Describes a container service by its name. | |
| | [describeContainerServices](#method_describeContainerServices)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array()) Describes container services. | |
| | [describeContainerDefinition](#method_describeContainerDefinition)([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") $definition, array $options = array()) Describes a service definition. | |
| | [describeContainerAlias](#method_describeContainerAlias)([Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") $alias, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null) Describes a service alias. | |
| | [describeContainerParameter](#method_describeContainerParameter)($parameter, array $options = array()) Describes a container parameter. | |
| | [describeEventDispatcherListeners](#method_describeEventDispatcherListeners)([EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $eventDispatcher, array $options = array()) Describes event dispatcher listeners. | |
| | [describeCallable](#method_describeCallable)(callable $callable, array $options = array()) Describes a callable. | |
| string | [formatValue](#method_formatValue)(mixed $value) Formats a value as string. | |
| string | [formatParameter](#method_formatParameter)(mixed $value) Formats a parameter. | |
| mixed | [resolveServiceDefinition](#method_resolveServiceDefinition)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, string $serviceId) | |
| array | [findDefinitionsByTag](#method_findDefinitionsByTag)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, bool $showHidden) | |
| | [sortParameters](#method_sortParameters)([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters) | |
| | [sortServiceIds](#method_sortServiceIds)(array $serviceIds) | |
Details
-------
###
describe([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array())
Describes an object if supported.
#### Parameters
| | | |
| --- | --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
| object | $object | |
| array | $options | |
### protected [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface")
getOutput()
Returns the output.
#### Return Value
| | |
| --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | The output |
### protected
write(string $content, bool $decorated = false)
Writes content to output.
#### Parameters
| | | |
| --- | --- | --- |
| string | $content | |
| bool | $decorated | |
### abstract protected
describeRouteCollection([RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, array $options = array())
Describes an InputArgument instance.
#### Parameters
| | | |
| --- | --- | --- |
| [RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | $routes | |
| array | $options | |
### abstract protected
describeRoute([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route, array $options = array())
Describes an InputOption instance.
#### Parameters
| | | |
| --- | --- | --- |
| [Route](../../../../component/routing/route "Symfony\Component\Routing\Route") | $route | |
| array | $options | |
### abstract protected
describeContainerParameters([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters, array $options = array())
Describes container parameters.
#### Parameters
| | | |
| --- | --- | --- |
| [ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") | $parameters | |
| array | $options | |
### abstract protected
describeContainerTags([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array())
Describes container tags.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| array | $options | |
### abstract protected
describeContainerService([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object $service, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null)
Describes a container service by its name.
Common options are: \* name: name of described service
#### Parameters
| | | |
| --- | --- | --- |
| [Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object | $service | |
| array | $options | |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
### abstract protected
describeContainerServices([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array())
Describes container services.
Common options are: \* tag: filters described services by given tag
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| array | $options | |
### abstract protected
describeContainerDefinition([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") $definition, array $options = array())
Describes a service definition.
#### Parameters
| | | |
| --- | --- | --- |
| [Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") | $definition | |
| array | $options | |
### abstract protected
describeContainerAlias([Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") $alias, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null)
Describes a service alias.
#### Parameters
| | | |
| --- | --- | --- |
| [Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") | $alias | |
| array | $options | |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
### abstract protected
describeContainerParameter($parameter, array $options = array())
Describes a container parameter.
#### Parameters
| | | |
| --- | --- | --- |
| | $parameter | |
| array | $options | |
### abstract protected
describeEventDispatcherListeners([EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $eventDispatcher, array $options = array())
Describes event dispatcher listeners.
Common options are: \* name: name of listened event
#### Parameters
| | | |
| --- | --- | --- |
| [EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $eventDispatcher | |
| array | $options | |
### abstract protected
describeCallable(callable $callable, array $options = array())
Describes a callable.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $callable | |
| array | $options | |
### protected string
formatValue(mixed $value)
Formats a value as string.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected string
formatParameter(mixed $value)
Formats a parameter.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected mixed
resolveServiceDefinition([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, string $serviceId)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| string | $serviceId | |
#### Return Value
| | |
| --- | --- |
| mixed | |
### protected array
findDefinitionsByTag([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, bool $showHidden)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| bool | $showHidden | |
#### Return Value
| | |
| --- | --- |
| array | |
### protected
sortParameters([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters)
#### Parameters
| | | |
| --- | --- | --- |
| [ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") | $parameters | |
### protected
sortServiceIds(array $serviceIds)
#### Parameters
| | | |
| --- | --- | --- |
| array | $serviceIds | |
symfony JsonDescriptor JsonDescriptor
===============
class **JsonDescriptor** extends [Descriptor](descriptor "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | from [Descriptor](descriptor#property_output "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
Methods
-------
| | | |
| --- | --- | --- |
| | [describe](#method_describe)([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. | from [Descriptor](descriptor#method_describe "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | [getOutput](#method_getOutput)() Returns the output. | from [Descriptor](descriptor#method_getOutput "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [write](#method_write)(string $content, bool $decorated = false) Writes content to output. | from [Descriptor](descriptor#method_write "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [describeRouteCollection](#method_describeRouteCollection)([RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, array $options = array()) Describes an InputArgument instance. | |
| | [describeRoute](#method_describeRoute)([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route, array $options = array()) Describes an InputOption instance. | |
| | [describeContainerParameters](#method_describeContainerParameters)([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters, array $options = array()) Describes container parameters. | |
| | [describeContainerTags](#method_describeContainerTags)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array()) Describes container tags. | |
| | [describeContainerService](#method_describeContainerService)([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object $service, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null) Describes a container service by its name. | |
| | [describeContainerServices](#method_describeContainerServices)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array()) Describes container services. | |
| | [describeContainerDefinition](#method_describeContainerDefinition)([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") $definition, array $options = array()) Describes a service definition. | |
| | [describeContainerAlias](#method_describeContainerAlias)([Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") $alias, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null) Describes a service alias. | |
| | [describeContainerParameter](#method_describeContainerParameter)($parameter, array $options = array()) Describes a container parameter. | |
| | [describeEventDispatcherListeners](#method_describeEventDispatcherListeners)([EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $eventDispatcher, array $options = array()) Describes event dispatcher listeners. | |
| | [describeCallable](#method_describeCallable)(callable $callable, array $options = array()) Describes a callable. | |
| string | [formatValue](#method_formatValue)(mixed $value) Formats a value as string. | from [Descriptor](descriptor#method_formatValue "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| string | [formatParameter](#method_formatParameter)(mixed $value) Formats a parameter. | from [Descriptor](descriptor#method_formatParameter "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| mixed | [resolveServiceDefinition](#method_resolveServiceDefinition)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, string $serviceId) | from [Descriptor](descriptor#method_resolveServiceDefinition "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| array | [findDefinitionsByTag](#method_findDefinitionsByTag)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, bool $showHidden) | from [Descriptor](descriptor#method_findDefinitionsByTag "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [sortParameters](#method_sortParameters)([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters) | from [Descriptor](descriptor#method_sortParameters "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [sortServiceIds](#method_sortServiceIds)(array $serviceIds) | from [Descriptor](descriptor#method_sortServiceIds "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| array | [getRouteData](#method_getRouteData)([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route) | |
Details
-------
###
describe([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array())
Describes an object if supported.
#### Parameters
| | | |
| --- | --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
| object | $object | |
| array | $options | |
### protected [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface")
getOutput()
Returns the output.
#### Return Value
| | |
| --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | The output |
### protected
write(string $content, bool $decorated = false)
Writes content to output.
#### Parameters
| | | |
| --- | --- | --- |
| string | $content | |
| bool | $decorated | |
### protected
describeRouteCollection([RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, array $options = array())
Describes an InputArgument instance.
#### Parameters
| | | |
| --- | --- | --- |
| [RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | $routes | |
| array | $options | |
### protected
describeRoute([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route, array $options = array())
Describes an InputOption instance.
#### Parameters
| | | |
| --- | --- | --- |
| [Route](../../../../component/routing/route "Symfony\Component\Routing\Route") | $route | |
| array | $options | |
### protected
describeContainerParameters([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters, array $options = array())
Describes container parameters.
#### Parameters
| | | |
| --- | --- | --- |
| [ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") | $parameters | |
| array | $options | |
### protected
describeContainerTags([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array())
Describes container tags.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| array | $options | |
### protected
describeContainerService([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object $service, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null)
Describes a container service by its name.
Common options are: \* name: name of described service
#### Parameters
| | | |
| --- | --- | --- |
| [Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object | $service | |
| array | $options | |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
### protected
describeContainerServices([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array())
Describes container services.
Common options are: \* tag: filters described services by given tag
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| array | $options | |
### protected
describeContainerDefinition([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") $definition, array $options = array())
Describes a service definition.
#### Parameters
| | | |
| --- | --- | --- |
| [Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") | $definition | |
| array | $options | |
### protected
describeContainerAlias([Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") $alias, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null)
Describes a service alias.
#### Parameters
| | | |
| --- | --- | --- |
| [Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") | $alias | |
| array | $options | |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
### protected
describeContainerParameter($parameter, array $options = array())
Describes a container parameter.
#### Parameters
| | | |
| --- | --- | --- |
| | $parameter | |
| array | $options | |
### protected
describeEventDispatcherListeners([EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $eventDispatcher, array $options = array())
Describes event dispatcher listeners.
Common options are: \* name: name of listened event
#### Parameters
| | | |
| --- | --- | --- |
| [EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $eventDispatcher | |
| array | $options | |
### protected
describeCallable(callable $callable, array $options = array())
Describes a callable.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $callable | |
| array | $options | |
### protected string
formatValue(mixed $value)
Formats a value as string.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected string
formatParameter(mixed $value)
Formats a parameter.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected mixed
resolveServiceDefinition([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, string $serviceId)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| string | $serviceId | |
#### Return Value
| | |
| --- | --- |
| mixed | |
### protected array
findDefinitionsByTag([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, bool $showHidden)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| bool | $showHidden | |
#### Return Value
| | |
| --- | --- |
| array | |
### protected
sortParameters([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters)
#### Parameters
| | | |
| --- | --- | --- |
| [ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") | $parameters | |
### protected
sortServiceIds(array $serviceIds)
#### Parameters
| | | |
| --- | --- | --- |
| array | $serviceIds | |
### protected array
getRouteData([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route)
#### Parameters
| | | |
| --- | --- | --- |
| [Route](../../../../component/routing/route "Symfony\Component\Routing\Route") | $route | |
#### Return Value
| | |
| --- | --- |
| array | |
| programming_docs |
symfony MarkdownDescriptor MarkdownDescriptor
===================
class **MarkdownDescriptor** extends [Descriptor](descriptor "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | from [Descriptor](descriptor#property_output "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
Methods
-------
| | | |
| --- | --- | --- |
| | [describe](#method_describe)([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. | from [Descriptor](descriptor#method_describe "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | [getOutput](#method_getOutput)() Returns the output. | from [Descriptor](descriptor#method_getOutput "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [write](#method_write)(string $content, bool $decorated = false) Writes content to output. | from [Descriptor](descriptor#method_write "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [describeRouteCollection](#method_describeRouteCollection)([RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, array $options = array()) Describes an InputArgument instance. | |
| | [describeRoute](#method_describeRoute)([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route, array $options = array()) Describes an InputOption instance. | |
| | [describeContainerParameters](#method_describeContainerParameters)([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters, array $options = array()) Describes container parameters. | |
| | [describeContainerTags](#method_describeContainerTags)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array()) Describes container tags. | |
| | [describeContainerService](#method_describeContainerService)([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object $service, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null) Describes a container service by its name. | |
| | [describeContainerServices](#method_describeContainerServices)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array()) Describes container services. | |
| | [describeContainerDefinition](#method_describeContainerDefinition)([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") $definition, array $options = array()) Describes a service definition. | |
| | [describeContainerAlias](#method_describeContainerAlias)([Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") $alias, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null) Describes a service alias. | |
| | [describeContainerParameter](#method_describeContainerParameter)($parameter, array $options = array()) Describes a container parameter. | |
| | [describeEventDispatcherListeners](#method_describeEventDispatcherListeners)([EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $eventDispatcher, array $options = array()) Describes event dispatcher listeners. | |
| | [describeCallable](#method_describeCallable)(callable $callable, array $options = array()) Describes a callable. | |
| string | [formatValue](#method_formatValue)(mixed $value) Formats a value as string. | from [Descriptor](descriptor#method_formatValue "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| string | [formatParameter](#method_formatParameter)(mixed $value) Formats a parameter. | from [Descriptor](descriptor#method_formatParameter "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| mixed | [resolveServiceDefinition](#method_resolveServiceDefinition)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, string $serviceId) | from [Descriptor](descriptor#method_resolveServiceDefinition "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| array | [findDefinitionsByTag](#method_findDefinitionsByTag)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, bool $showHidden) | from [Descriptor](descriptor#method_findDefinitionsByTag "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [sortParameters](#method_sortParameters)([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters) | from [Descriptor](descriptor#method_sortParameters "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [sortServiceIds](#method_sortServiceIds)(array $serviceIds) | from [Descriptor](descriptor#method_sortServiceIds "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
Details
-------
###
describe([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array())
Describes an object if supported.
#### Parameters
| | | |
| --- | --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
| object | $object | |
| array | $options | |
### protected [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface")
getOutput()
Returns the output.
#### Return Value
| | |
| --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | The output |
### protected
write(string $content, bool $decorated = false)
Writes content to output.
#### Parameters
| | | |
| --- | --- | --- |
| string | $content | |
| bool | $decorated | |
### protected
describeRouteCollection([RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, array $options = array())
Describes an InputArgument instance.
#### Parameters
| | | |
| --- | --- | --- |
| [RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | $routes | |
| array | $options | |
### protected
describeRoute([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route, array $options = array())
Describes an InputOption instance.
#### Parameters
| | | |
| --- | --- | --- |
| [Route](../../../../component/routing/route "Symfony\Component\Routing\Route") | $route | |
| array | $options | |
### protected
describeContainerParameters([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters, array $options = array())
Describes container parameters.
#### Parameters
| | | |
| --- | --- | --- |
| [ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") | $parameters | |
| array | $options | |
### protected
describeContainerTags([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array())
Describes container tags.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| array | $options | |
### protected
describeContainerService([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object $service, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null)
Describes a container service by its name.
Common options are: \* name: name of described service
#### Parameters
| | | |
| --- | --- | --- |
| [Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object | $service | |
| array | $options | |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
### protected
describeContainerServices([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array())
Describes container services.
Common options are: \* tag: filters described services by given tag
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| array | $options | |
### protected
describeContainerDefinition([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") $definition, array $options = array())
Describes a service definition.
#### Parameters
| | | |
| --- | --- | --- |
| [Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") | $definition | |
| array | $options | |
### protected
describeContainerAlias([Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") $alias, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null)
Describes a service alias.
#### Parameters
| | | |
| --- | --- | --- |
| [Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") | $alias | |
| array | $options | |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
### protected
describeContainerParameter($parameter, array $options = array())
Describes a container parameter.
#### Parameters
| | | |
| --- | --- | --- |
| | $parameter | |
| array | $options | |
### protected
describeEventDispatcherListeners([EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $eventDispatcher, array $options = array())
Describes event dispatcher listeners.
Common options are: \* name: name of listened event
#### Parameters
| | | |
| --- | --- | --- |
| [EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $eventDispatcher | |
| array | $options | |
### protected
describeCallable(callable $callable, array $options = array())
Describes a callable.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $callable | |
| array | $options | |
### protected string
formatValue(mixed $value)
Formats a value as string.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected string
formatParameter(mixed $value)
Formats a parameter.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected mixed
resolveServiceDefinition([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, string $serviceId)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| string | $serviceId | |
#### Return Value
| | |
| --- | --- |
| mixed | |
### protected array
findDefinitionsByTag([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, bool $showHidden)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| bool | $showHidden | |
#### Return Value
| | |
| --- | --- |
| array | |
### protected
sortParameters([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters)
#### Parameters
| | | |
| --- | --- | --- |
| [ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") | $parameters | |
### protected
sortServiceIds(array $serviceIds)
#### Parameters
| | | |
| --- | --- | --- |
| array | $serviceIds | |
symfony XmlDescriptor XmlDescriptor
==============
class **XmlDescriptor** extends [Descriptor](descriptor "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | from [Descriptor](descriptor#property_output "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
Methods
-------
| | | |
| --- | --- | --- |
| | [describe](#method_describe)([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. | from [Descriptor](descriptor#method_describe "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | [getOutput](#method_getOutput)() Returns the output. | from [Descriptor](descriptor#method_getOutput "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [write](#method_write)(string $content, bool $decorated = false) Writes content to output. | from [Descriptor](descriptor#method_write "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [describeRouteCollection](#method_describeRouteCollection)([RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, array $options = array()) Describes an InputArgument instance. | |
| | [describeRoute](#method_describeRoute)([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route, array $options = array()) Describes an InputOption instance. | |
| | [describeContainerParameters](#method_describeContainerParameters)([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters, array $options = array()) Describes container parameters. | |
| | [describeContainerTags](#method_describeContainerTags)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array()) Describes container tags. | |
| | [describeContainerService](#method_describeContainerService)([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object $service, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null) Describes a container service by its name. | |
| | [describeContainerServices](#method_describeContainerServices)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array()) Describes container services. | |
| | [describeContainerDefinition](#method_describeContainerDefinition)([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") $definition, array $options = array()) Describes a service definition. | |
| | [describeContainerAlias](#method_describeContainerAlias)([Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") $alias, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null) Describes a service alias. | |
| | [describeContainerParameter](#method_describeContainerParameter)($parameter, array $options = array()) Describes a container parameter. | |
| | [describeEventDispatcherListeners](#method_describeEventDispatcherListeners)([EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $eventDispatcher, array $options = array()) Describes event dispatcher listeners. | |
| | [describeCallable](#method_describeCallable)(callable $callable, array $options = array()) Describes a callable. | |
| string | [formatValue](#method_formatValue)(mixed $value) Formats a value as string. | from [Descriptor](descriptor#method_formatValue "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| string | [formatParameter](#method_formatParameter)(mixed $value) Formats a parameter. | from [Descriptor](descriptor#method_formatParameter "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| mixed | [resolveServiceDefinition](#method_resolveServiceDefinition)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, string $serviceId) | from [Descriptor](descriptor#method_resolveServiceDefinition "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| array | [findDefinitionsByTag](#method_findDefinitionsByTag)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, bool $showHidden) | from [Descriptor](descriptor#method_findDefinitionsByTag "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [sortParameters](#method_sortParameters)([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters) | from [Descriptor](descriptor#method_sortParameters "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [sortServiceIds](#method_sortServiceIds)(array $serviceIds) | from [Descriptor](descriptor#method_sortServiceIds "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
Details
-------
###
describe([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array())
Describes an object if supported.
#### Parameters
| | | |
| --- | --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
| object | $object | |
| array | $options | |
### protected [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface")
getOutput()
Returns the output.
#### Return Value
| | |
| --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | The output |
### protected
write(string $content, bool $decorated = false)
Writes content to output.
#### Parameters
| | | |
| --- | --- | --- |
| string | $content | |
| bool | $decorated | |
### protected
describeRouteCollection([RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, array $options = array())
Describes an InputArgument instance.
#### Parameters
| | | |
| --- | --- | --- |
| [RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | $routes | |
| array | $options | |
### protected
describeRoute([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route, array $options = array())
Describes an InputOption instance.
#### Parameters
| | | |
| --- | --- | --- |
| [Route](../../../../component/routing/route "Symfony\Component\Routing\Route") | $route | |
| array | $options | |
### protected
describeContainerParameters([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters, array $options = array())
Describes container parameters.
#### Parameters
| | | |
| --- | --- | --- |
| [ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") | $parameters | |
| array | $options | |
### protected
describeContainerTags([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array())
Describes container tags.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| array | $options | |
### protected
describeContainerService([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object $service, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null)
Describes a container service by its name.
Common options are: \* name: name of described service
#### Parameters
| | | |
| --- | --- | --- |
| [Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object | $service | |
| array | $options | |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
### protected
describeContainerServices([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array())
Describes container services.
Common options are: \* tag: filters described services by given tag
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| array | $options | |
### protected
describeContainerDefinition([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") $definition, array $options = array())
Describes a service definition.
#### Parameters
| | | |
| --- | --- | --- |
| [Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") | $definition | |
| array | $options | |
### protected
describeContainerAlias([Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") $alias, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null)
Describes a service alias.
#### Parameters
| | | |
| --- | --- | --- |
| [Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") | $alias | |
| array | $options | |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
### protected
describeContainerParameter($parameter, array $options = array())
Describes a container parameter.
#### Parameters
| | | |
| --- | --- | --- |
| | $parameter | |
| array | $options | |
### protected
describeEventDispatcherListeners([EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $eventDispatcher, array $options = array())
Describes event dispatcher listeners.
Common options are: \* name: name of listened event
#### Parameters
| | | |
| --- | --- | --- |
| [EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $eventDispatcher | |
| array | $options | |
### protected
describeCallable(callable $callable, array $options = array())
Describes a callable.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $callable | |
| array | $options | |
### protected string
formatValue(mixed $value)
Formats a value as string.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected string
formatParameter(mixed $value)
Formats a parameter.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected mixed
resolveServiceDefinition([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, string $serviceId)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| string | $serviceId | |
#### Return Value
| | |
| --- | --- |
| mixed | |
### protected array
findDefinitionsByTag([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, bool $showHidden)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| bool | $showHidden | |
#### Return Value
| | |
| --- | --- |
| array | |
### protected
sortParameters([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters)
#### Parameters
| | | |
| --- | --- | --- |
| [ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") | $parameters | |
### protected
sortServiceIds(array $serviceIds)
#### Parameters
| | | |
| --- | --- | --- |
| array | $serviceIds | |
| programming_docs |
symfony TextDescriptor TextDescriptor
===============
class **TextDescriptor** extends [Descriptor](descriptor "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | from [Descriptor](descriptor#property_output "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
Methods
-------
| | | |
| --- | --- | --- |
| | [describe](#method_describe)([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. | from [Descriptor](descriptor#method_describe "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | [getOutput](#method_getOutput)() Returns the output. | from [Descriptor](descriptor#method_getOutput "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [write](#method_write)(string $content, bool $decorated = false) Writes content to output. | from [Descriptor](descriptor#method_write "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [describeRouteCollection](#method_describeRouteCollection)([RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, array $options = array()) Describes an InputArgument instance. | |
| | [describeRoute](#method_describeRoute)([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route, array $options = array()) Describes an InputOption instance. | |
| | [describeContainerParameters](#method_describeContainerParameters)([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters, array $options = array()) Describes container parameters. | |
| | [describeContainerTags](#method_describeContainerTags)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array()) Describes container tags. | |
| | [describeContainerService](#method_describeContainerService)([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object $service, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null) Describes a container service by its name. | |
| | [describeContainerServices](#method_describeContainerServices)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array()) Describes container services. | |
| | [describeContainerDefinition](#method_describeContainerDefinition)([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") $definition, array $options = array()) Describes a service definition. | |
| | [describeContainerAlias](#method_describeContainerAlias)([Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") $alias, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null) Describes a service alias. | |
| | [describeContainerParameter](#method_describeContainerParameter)($parameter, array $options = array()) Describes a container parameter. | |
| | [describeEventDispatcherListeners](#method_describeEventDispatcherListeners)([EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $eventDispatcher, array $options = array()) Describes event dispatcher listeners. | |
| | [describeCallable](#method_describeCallable)(callable $callable, array $options = array()) Describes a callable. | |
| string | [formatValue](#method_formatValue)(mixed $value) Formats a value as string. | from [Descriptor](descriptor#method_formatValue "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| string | [formatParameter](#method_formatParameter)(mixed $value) Formats a parameter. | from [Descriptor](descriptor#method_formatParameter "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| mixed | [resolveServiceDefinition](#method_resolveServiceDefinition)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, string $serviceId) | from [Descriptor](descriptor#method_resolveServiceDefinition "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| array | [findDefinitionsByTag](#method_findDefinitionsByTag)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, bool $showHidden) | from [Descriptor](descriptor#method_findDefinitionsByTag "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [sortParameters](#method_sortParameters)([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters) | from [Descriptor](descriptor#method_sortParameters "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
| | [sortServiceIds](#method_sortServiceIds)(array $serviceIds) | from [Descriptor](descriptor#method_sortServiceIds "Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor") |
Details
-------
###
describe([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array())
Describes an object if supported.
#### Parameters
| | | |
| --- | --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
| object | $object | |
| array | $options | |
### protected [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface")
getOutput()
Returns the output.
#### Return Value
| | |
| --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | The output |
### protected
write(string $content, bool $decorated = false)
Writes content to output.
#### Parameters
| | | |
| --- | --- | --- |
| string | $content | |
| bool | $decorated | |
### protected
describeRouteCollection([RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes, array $options = array())
Describes an InputArgument instance.
#### Parameters
| | | |
| --- | --- | --- |
| [RouteCollection](../../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | $routes | |
| array | $options | |
### protected
describeRoute([Route](../../../../component/routing/route "Symfony\Component\Routing\Route") $route, array $options = array())
Describes an InputOption instance.
#### Parameters
| | | |
| --- | --- | --- |
| [Route](../../../../component/routing/route "Symfony\Component\Routing\Route") | $route | |
| array | $options | |
### protected
describeContainerParameters([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters, array $options = array())
Describes container parameters.
#### Parameters
| | | |
| --- | --- | --- |
| [ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") | $parameters | |
| array | $options | |
### protected
describeContainerTags([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array())
Describes container tags.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| array | $options | |
### protected
describeContainerService([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object $service, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null)
Describes a container service by its name.
Common options are: \* name: name of described service
#### Parameters
| | | |
| --- | --- | --- |
| [Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition")|[Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias")|object | $service | |
| array | $options | |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
### protected
describeContainerServices([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, array $options = array())
Describes container services.
Common options are: \* tag: filters described services by given tag
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| array | $options | |
### protected
describeContainerDefinition([Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") $definition, array $options = array())
Describes a service definition.
#### Parameters
| | | |
| --- | --- | --- |
| [Definition](../../../../component/dependencyinjection/definition "Symfony\Component\DependencyInjection\Definition") | $definition | |
| array | $options | |
### protected
describeContainerAlias([Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") $alias, array $options = array(), [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder = null)
Describes a service alias.
#### Parameters
| | | |
| --- | --- | --- |
| [Alias](../../../../component/dependencyinjection/alias "Symfony\Component\DependencyInjection\Alias") | $alias | |
| array | $options | |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
### protected
describeContainerParameter($parameter, array $options = array())
Describes a container parameter.
#### Parameters
| | | |
| --- | --- | --- |
| | $parameter | |
| array | $options | |
### protected
describeEventDispatcherListeners([EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $eventDispatcher, array $options = array())
Describes event dispatcher listeners.
Common options are: \* name: name of listened event
#### Parameters
| | | |
| --- | --- | --- |
| [EventDispatcherInterface](../../../../component/eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $eventDispatcher | |
| array | $options | |
### protected
describeCallable(callable $callable, array $options = array())
Describes a callable.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $callable | |
| array | $options | |
### protected string
formatValue(mixed $value)
Formats a value as string.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected string
formatParameter(mixed $value)
Formats a parameter.
#### Parameters
| | | |
| --- | --- | --- |
| mixed | $value | |
#### Return Value
| | |
| --- | --- |
| string | |
### protected mixed
resolveServiceDefinition([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, string $serviceId)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| string | $serviceId | |
#### Return Value
| | |
| --- | --- |
| mixed | |
### protected array
findDefinitionsByTag([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $builder, bool $showHidden)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $builder | |
| bool | $showHidden | |
#### Return Value
| | |
| --- | --- |
| array | |
### protected
sortParameters([ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") $parameters)
#### Parameters
| | | |
| --- | --- | --- |
| [ParameterBag](../../../../component/dependencyinjection/parameterbag/parameterbag "Symfony\Component\DependencyInjection\ParameterBag\ParameterBag") | $parameters | |
### protected
sortServiceIds(array $serviceIds)
#### Parameters
| | | |
| --- | --- | --- |
| array | $serviceIds | |
symfony DescriptorHelper DescriptorHelper
=================
class **DescriptorHelper** extends [DescriptorHelper](../../../../component/console/helper/descriptorhelper "Symfony\Component\Console\Helper\DescriptorHelper")
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $helperSet | | from [Helper](../../../../component/console/helper/helper#property_helperSet "Symfony\Component\Console\Helper\Helper") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet = null) Sets the helper set associated with this helper. | from [Helper](../../../../component/console/helper/helper#method_setHelperSet "Symfony\Component\Console\Helper\Helper") |
| [HelperSet](../../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set associated with this helper. | from [Helper](../../../../component/console/helper/helper#method_getHelperSet "Symfony\Component\Console\Helper\Helper") |
| static int | [strlen](#method_strlen)(string $string) Returns the length of a string, using mb\_strwidth if it is available. | from [Helper](../../../../component/console/helper/helper#method_strlen "Symfony\Component\Console\Helper\Helper") |
| static string | [substr](#method_substr)(string $string, int $from, int|null $length = null) Returns the subset of a string, using mb\_substr if it is available. | from [Helper](../../../../component/console/helper/helper#method_substr "Symfony\Component\Console\Helper\Helper") |
| static | [formatTime](#method_formatTime)($secs) | from [Helper](../../../../component/console/helper/helper#method_formatTime "Symfony\Component\Console\Helper\Helper") |
| static | [formatMemory](#method_formatMemory)($memory) | from [Helper](../../../../component/console/helper/helper#method_formatMemory "Symfony\Component\Console\Helper\Helper") |
| static | [strlenWithoutDecoration](#method_strlenWithoutDecoration)([OutputFormatterInterface](../../../../component/console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") $formatter, $string) | from [Helper](../../../../component/console/helper/helper#method_strlenWithoutDecoration "Symfony\Component\Console\Helper\Helper") |
| static | [removeDecoration](#method_removeDecoration)([OutputFormatterInterface](../../../../component/console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") $formatter, $string) | from [Helper](../../../../component/console/helper/helper#method_removeDecoration "Symfony\Component\Console\Helper\Helper") |
| | [\_\_construct](#method___construct)() | |
| | [describe](#method_describe)([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. | from [DescriptorHelper](../../../../component/console/helper/descriptorhelper#method_describe "Symfony\Component\Console\Helper\DescriptorHelper") |
| $this | [register](#method_register)(string $format, [DescriptorInterface](../../../../component/console/descriptor/descriptorinterface "Symfony\Component\Console\Descriptor\DescriptorInterface") $descriptor) Registers a descriptor. | from [DescriptorHelper](../../../../component/console/helper/descriptorhelper#method_register "Symfony\Component\Console\Helper\DescriptorHelper") |
| string | [getName](#method_getName)() Returns the canonical name of this helper. | from [DescriptorHelper](../../../../component/console/helper/descriptorhelper#method_getName "Symfony\Component\Console\Helper\DescriptorHelper") |
Details
-------
###
setHelperSet([HelperSet](../../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet = null)
Sets the helper set associated with this helper.
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set associated with this helper.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### static int
strlen(string $string)
Returns the length of a string, using mb\_strwidth if it is available.
#### Parameters
| | | |
| --- | --- | --- |
| string | $string | The string to check its length |
#### Return Value
| | |
| --- | --- |
| int | The length of the string |
### static string
substr(string $string, int $from, int|null $length = null)
Returns the subset of a string, using mb\_substr if it is available.
#### Parameters
| | | |
| --- | --- | --- |
| string | $string | String to subset |
| int | $from | Start offset |
| int|null | $length | Length to read |
#### Return Value
| | |
| --- | --- |
| string | The string subset |
### static
formatTime($secs)
#### Parameters
| | | |
| --- | --- | --- |
| | $secs | |
### static
formatMemory($memory)
#### Parameters
| | | |
| --- | --- | --- |
| | $memory | |
### static
strlenWithoutDecoration([OutputFormatterInterface](../../../../component/console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") $formatter, $string)
#### Parameters
| | | |
| --- | --- | --- |
| [OutputFormatterInterface](../../../../component/console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") | $formatter | |
| | $string | |
### static
removeDecoration([OutputFormatterInterface](../../../../component/console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") $formatter, $string)
#### Parameters
| | | |
| --- | --- | --- |
| [OutputFormatterInterface](../../../../component/console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") | $formatter | |
| | $string | |
###
\_\_construct()
###
describe([OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array())
Describes an object if supported.
Available options are: \* format: string, the output format name \* raw\_text: boolean, sets output type as raw
#### Parameters
| | | |
| --- | --- | --- |
| [OutputInterface](../../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
| object | $object | |
| array | $options | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | when the given format is not supported |
### $this
register(string $format, [DescriptorInterface](../../../../component/console/descriptor/descriptorinterface "Symfony\Component\Console\Descriptor\DescriptorInterface") $descriptor)
Registers a descriptor.
#### Parameters
| | | |
| --- | --- | --- |
| string | $format | |
| [DescriptorInterface](../../../../component/console/descriptor/descriptorinterface "Symfony\Component\Console\Descriptor\DescriptorInterface") | $descriptor | |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the canonical name of this helper.
#### Return Value
| | |
| --- | --- |
| string | The canonical name |
| programming_docs |
symfony ResolveControllerNameSubscriber deprecated ResolveControllerNameSubscriber deprecated
===========================================
class **ResolveControllerNameSubscriber** implements [EventSubscriberInterface](../../../component/eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface")
deprecated
| since | Symfony 4.1 |
Guarantees that the \_controller key is parsed into its final format.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([ControllerNameParser](../controller/controllernameparser "Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser") $parser) | |
| | [onKernelRequest](#method_onKernelRequest)([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event) | |
| static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | |
Details
-------
###
\_\_construct([ControllerNameParser](../controller/controllernameparser "Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser") $parser)
#### Parameters
| | | |
| --- | --- | --- |
| [ControllerNameParser](../controller/controllernameparser "Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser") | $parser | |
###
onKernelRequest([GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") $event)
#### Parameters
| | | |
| --- | --- | --- |
| [GetResponseEvent](../../../component/httpkernel/event/getresponseevent "Symfony\Component\HttpKernel\Event\GetResponseEvent") | $event | |
### static array
getSubscribedEvents()
Returns an array of event names this subscriber wants to listen to.
The array keys are event names and the value can be:
* The method name to call (priority defaults to 0)
* An array composed of the method name to call and the priority
* An array of arrays composed of the method names to call and respective priorities, or 0 if unset
For instance:
* array('eventName' => 'methodName')
* array('eventName' => array('methodName', $priority))
* array('eventName' => array(array('methodName1', $priority), array('methodName2')))
#### Return Value
| | |
| --- | --- |
| array | The event names to listen to |
symfony WebProfilerBundle WebProfilerBundle
==================
class **WebProfilerBundle** extends [Bundle](../../component/httpkernel/bundle/bundle "Symfony\Component\HttpKernel\Bundle\Bundle")
Bundle.
Traits
------
| | |
| --- | --- |
| [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait "Symfony\Component\DependencyInjection\ContainerAwareTrait") | ContainerAware trait. |
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | | from [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait#property_container "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| protected | $name | | from [Bundle](../../component/httpkernel/bundle/bundle#property_name "Symfony\Component\HttpKernel\Bundle\Bundle") |
| protected | $extension | | from [Bundle](../../component/httpkernel/bundle/bundle#property_extension "Symfony\Component\HttpKernel\Bundle\Bundle") |
| protected | $path | | from [Bundle](../../component/httpkernel/bundle/bundle#property_path "Symfony\Component\HttpKernel\Bundle\Bundle") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setContainer](#method_setContainer)([ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null) | from [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait#method_setContainer "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| | [boot](#method_boot)() Boots the Bundle. | from [Bundle](../../component/httpkernel/bundle/bundle#method_boot "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [shutdown](#method_shutdown)() Shutdowns the Bundle. | from [Bundle](../../component/httpkernel/bundle/bundle#method_shutdown "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [build](#method_build)([ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Builds the bundle. | from [Bundle](../../component/httpkernel/bundle/bundle#method_build "Symfony\Component\HttpKernel\Bundle\Bundle") |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | [getContainerExtension](#method_getContainerExtension)() Returns the bundle's container extension. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getContainerExtension "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getNamespace](#method_getNamespace)() Gets the Bundle namespace. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getNamespace "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getPath](#method_getPath)() Gets the Bundle directory path. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getPath "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getName](#method_getName)() Returns the bundle name (the class short name). | from [Bundle](../../component/httpkernel/bundle/bundle#method_getName "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [registerCommands](#method_registerCommands)([Application](../../component/console/application "Symfony\Component\Console\Application") $application) | from [Bundle](../../component/httpkernel/bundle/bundle#method_registerCommands "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getContainerExtensionClass](#method_getContainerExtensionClass)() Returns the bundle's container extension class. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getContainerExtensionClass "Symfony\Component\HttpKernel\Bundle\Bundle") |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | [createContainerExtension](#method_createContainerExtension)() Creates the bundle's container extension. | from [Bundle](../../component/httpkernel/bundle/bundle#method_createContainerExtension "Symfony\Component\HttpKernel\Bundle\Bundle") |
Details
-------
###
setContainer([ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | |
###
boot()
Boots the Bundle.
###
shutdown()
Shutdowns the Bundle.
###
build([ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Builds the bundle.
It is only ever called once when the cache is empty.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
### [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null
getContainerExtension()
Returns the bundle's container extension.
#### Return Value
| | |
| --- | --- |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | The default extension or null if there is none |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### string
getNamespace()
Gets the Bundle namespace.
#### Return Value
| | |
| --- | --- |
| string | The Bundle namespace |
### string
getPath()
Gets the Bundle directory path.
The path should always be returned as a Unix path (with /).
#### Return Value
| | |
| --- | --- |
| string | The Bundle absolute path |
### final string
getName()
Returns the bundle name (the class short name).
#### Return Value
| | |
| --- | --- |
| string | The Bundle name |
###
registerCommands([Application](../../component/console/application "Symfony\Component\Console\Application") $application)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../component/console/application "Symfony\Component\Console\Application") | $application | |
### protected string
getContainerExtensionClass()
Returns the bundle's container extension class.
#### Return Value
| | |
| --- | --- |
| string | |
### protected [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null
createContainerExtension()
Creates the bundle's container extension.
#### Return Value
| | |
| --- | --- |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | |
symfony Symfony\Bundle\WebProfilerBundle\Controller Symfony\Bundle\WebProfilerBundle\Controller
===========================================
Classes
-------
| | |
| --- | --- |
| [ExceptionController](controller/exceptioncontroller "Symfony\Bundle\WebProfilerBundle\Controller\ExceptionController") | ExceptionController. |
| [ProfilerController](controller/profilercontroller "Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController") | |
| [RouterController](controller/routercontroller "Symfony\Bundle\WebProfilerBundle\Controller\RouterController") | RouterController. |
symfony Symfony\Bundle\WebProfilerBundle\Profiler Symfony\Bundle\WebProfilerBundle\Profiler
=========================================
Classes
-------
| | |
| --- | --- |
| [TemplateManager](profiler/templatemanager "Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager") | Profiler Templates Manager. |
symfony Symfony\Bundle\WebProfilerBundle\DependencyInjection Symfony\Bundle\WebProfilerBundle\DependencyInjection
====================================================
Classes
-------
| | |
| --- | --- |
| [Configuration](dependencyinjection/configuration "Symfony\Bundle\WebProfilerBundle\DependencyInjection\Configuration") | This class contains the configuration information for the bundle. |
| [WebProfilerExtension](dependencyinjection/webprofilerextension "Symfony\Bundle\WebProfilerBundle\DependencyInjection\WebProfilerExtension") | WebProfilerExtension. |
symfony Symfony\Bundle\WebProfilerBundle\Csp Symfony\Bundle\WebProfilerBundle\Csp
====================================
Classes
-------
| | |
| --- | --- |
| [ContentSecurityPolicyHandler](csp/contentsecuritypolicyhandler "Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler") | Handles Content-Security-Policy HTTP header for the WebProfiler Bundle. |
| [NonceGenerator](csp/noncegenerator "Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator") | Generates Content-Security-Policy nonce. |
symfony Symfony\Bundle\WebProfilerBundle\EventListener Symfony\Bundle\WebProfilerBundle\EventListener
==============================================
Classes
-------
| | |
| --- | --- |
| [WebDebugToolbarListener](eventlistener/webdebugtoolbarlistener "Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener") | WebDebugToolbarListener injects the Web Debug Toolbar. |
symfony Symfony\Bundle\WebProfilerBundle\Twig Symfony\Bundle\WebProfilerBundle\Twig
=====================================
Classes
-------
| | |
| --- | --- |
| [WebProfilerExtension](twig/webprofilerextension "Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension") | Twig extension for the profiler. |
symfony RouterController RouterController
=================
class **RouterController**
RouterController.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") $profiler = null, Environment $twig, [UrlMatcherInterface](../../../component/routing/matcher/urlmatcherinterface "Symfony\Component\Routing\Matcher\UrlMatcherInterface") $matcher = null, [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes = null) | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [panelAction](#method_panelAction)(string $token) Renders the profiler panel for the given token. | |
Details
-------
###
\_\_construct([Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") $profiler = null, Environment $twig, [UrlMatcherInterface](../../../component/routing/matcher/urlmatcherinterface "Symfony\Component\Routing\Matcher\UrlMatcherInterface") $matcher = null, [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") $routes = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") | $profiler | |
| Environment | $twig | |
| [UrlMatcherInterface](../../../component/routing/matcher/urlmatcherinterface "Symfony\Component\Routing\Matcher\UrlMatcherInterface") | $matcher | |
| [RouteCollection](../../../component/routing/routecollection "Symfony\Component\Routing\RouteCollection") | $routes | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
panelAction(string $token)
Renders the profiler panel for the given token.
#### Parameters
| | | |
| --- | --- | --- |
| string | $token | The profiler token |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
symfony ProfilerController ProfilerController
===================
class **ProfilerController**
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") $generator, [Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") $profiler = null, Environment $twig, array $templates, [ContentSecurityPolicyHandler](../csp/contentsecuritypolicyhandler "Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler") $cspHandler = null, string $baseDir = null) | |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | [homeAction](#method_homeAction)() Redirects to the last profiles. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [panelAction](#method_panelAction)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $token) Renders a profiler panel for the given token. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [toolbarAction](#method_toolbarAction)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $token) Renders the Web Debug Toolbar. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [searchBarAction](#method_searchBarAction)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request) Renders the profiler search bar. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [searchResultsAction](#method_searchResultsAction)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $token) Renders the search results. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [searchAction](#method_searchAction)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request) Narrows the search bar. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [phpinfoAction](#method_phpinfoAction)() Displays the PHP info. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [openAction](#method_openAction)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request) Displays the source of a file. | |
| [TemplateManager](../profiler/templatemanager "Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager") | [getTemplateManager](#method_getTemplateManager)() Gets the Template Manager. | |
Details
-------
###
\_\_construct([UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") $generator, [Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") $profiler = null, Environment $twig, array $templates, [ContentSecurityPolicyHandler](../csp/contentsecuritypolicyhandler "Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler") $cspHandler = null, string $baseDir = null)
#### Parameters
| | | |
| --- | --- | --- |
| [UrlGeneratorInterface](../../../component/routing/generator/urlgeneratorinterface "Symfony\Component\Routing\Generator\UrlGeneratorInterface") | $generator | |
| [Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") | $profiler | |
| Environment | $twig | |
| array | $templates | |
| [ContentSecurityPolicyHandler](../csp/contentsecuritypolicyhandler "Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler") | $cspHandler | |
| string | $baseDir | |
### [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse")
homeAction()
Redirects to the last profiles.
#### Return Value
| | |
| --- | --- |
| [RedirectResponse](../../../component/httpfoundation/redirectresponse "Symfony\Component\HttpFoundation\RedirectResponse") | A RedirectResponse instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
panelAction([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $token)
Renders a profiler panel for the given token.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | The current HTTP request |
| string | $token | The profiler token |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
toolbarAction([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $token)
Renders the Web Debug Toolbar.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | The current HTTP Request |
| string | $token | The profiler token |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
searchBarAction([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request)
Renders the profiler search bar.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
searchResultsAction([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, string $token)
Renders the search results.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | The current HTTP Request |
| string | $token | The token |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
searchAction([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request)
Narrows the search bar.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
phpinfoAction()
Displays the PHP info.
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
openAction([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request)
Displays the source of a file.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### protected [TemplateManager](../profiler/templatemanager "Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager")
getTemplateManager()
Gets the Template Manager.
#### Return Value
| | |
| --- | --- |
| [TemplateManager](../profiler/templatemanager "Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager") | The Template Manager |
| programming_docs |
symfony ExceptionController ExceptionController
====================
class **ExceptionController**
ExceptionController.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $twig | | |
| protected | $debug | | |
| protected | $profiler | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") $profiler = null, Environment $twig, bool $debug, [FileLinkFormatter](../../../component/httpkernel/debug/filelinkformatter "Symfony\Component\HttpKernel\Debug\FileLinkFormatter") $fileLinkFormat = null) | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [showAction](#method_showAction)(string $token) Renders the exception panel for the given token. | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | [cssAction](#method_cssAction)(string $token) Renders the exception panel stylesheet for the given token. | |
| | [getTemplate](#method_getTemplate)() | |
| | [templateExists](#method_templateExists)($template) | |
Details
-------
###
\_\_construct([Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") $profiler = null, Environment $twig, bool $debug, [FileLinkFormatter](../../../component/httpkernel/debug/filelinkformatter "Symfony\Component\HttpKernel\Debug\FileLinkFormatter") $fileLinkFormat = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") | $profiler | |
| Environment | $twig | |
| bool | $debug | |
| [FileLinkFormatter](../../../component/httpkernel/debug/filelinkformatter "Symfony\Component\HttpKernel\Debug\FileLinkFormatter") | $fileLinkFormat | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
showAction(string $token)
Renders the exception panel for the given token.
#### Parameters
| | | |
| --- | --- | --- |
| string | $token | The profiler token |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response")
cssAction(string $token)
Renders the exception panel stylesheet for the given token.
#### Parameters
| | | |
| --- | --- | --- |
| string | $token | The profiler token |
#### Return Value
| | |
| --- | --- |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | A Response instance |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### protected
getTemplate()
### protected
templateExists($template)
#### Parameters
| | | |
| --- | --- | --- |
| | $template | |
symfony NonceGenerator NonceGenerator
===============
class **NonceGenerator**
Generates Content-Security-Policy nonce.
Methods
-------
| | | |
| --- | --- | --- |
| | [generate](#method_generate)() | |
Details
-------
###
generate()
symfony ContentSecurityPolicyHandler ContentSecurityPolicyHandler
=============================
class **ContentSecurityPolicyHandler**
Handles Content-Security-Policy HTTP header for the WebProfiler Bundle.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([NonceGenerator](noncegenerator "Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator") $nonceGenerator) | |
| array | [getNonces](#method_getNonces)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response) Returns an array of nonces to be used in Twig templates and Content-Security-Policy headers. | |
| | [disableCsp](#method_disableCsp)() Disables Content-Security-Policy. | |
| array | [updateResponseHeaders](#method_updateResponseHeaders)([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response) Cleanup temporary headers and updates Content-Security-Policy headers. | |
Details
-------
###
\_\_construct([NonceGenerator](noncegenerator "Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator") $nonceGenerator)
#### Parameters
| | | |
| --- | --- | --- |
| [NonceGenerator](noncegenerator "Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator") | $nonceGenerator | |
### array
getNonces([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response)
Returns an array of nonces to be used in Twig templates and Content-Security-Policy headers.
Nonce can be provided by; - The request - In case HTML content is fetched via AJAX and inserted in DOM, it must use the same nonce as origin - The response - A call to getNonces() has already been done previously. Same nonce are returned - They are otherwise randomly generated
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | |
#### Return Value
| | |
| --- | --- |
| array | |
###
disableCsp()
Disables Content-Security-Policy.
All related headers will be removed.
### array
updateResponseHeaders([Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response)
Cleanup temporary headers and updates Content-Security-Policy headers.
#### Parameters
| | | |
| --- | --- | --- |
| [Request](../../../component/httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | |
| [Response](../../../component/httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | |
#### Return Value
| | |
| --- | --- |
| array | Nonces used by the bundle in Content-Security-Policy header |
symfony TemplateManager TemplateManager
================
class **TemplateManager**
Profiler Templates Manager.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected | $twig | | |
| protected | $templates | | |
| protected | $profiler | | |
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") $profiler, Environment $twig, array $templates) | |
| mixed | [getName](#method_getName)([Profile](../../../component/httpkernel/profiler/profile "Symfony\Component\HttpKernel\Profiler\Profile") $profile, string $panel) Gets the template name for a given panel. | |
| array | [getNames](#method_getNames)([Profile](../../../component/httpkernel/profiler/profile "Symfony\Component\HttpKernel\Profiler\Profile") $profile) Gets template names of templates that are present in the viewed profile. | |
| | [templateExists](#method_templateExists)($template) | |
Details
-------
###
\_\_construct([Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") $profiler, Environment $twig, array $templates)
#### Parameters
| | | |
| --- | --- | --- |
| [Profiler](../../../component/httpkernel/profiler/profiler "Symfony\Component\HttpKernel\Profiler\Profiler") | $profiler | |
| Environment | $twig | |
| array | $templates | |
### mixed
getName([Profile](../../../component/httpkernel/profiler/profile "Symfony\Component\HttpKernel\Profiler\Profile") $profile, string $panel)
Gets the template name for a given panel.
#### Parameters
| | | |
| --- | --- | --- |
| [Profile](../../../component/httpkernel/profiler/profile "Symfony\Component\HttpKernel\Profiler\Profile") | $profile | |
| string | $panel | |
#### Return Value
| | |
| --- | --- |
| mixed | |
#### Exceptions
| | |
| --- | --- |
| [NotFoundHttpException](../../../component/httpkernel/exception/notfoundhttpexception "Symfony\Component\HttpKernel\Exception\NotFoundHttpException") | |
### array
getNames([Profile](../../../component/httpkernel/profiler/profile "Symfony\Component\HttpKernel\Profiler\Profile") $profile)
Gets template names of templates that are present in the viewed profile.
#### Parameters
| | | |
| --- | --- | --- |
| [Profile](../../../component/httpkernel/profiler/profile "Symfony\Component\HttpKernel\Profiler\Profile") | $profile | |
#### Return Value
| | |
| --- | --- |
| array | |
#### Exceptions
| | |
| --- | --- |
| [UnexpectedValueException](http://php.net/UnexpectedValueException) | |
### protected
templateExists($template)
#### Parameters
| | | |
| --- | --- | --- |
| | $template | |
symfony WebProfilerExtension WebProfilerExtension
=====================
class **WebProfilerExtension** extends ProfilerExtension
Twig extension for the profiler.
Methods
-------
| | | |
| --- | --- | --- |
| | [\_\_construct](#method___construct)([HtmlDumper](../../../component/vardumper/dumper/htmldumper "Symfony\Component\VarDumper\Dumper\HtmlDumper") $dumper = null) | |
| | [enter](#method_enter)(Profile $profile) | |
| | [leave](#method_leave)(Profile $profile) | |
| | [getFunctions](#method_getFunctions)() {@inheritdoc} | |
| | [dumpData](#method_dumpData)(Environment $env, [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") $data, $maxDepth = 0) | |
| | [dumpLog](#method_dumpLog)(Environment $env, $message, [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") $context = null) | |
| | [getName](#method_getName)() {@inheritdoc} | |
Details
-------
###
\_\_construct([HtmlDumper](../../../component/vardumper/dumper/htmldumper "Symfony\Component\VarDumper\Dumper\HtmlDumper") $dumper = null)
#### Parameters
| | | |
| --- | --- | --- |
| [HtmlDumper](../../../component/vardumper/dumper/htmldumper "Symfony\Component\VarDumper\Dumper\HtmlDumper") | $dumper | |
###
enter(Profile $profile)
#### Parameters
| | | |
| --- | --- | --- |
| Profile | $profile | |
###
leave(Profile $profile)
#### Parameters
| | | |
| --- | --- | --- |
| Profile | $profile | |
###
getFunctions()
{@inheritdoc}
###
dumpData(Environment $env, [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") $data, $maxDepth = 0)
#### Parameters
| | | |
| --- | --- | --- |
| Environment | $env | |
| [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | $data | |
| | $maxDepth | |
###
dumpLog(Environment $env, $message, [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") $context = null)
#### Parameters
| | | |
| --- | --- | --- |
| Environment | $env | |
| | $message | |
| [Data](../../../component/vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | $context | |
###
getName()
{@inheritdoc}
symfony Configuration Configuration
==============
class **Configuration** implements [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")
This class contains the configuration information for the bundle.
This information is solely responsible for how the different configuration sections are normalized, and merged.
Methods
-------
| | | |
| --- | --- | --- |
| [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder") | [getConfigTreeBuilder](#method_getConfigTreeBuilder)() Generates the configuration tree builder. | |
Details
-------
### [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder")
getConfigTreeBuilder()
Generates the configuration tree builder.
#### Return Value
| | |
| --- | --- |
| [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder") | The tree builder |
symfony WebProfilerExtension WebProfilerExtension
=====================
class **WebProfilerExtension** extends [Extension](../../../component/dependencyinjection/extension/extension "Symfony\Component\DependencyInjection\Extension\Extension")
WebProfilerExtension.
Usage:
```
<webprofiler:config
toolbar="true"
intercept-redirects="true"
/>
```
Methods
-------
| | | |
| --- | --- | --- |
| string | [getXsdValidationBasePath](#method_getXsdValidationBasePath)() Returns the base path for the XSD files. | |
| string | [getNamespace](#method_getNamespace)() Returns the namespace to be used for this extension (XML namespace). | |
| string | [getAlias](#method_getAlias)() Returns the recommended alias to use in XML. | from [Extension](../../../component/dependencyinjection/extension/extension#method_getAlias "Symfony\Component\DependencyInjection\Extension\Extension") |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null | [getConfiguration](#method_getConfiguration)(array $config, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Returns extension configuration. | from [Extension](../../../component/dependencyinjection/extension/extension#method_getConfiguration "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [processConfiguration](#method_processConfiguration)([ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") $configuration, array $configs) | from [Extension](../../../component/dependencyinjection/extension/extension#method_processConfiguration "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [getProcessedConfigs](#method_getProcessedConfigs)() | from [Extension](../../../component/dependencyinjection/extension/extension#method_getProcessedConfigs "Symfony\Component\DependencyInjection\Extension\Extension") |
| bool | [isConfigEnabled](#method_isConfigEnabled)([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, array $config) | from [Extension](../../../component/dependencyinjection/extension/extension#method_isConfigEnabled "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [load](#method_load)(array $configs, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Loads the web profiler configuration. | |
Details
-------
### string
getXsdValidationBasePath()
Returns the base path for the XSD files.
#### Return Value
| | |
| --- | --- |
| string | The XSD base path |
### string
getNamespace()
Returns the namespace to be used for this extension (XML namespace).
#### Return Value
| | |
| --- | --- |
| string | The XML namespace |
### string
getAlias()
Returns the recommended alias to use in XML.
This alias is also the mandatory prefix to use when using YAML.
This convention is to remove the "Extension" postfix from the class name and then lowercase and underscore the result. So:
```
AcmeHelloExtension
```
becomes
```
acme_hello
```
This can be overridden in a sub-class to specify the alias manually.
#### Return Value
| | |
| --- | --- |
| string | The alias |
#### Exceptions
| | |
| --- | --- |
| [BadMethodCallException](../../../component/dependencyinjection/exception/badmethodcallexception "Symfony\Component\DependencyInjection\Exception\BadMethodCallException") | When the extension name does not follow conventions |
### [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null
getConfiguration(array $config, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Returns extension configuration.
#### Parameters
| | | |
| --- | --- | --- |
| array | $config | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
#### Return Value
| | |
| --- | --- |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null | The configuration or null |
### final protected
processConfiguration([ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") $configuration, array $configs)
#### Parameters
| | | |
| --- | --- | --- |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") | $configuration | |
| array | $configs | |
### final
getProcessedConfigs()
### protected bool
isConfigEnabled([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, array $config)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
| array | $config | |
#### Return Value
| | |
| --- | --- |
| bool | Whether the configuration is enabled |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/dependencyinjection/exception/invalidargumentexception "Symfony\Component\DependencyInjection\Exception\InvalidArgumentException") | When the config is not enableable |
###
load(array $configs, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Loads the web profiler configuration.
#### Parameters
| | | |
| --- | --- | --- |
| array | $configs | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
symfony WebDebugToolbarListener WebDebugToolbarListener
========================
class **WebDebugToolbarListener** implements [EventSubscriberInterface](../../../component/eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface")
WebDebugToolbarListener injects the Web Debug Toolbar.
The onKernelResponse method must be connected to the kernel.response event.
The WDT is only injected on well-formed HTML (with a proper
| programming_docs |
symfony Symfony\Bundle\DebugBundle\Command Symfony\Bundle\DebugBundle\Command
==================================
Classes
-------
| | |
| --- | --- |
| [ServerDumpPlaceholderCommand](command/serverdumpplaceholdercommand "Symfony\Bundle\DebugBundle\Command\ServerDumpPlaceholderCommand") | A placeholder command easing VarDumper server discovery. |
symfony Symfony\Bundle\DebugBundle\DependencyInjection Symfony\Bundle\DebugBundle\DependencyInjection
==============================================
Namespaces
----------
[Symfony\Bundle\DebugBundle\DependencyInjection\Compiler](dependencyinjection/compiler) Classes
-------
| | |
| --- | --- |
| [Configuration](dependencyinjection/configuration "Symfony\Bundle\DebugBundle\DependencyInjection\Configuration") | DebugExtension configuration structure. |
| [DebugExtension](dependencyinjection/debugextension "Symfony\Bundle\DebugBundle\DependencyInjection\DebugExtension") | DebugExtension. |
symfony DebugBundle DebugBundle
============
class **DebugBundle** extends [Bundle](../../component/httpkernel/bundle/bundle "Symfony\Component\HttpKernel\Bundle\Bundle")
Traits
------
| | |
| --- | --- |
| [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait "Symfony\Component\DependencyInjection\ContainerAwareTrait") | ContainerAware trait. |
Properties
----------
| | | | |
| --- | --- | --- | --- |
| protected [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | | from [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait#property_container "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| protected | $name | | from [Bundle](../../component/httpkernel/bundle/bundle#property_name "Symfony\Component\HttpKernel\Bundle\Bundle") |
| protected | $extension | | from [Bundle](../../component/httpkernel/bundle/bundle#property_extension "Symfony\Component\HttpKernel\Bundle\Bundle") |
| protected | $path | | from [Bundle](../../component/httpkernel/bundle/bundle#property_path "Symfony\Component\HttpKernel\Bundle\Bundle") |
Methods
-------
| | | |
| --- | --- | --- |
| | [setContainer](#method_setContainer)([ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null) | from [ContainerAwareTrait](../../component/dependencyinjection/containerawaretrait#method_setContainer "Symfony\Component\DependencyInjection\ContainerAwareTrait") |
| | [boot](#method_boot)() Boots the Bundle. | |
| | [shutdown](#method_shutdown)() Shutdowns the Bundle. | from [Bundle](../../component/httpkernel/bundle/bundle#method_shutdown "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [build](#method_build)([ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Builds the bundle. | |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | [getContainerExtension](#method_getContainerExtension)() Returns the bundle's container extension. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getContainerExtension "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getNamespace](#method_getNamespace)() Gets the Bundle namespace. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getNamespace "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getPath](#method_getPath)() Gets the Bundle directory path. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getPath "Symfony\Component\HttpKernel\Bundle\Bundle") |
| string | [getName](#method_getName)() Returns the bundle name (the class short name). | from [Bundle](../../component/httpkernel/bundle/bundle#method_getName "Symfony\Component\HttpKernel\Bundle\Bundle") |
| | [registerCommands](#method_registerCommands)([Application](../../component/console/application "Symfony\Component\Console\Application") $application) | |
| string | [getContainerExtensionClass](#method_getContainerExtensionClass)() Returns the bundle's container extension class. | from [Bundle](../../component/httpkernel/bundle/bundle#method_getContainerExtensionClass "Symfony\Component\HttpKernel\Bundle\Bundle") |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | [createContainerExtension](#method_createContainerExtension)() Creates the bundle's container extension. | from [Bundle](../../component/httpkernel/bundle/bundle#method_createContainerExtension "Symfony\Component\HttpKernel\Bundle\Bundle") |
Details
-------
###
setContainer([ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") $container = null)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerInterface](../../component/dependencyinjection/containerinterface "Symfony\Component\DependencyInjection\ContainerInterface") | $container | |
###
boot()
Boots the Bundle.
###
shutdown()
Shutdowns the Bundle.
###
build([ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Builds the bundle.
It is only ever called once when the cache is empty.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
### [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null
getContainerExtension()
Returns the bundle's container extension.
#### Return Value
| | |
| --- | --- |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | The default extension or null if there is none |
#### Exceptions
| | |
| --- | --- |
| [LogicException](http://php.net/LogicException) | |
### string
getNamespace()
Gets the Bundle namespace.
#### Return Value
| | |
| --- | --- |
| string | The Bundle namespace |
### string
getPath()
Gets the Bundle directory path.
The path should always be returned as a Unix path (with /).
#### Return Value
| | |
| --- | --- |
| string | The Bundle absolute path |
### final string
getName()
Returns the bundle name (the class short name).
#### Return Value
| | |
| --- | --- |
| string | The Bundle name |
###
registerCommands([Application](../../component/console/application "Symfony\Component\Console\Application") $application)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../component/console/application "Symfony\Component\Console\Application") | $application | |
### protected string
getContainerExtensionClass()
Returns the bundle's container extension class.
#### Return Value
| | |
| --- | --- |
| string | |
### protected [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null
createContainerExtension()
Creates the bundle's container extension.
#### Return Value
| | |
| --- | --- |
| [ExtensionInterface](../../component/dependencyinjection/extension/extensioninterface "Symfony\Component\DependencyInjection\Extension\ExtensionInterface")|null | |
symfony ServerDumpPlaceholderCommand ServerDumpPlaceholderCommand
=============================
class **ServerDumpPlaceholderCommand** extends [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
A placeholder command easing VarDumper server discovery.
Properties
----------
| | | | |
| --- | --- | --- | --- |
| static protected string|null | $defaultName | | from [Command](../../../component/console/command/command#property_defaultName "Symfony\Component\Console\Command\Command") |
Methods
-------
| | | |
| --- | --- | --- |
| static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../../component/console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") |
| | [\_\_construct](#method___construct)([DumpServer](../../../component/vardumper/server/dumpserver "Symfony\Component\VarDumper\Server\DumpServer") $server = null, array $descriptors = array()) | |
| | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../../component/console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") |
| | [setApplication](#method_setApplication)([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../../component/console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") |
| | [setHelperSet](#method_setHelperSet)([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../../component/console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../../component/console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../../component/console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") |
| bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../../component/console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") |
| | [configure](#method_configure)() Configures the current command. | |
| int|null | [execute](#method_execute)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | |
| | [interact](#method_interact)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../../component/console/command/command#method_interact "Symfony\Component\Console\Command\Command") |
| | [initialize](#method_initialize)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../../component/console/command/command#method_initialize "Symfony\Component\Console\Command\Command") |
| int | [run](#method_run)([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../../component/console/command/command#method_run "Symfony\Component\Console\Command\Command") |
| $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../../component/console/command/command#method_setCode "Symfony\Component\Console\Command\Command") |
| | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../../component/console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") |
| $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../../component/console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../../component/console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../../component/console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") |
| $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../../component/console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") |
| $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../../component/console/command/command#method_addOption "Symfony\Component\Console\Command\Command") |
| $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../../component/console/command/command#method_setName "Symfony\Component\Console\Command\Command") |
| $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../../component/console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") |
| string | [getName](#method_getName)() Returns the command name. | from [Command](../../../component/console/command/command#method_getName "Symfony\Component\Console\Command\Command") |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../../component/console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") |
| bool | [isHidden](#method_isHidden)() | from [Command](../../../component/console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") |
| $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../../component/console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") |
| string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../../component/console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") |
| $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../../component/console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") |
| string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../../component/console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") |
| string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../../component/console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") |
| $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../../component/console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") |
| array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../../component/console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") |
| string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../../component/console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") |
| $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../../component/console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") |
| array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../../component/console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") |
| mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../../component/console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") |
Details
-------
### static string|null
getDefaultName()
#### Return Value
| | |
| --- | --- |
| string|null | The default command name or null when no default name is set |
###
\_\_construct([DumpServer](../../../component/vardumper/server/dumpserver "Symfony\Component\VarDumper\Server\DumpServer") $server = null, array $descriptors = array())
#### Parameters
| | | |
| --- | --- | --- |
| [DumpServer](../../../component/vardumper/server/dumpserver "Symfony\Component\VarDumper\Server\DumpServer") | $server | |
| array | $descriptors | |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty |
###
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
###
setApplication([Application](../../../component/console/application "Symfony\Component\Console\Application") $application = null)
#### Parameters
| | | |
| --- | --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | $application | |
###
setHelperSet([HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet)
#### Parameters
| | | |
| --- | --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | |
### [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet")
getHelperSet()
Gets the helper set.
#### Return Value
| | |
| --- | --- |
| [HelperSet](../../../component/console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance |
### [Application](../../../component/console/application "Symfony\Component\Console\Application")
getApplication()
Gets the application instance for this command.
#### Return Value
| | |
| --- | --- |
| [Application](../../../component/console/application "Symfony\Component\Console\Application") | An Application instance |
### bool
isEnabled()
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
#### Return Value
| | |
| --- | --- |
| bool | |
### protected
configure()
Configures the current command.
### protected int|null
execute([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int|null | null or 0 if everything went fine, or an error code |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented |
### protected
interact([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
### protected
initialize([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### See also
| | |
| --- | --- |
| [InputInterface::bind](../../../component/console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | |
| [InputInterface::validate](../../../component/console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | |
### int
run([InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output)
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
#### Parameters
| | | |
| --- | --- | --- |
| [InputInterface](../../../component/console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | |
| [OutputInterface](../../../component/console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | |
#### Return Value
| | |
| --- | --- |
| int | The command exit code |
#### Exceptions
| | |
| --- | --- |
| [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
#### See also
| | |
| --- | --- |
| setCode() | |
| execute() | |
### $this
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
#### Parameters
| | | |
| --- | --- | --- |
| callable | $code | A callable(InputInterface $input, OutputInterface $output) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | |
#### See also
| | |
| --- | --- |
| execute() | |
###
mergeApplicationDefinition(bool $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
### $this
setDefinition(array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition)
Sets an array of argument and option instances.
#### Parameters
| | | |
| --- | --- | --- |
| array|[InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance |
#### Return Value
| | |
| --- | --- |
| $this | |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getDefinition()
Gets the InputDefinition attached to this Command.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition")
getNativeDefinition()
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
#### Return Value
| | |
| --- | --- |
| [InputDefinition](../../../component/console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance |
### $this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)
Adds an argument.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The argument name |
| int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
| string | $description | A description text |
| string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid |
### $this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)
Adds an option.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The option name |
| string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
| int|null | $mode | The option mode: One of the VALUE\_\* constants |
| string | $description | A description text |
| string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible |
### $this
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
```
$command->setName('foo:bar');
```
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The command name |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid |
### $this
setProcessTitle(string $title)
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
#### Parameters
| | | |
| --- | --- | --- |
| string | $title | The process title |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getName()
Returns the command name.
#### Return Value
| | |
| --- | --- |
| string | The command name |
### [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command")
setHidden(bool $hidden)
#### Parameters
| | | |
| --- | --- | --- |
| bool | $hidden | Whether or not the command should be hidden from the list of commands |
#### Return Value
| | |
| --- | --- |
| [Command](../../../component/console/command/command "Symfony\Component\Console\Command\Command") | The current instance |
### bool
isHidden()
#### Return Value
| | |
| --- | --- |
| bool | whether the command should be publicly shown or not |
### $this
setDescription(string $description)
Sets the description for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $description | The description for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getDescription()
Returns the description for the command.
#### Return Value
| | |
| --- | --- |
| string | The description for the command |
### $this
setHelp(string $help)
Sets the help for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string | $help | The help for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
### string
getHelp()
Returns the help for the command.
#### Return Value
| | |
| --- | --- |
| string | The help for the command |
### string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically.
#### Return Value
| | |
| --- | --- |
| string | The processed help for the command |
### $this
setAliases(string[] $aliases)
Sets the aliases for the command.
#### Parameters
| | | |
| --- | --- | --- |
| string[] | $aliases | An array of aliases for the command |
#### Return Value
| | |
| --- | --- |
| $this | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid |
### array
getAliases()
Returns the aliases for the command.
#### Return Value
| | |
| --- | --- |
| array | An array of aliases for the command |
### string
getSynopsis(bool $short = false)
Returns the synopsis for the command.
#### Parameters
| | | |
| --- | --- | --- |
| bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
#### Return Value
| | |
| --- | --- |
| string | The synopsis |
### $this
addUsage(string $usage)
Add a command usage example.
#### Parameters
| | | |
| --- | --- | --- |
| string | $usage | The usage, it'll be prefixed with the command name |
#### Return Value
| | |
| --- | --- |
| $this | |
### array
getUsages()
Returns alternative usages of the command.
#### Return Value
| | |
| --- | --- |
| array | |
### mixed
getHelper(string $name)
Gets a helper instance by name.
#### Parameters
| | | |
| --- | --- | --- |
| string | $name | The helper name |
#### Return Value
| | |
| --- | --- |
| mixed | The helper value |
#### Exceptions
| | |
| --- | --- |
| [LogicException](../../../component/console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined |
| [InvalidArgumentException](../../../component/console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
| programming_docs |
symfony Configuration Configuration
==============
class **Configuration** implements [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")
DebugExtension configuration structure.
Methods
-------
| | | |
| --- | --- | --- |
| [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder") | [getConfigTreeBuilder](#method_getConfigTreeBuilder)() Generates the configuration tree builder. | |
Details
-------
### [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder")
getConfigTreeBuilder()
Generates the configuration tree builder.
#### Return Value
| | |
| --- | --- |
| [TreeBuilder](../../../component/config/definition/builder/treebuilder "Symfony\Component\Config\Definition\Builder\TreeBuilder") | The tree builder |
symfony Symfony\Bundle\DebugBundle\DependencyInjection\Compiler Symfony\Bundle\DebugBundle\DependencyInjection\Compiler
=======================================================
Classes
-------
| | |
| --- | --- |
| [DumpDataCollectorPass](compiler/dumpdatacollectorpass "Symfony\Bundle\DebugBundle\DependencyInjection\Compiler\DumpDataCollectorPass") | Registers the file link format for the {@link \Symfony\Component\HttpKernel\DataCollector\DumpDataCollector}. |
symfony DebugExtension DebugExtension
===============
class **DebugExtension** extends [Extension](../../../component/dependencyinjection/extension/extension "Symfony\Component\DependencyInjection\Extension\Extension")
DebugExtension.
Methods
-------
| | | |
| --- | --- | --- |
| string | [getXsdValidationBasePath](#method_getXsdValidationBasePath)() Returns the base path for the XSD files. | |
| string | [getNamespace](#method_getNamespace)() Returns the namespace to be used for this extension (XML namespace). | |
| string | [getAlias](#method_getAlias)() Returns the recommended alias to use in XML. | from [Extension](../../../component/dependencyinjection/extension/extension#method_getAlias "Symfony\Component\DependencyInjection\Extension\Extension") |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null | [getConfiguration](#method_getConfiguration)(array $config, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Returns extension configuration. | from [Extension](../../../component/dependencyinjection/extension/extension#method_getConfiguration "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [processConfiguration](#method_processConfiguration)([ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") $configuration, array $configs) | from [Extension](../../../component/dependencyinjection/extension/extension#method_processConfiguration "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [getProcessedConfigs](#method_getProcessedConfigs)() | from [Extension](../../../component/dependencyinjection/extension/extension#method_getProcessedConfigs "Symfony\Component\DependencyInjection\Extension\Extension") |
| bool | [isConfigEnabled](#method_isConfigEnabled)([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, array $config) | from [Extension](../../../component/dependencyinjection/extension/extension#method_isConfigEnabled "Symfony\Component\DependencyInjection\Extension\Extension") |
| | [load](#method_load)(array $configs, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) Loads a specific configuration. | |
Details
-------
### string
getXsdValidationBasePath()
Returns the base path for the XSD files.
#### Return Value
| | |
| --- | --- |
| string | The XSD base path |
### string
getNamespace()
Returns the namespace to be used for this extension (XML namespace).
#### Return Value
| | |
| --- | --- |
| string | The XML namespace |
### string
getAlias()
Returns the recommended alias to use in XML.
This alias is also the mandatory prefix to use when using YAML.
This convention is to remove the "Extension" postfix from the class name and then lowercase and underscore the result. So:
```
AcmeHelloExtension
```
becomes
```
acme_hello
```
This can be overridden in a sub-class to specify the alias manually.
#### Return Value
| | |
| --- | --- |
| string | The alias |
#### Exceptions
| | |
| --- | --- |
| [BadMethodCallException](../../../component/dependencyinjection/exception/badmethodcallexception "Symfony\Component\DependencyInjection\Exception\BadMethodCallException") | When the extension name does not follow conventions |
### [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null
getConfiguration(array $config, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Returns extension configuration.
#### Parameters
| | | |
| --- | --- | --- |
| array | $config | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
#### Return Value
| | |
| --- | --- |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface")|null | The configuration or null |
### final protected
processConfiguration([ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") $configuration, array $configs)
#### Parameters
| | | |
| --- | --- | --- |
| [ConfigurationInterface](../../../component/config/definition/configurationinterface "Symfony\Component\Config\Definition\ConfigurationInterface") | $configuration | |
| array | $configs | |
### final
getProcessedConfigs()
### protected bool
isConfigEnabled([ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container, array $config)
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
| array | $config | |
#### Return Value
| | |
| --- | --- |
| bool | Whether the configuration is enabled |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](../../../component/dependencyinjection/exception/invalidargumentexception "Symfony\Component\DependencyInjection\Exception\InvalidArgumentException") | When the config is not enableable |
###
load(array $configs, [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
Loads a specific configuration.
#### Parameters
| | | |
| --- | --- | --- |
| array | $configs | |
| [ContainerBuilder](../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
#### Exceptions
| | |
| --- | --- |
| [InvalidArgumentException](http://php.net/InvalidArgumentException) | When provided tag is not defined in this extension |
symfony DumpDataCollectorPass DumpDataCollectorPass
======================
class **DumpDataCollectorPass** implements [CompilerPassInterface](../../../../component/dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface")
Registers the file link format for the {@link \Symfony\Component\HttpKernel\DataCollector\DumpDataCollector}.
Methods
-------
| | | |
| --- | --- | --- |
| | [process](#method_process)([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | |
Details
-------
###
process([ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container)
You can modify the container here before it is dumped to PHP code.
#### Parameters
| | | |
| --- | --- | --- |
| [ContainerBuilder](../../../../component/dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | |
css initial-letter-align initial-letter-align
====================
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `initial-letter-align` CSS property specifies the alignment of initial letters within a paragraph.
```
/\* Keyword values \*/
initial-letter-align: auto;
initial-letter-align: alphabetic;
initial-letter-align: hanging;
initial-letter-align: ideographic;
/\* Global values \*/
initial-letter-align: inherit;
initial-letter-align: initial;
initial-letter-align: revert;
initial-letter-align: revert-layer;
initial-letter-align: unset;
```
Syntax
------
One of the keyword values listed below.
### Values
`auto` The user agent selects the value which corresponds to the language of the text. Western languages would default to alphabetic, CJK languages to ideographic, and some Indic languages to hanging.
`alphabetic` As described above, the cap height of the initial letter aligns with the cap height of the first line of text. The baseline of the initial letter aligns with the baseline of the Nth text baseline.
`hanging` The hanging baseline of the initial letter aligns with the hanging baseline of the first line of text.
`ideographic` The initial letter is centered in the N-line area.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | [`::first-letter`](::first-letter) pseudo-elements and inline-level first child of a block container |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
initial-letter-align =
[[](value_definition_syntax#brackets) border-box[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) alphabetic [|](value_definition_syntax#single_bar) ideographic [|](value_definition_syntax#single_bar) hanging [|](value_definition_syntax#single_bar) leading []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) ]!
```
Examples
--------
### Aligning initial letter
#### HTML
```
<p class="auto ">Initial letter - auto</p>
<p class="alphabetic">Initial letter - alphabetic</p>
<p class="hanging">Initial letter - hanging</p>
<p class="ideographic">Initial letter - ideographic</p>
```
#### CSS
```
.auto::first-letter {
-webkit-initial-letter-align: auto;
initial-letter-align: auto;
}
.alphabetic::first-letter {
-webkit-initial-letter-align: alphabetic;
initial-letter-align: alphabetic;
}
.hanging::first-letter {
-webkit-initial-letter-align: hanging;
initial-letter-align: hanging;
}
.ideographic::first-letter {
-webkit-initial-letter-align: ideographic;
initial-letter-align: ideographic;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Inline Layout Module Level 3 # aligning-initial-letter](https://w3c.github.io/csswg-drafts/css-inline/#aligning-initial-letter) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `initial-letter-align` | No | No | No
See [bug 1273021](https://bugzil.la/1273021). | No | No | No | No | No | No
See [bug 1273021](https://bugzil.la/1273021). | No | No | No |
* [`initial-letter`](initial-letter)
* [Drop caps in CSS](https://www.oddbird.net/2017/01/03/initial-letter/)
css border-top-left-radius border-top-left-radius
======================
The `border-top-left-radius` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property rounds the top-left corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner.
Try it
------
The rounding can be a circle or an ellipse, or if one of the value is `0`, no rounding is done and the corner is square.
A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the [`background-clip`](background-clip) property.
**Note:** If the value of this property is not set in a [`border-radius`](border-radius) shorthand property that is applied to the element after the `border-top-left-radius` CSS property, the value of this property is then reset to its initial value by the [shorthand property](shorthand_properties).
Syntax
------
```
/\* the corner is a circle \*/
/\* border-top-left-radius: radius \*/
border-top-left-radius: 3px;
/\* the corner is an ellipse \*/
/\* border-top-left-radius: horizontal vertical \*/
border-top-left-radius: 0.5em 1em;
border-top-left-radius: inherit;
/\* Global values \*/
border-top-left-radius: inherit;
border-top-left-radius: initial;
border-top-left-radius: revert;
border-top-left-radius: revert-layer;
border-top-left-radius: unset;
```
With one value:
* the value is a [`<length>`](length) or a [`<percentage>`](percentage) denoting the radius of the circle to use for the border in that corner.
With two values:
* the first value is a [`<length>`](length) or a [`<percentage>`](percentage) denoting the horizontal semi-major axis of the ellipse to use for the border in that corner.
* the second value is a [`<length>`](length) or a [`<percentage>`](percentage) denoting the vertical semi-major axis of the ellipse to use for the border in that corner.
### Values
`<length-percentage>` Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS [`<length>`](length) data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements; but User Agents are not required to apply to `table` and `inline-table` elements when [`border-collapse`](border-collapse) is `collapse`. The behavior on internal table elements is undefined for the moment.. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| Percentages | refer to the corresponding dimension of the border box |
| [Computed value](computed_value) | two absolute [`<length>`](length)s or [`<percentage>`](percentage)s |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
border-top-left-radius =
[<length-percentage [0,∞]>](length-percentage)[{1,2}](value_definition_syntax#curly_braces)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Arc of a circle
A single `<length>` value produces an arc of a circle.
```
div {
border-top-left-radius: 40px;
background-color: lightgreen;
border: solid 1px black;
width: 100px;
height: 100px;
}
```
### Arc of an ellipse
Two different `<length>` values produce an arc of an ellipse.
```
div {
border-top-left-radius: 40px 20px;
background-color: lightgreen;
border: solid 1px black;
width: 100px;
height: 100px;
}
```
### Square element with percentage radius
A square element with a single `<percentage>` value produces an arc of a circle.
```
div {
border-top-left-radius: 40%;
background-color: lightgreen;
border: solid 1px black;
width: 100px;
height: 100px;
}
```
### Non-square element with percentage radius
A non-square element with a single `<percentage>` value produces an arc of an ellipse.
```
div {
border-top-left-radius: 40%;
background-color: lightgreen;
border: solid 1px black;
width: 200px;
height: 100px;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # the-border-radius](https://w3c.github.io/csswg-drafts/css-backgrounds/#the-border-radius) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-top-left-radius` | 4
1 | 12
12 | 49
4
Before Firefox 50, border styles of rounded corners were always rendered as if `border-style` was solid. This has been fixed in Firefox 50.
1-12 | 9 | 15
10.5 | 5
3 | ≤37
≤37 | 18
18 | 49
4
Before Firefox 50, border styles of rounded corners were always rendered as if `border-style` was solid. This has been fixed in Firefox 50.
4-14 | 14
11 | 4.2
1 | 1.0
1.0 |
| `elliptical_corners` | 1 | 12 | 3.5 | 9 | 10.5 | 3 | ≤37 | 18 | 4 | 14 | 1 | 1.0 |
| `percentages` | 4 | 12 | 4
1-4
Before Firefox 4, the [`<percentage>`](https://developer.mozilla.org/docs/Web/CSS/percentage) was relative to the width of the box even when specifying the radius for a height. This implied that `-moz-border-radius-bottomright` was always drawing an arc of circle, and never an ellipse, when followed by a single value. | 9 | 10.5 | 5 | ≤37 | 18 | 4 | 14 | 4.2 | 1.0 |
See also
--------
* [`border-radius`](border-radius) shorthand property
* [`border-top-right-radius`](border-top-right-radius), [`border-bottom-right-radius`](border-bottom-right-radius), and [`border-bottom-left-radius`](border-bottom-left-radius)
css backdrop-filter backdrop-filter
===============
The `backdrop-filter` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property lets you apply graphical effects such as blurring or color shifting to the area behind an element. Because it applies to everything *behind* the element, to see the effect you must make the element or its background at least partially transparent.
Try it
------
Syntax
------
```
/\* Keyword value \*/
backdrop-filter: none;
/\* URL to SVG filter \*/
backdrop-filter: url(commonfilters.svg#filter);
/\* <filter-function> values \*/
backdrop-filter: blur(2px);
backdrop-filter: brightness(60%);
backdrop-filter: contrast(40%);
backdrop-filter: drop-shadow(4px 4px 10px blue);
backdrop-filter: grayscale(30%);
backdrop-filter: hue-rotate(120deg);
backdrop-filter: invert(70%);
backdrop-filter: opacity(20%);
backdrop-filter: sepia(90%);
backdrop-filter: saturate(80%);
/\* Multiple filters \*/
backdrop-filter: url(filters.svg#filter) blur(4px) saturate(150%);
/\* Global values \*/
backdrop-filter: inherit;
backdrop-filter: initial;
backdrop-filter: revert;
backdrop-filter: revert-layer;
backdrop-filter: unset;
```
### Values
`none` No filter is applied to the backdrop.
`<filter-function-list>` A space-separated list of [`<filter-function>`](filter-function)s or an [SVG filter](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/filter) that will be applied to the backdrop.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements; In SVG, it applies to container elements excluding the [`<defs>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs) element and all graphics elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | a [filter function list](filter#interpolation) |
Formal syntax
-------------
```
backdrop-filter =
none [|](value_definition_syntax#single_bar)
<filter-value-list>
<filter-value-list> =
[[](value_definition_syntax#brackets) <filter-function> [|](value_definition_syntax#single_bar) <url> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus)
<filter-function> =
<blur()> [|](value_definition_syntax#single_bar)
<brightness()> [|](value_definition_syntax#single_bar)
<contrast()> [|](value_definition_syntax#single_bar)
<drop-shadow()> [|](value_definition_syntax#single_bar)
<grayscale()> [|](value_definition_syntax#single_bar)
<hue-rotate()> [|](value_definition_syntax#single_bar)
<invert()> [|](value_definition_syntax#single_bar)
<opacity()> [|](value_definition_syntax#single_bar)
<sepia()> [|](value_definition_syntax#single_bar)
<saturate()>
<url> =
url( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) ) [|](value_definition_syntax#single_bar)
src( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) )
<blur()> =
blur( [<length>](length)[?](value_definition_syntax#question_mark) )
<brightness()> =
brightness( [[](value_definition_syntax#brackets) [<number>](number) [|](value_definition_syntax#single_bar) [<percentage>](percentage) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) )
<contrast()> =
contrast( [[](value_definition_syntax#brackets) [<number>](number) [|](value_definition_syntax#single_bar) [<percentage>](percentage) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) )
<drop-shadow()> =
drop-shadow( [[](value_definition_syntax#brackets) [<color>](color_value)[?](value_definition_syntax#question_mark) [&&](value_definition_syntax#double_ampersand) [<length>](length)[{2,3}](value_definition_syntax#curly_braces) []](value_definition_syntax#brackets) )
<grayscale()> =
grayscale( [[](value_definition_syntax#brackets) [<number>](number) [|](value_definition_syntax#single_bar) [<percentage>](percentage) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) )
<hue-rotate()> =
hue-rotate( [[](value_definition_syntax#brackets) [<angle>](angle) [|](value_definition_syntax#single_bar) [<zero>](zero) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) )
<invert()> =
invert( [[](value_definition_syntax#brackets) [<number>](number) [|](value_definition_syntax#single_bar) [<percentage>](percentage) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) )
<opacity()> =
opacity( [[](value_definition_syntax#brackets) [<number>](number) [|](value_definition_syntax#single_bar) [<percentage>](percentage) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) )
<sepia()> =
sepia( [[](value_definition_syntax#brackets) [<number>](number) [|](value_definition_syntax#single_bar) [<percentage>](percentage) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) )
<saturate()> =
saturate( [[](value_definition_syntax#brackets) [<number>](number) [|](value_definition_syntax#single_bar) [<percentage>](percentage) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) )
```
Examples
--------
### CSS
```
.box {
background-color: rgba(255, 255, 255, 0.3);
border-radius: 5px;
font-family: sans-serif;
text-align: center;
line-height: 1;
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
max-width: 50%;
max-height: 50%;
padding: 20px 40px;
}
html,
body {
height: 100%;
width: 100%;
}
body {
background-image: url("anemones.jpg"), linear-gradient(rgb(219, 166, 166), rgb(0, 0, 172));
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
}
.container {
align-items: center;
display: flex;
justify-content: center;
height: 100%;
width: 100%;
}
```
### HTML
```
<div class="container">
<div class="box">
<p>backdrop-filter: blur(10px)</p>
</div>
</div>
```
### Result
Specifications
--------------
| Specification |
| --- |
| [Filter Effects Module Level 2 # BackdropFilterProperty](https://drafts.fxtf.org/filter-effects-2/#BackdropFilterProperty) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `backdrop-filter` | 76 | 17 | 103 | No | 63 | 9 | 76 | 76 | 103 | 54 | 9 | 12.0 |
See also
--------
* [`filter`](filter)
| programming_docs |
css text-overflow text-overflow
=============
The `text-overflow` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets how hidden overflow content is signaled to users. It can be clipped, display an ellipsis ('`…`'), or display a custom string.
Try it
------
The `text-overflow` property doesn't force an overflow to occur. To make text overflow its container you have to set other CSS properties: [`overflow`](overflow) and [`white-space`](white-space). For example:
```
overflow: hidden;
white-space: nowrap;
```
The `text-overflow` property only affects content that is overflowing a block container element in its *inline* progression direction (not text overflowing at the bottom of a box, for example).
Syntax
------
The `text-overflow` property may be specified using one or two values. If one value is given, it specifies overflow behavior for the end of the line (the right end for left-to-right text, the left end for right-to-left text). If two values are given, the first specifies overflow behavior for the left end of the line, and the second specifies it for the right end of the line.
```
text-overflow: clip;
text-overflow: ellipsis ellipsis;
text-overflow: ellipsis " [..]";
/\* Global values \*/
text-overflow: inherit;
text-overflow: initial;
text-overflow: revert;
text-overflow: revert-layer;
text-overflow: unset;
```
* one of the keyword values: `clip`, `ellipsis`, `fade`
* the function `fade()`, which is passed a [`<length>`](length) or a [`<percentage>`](percentage) to control the fade distance
* a `<string>`.
### Values
`clip` The default for this property. This keyword value will truncate the text at the limit of the [content area](css_box_model/introduction_to_the_css_box_model), therefore the truncation can happen in the middle of a character. To clip at the transition between characters you can specify `text-overflow` as an empty string, if that is supported in your target browsers: `text-overflow: '';`.
`ellipsis` This keyword value will display an ellipsis (`'…'`, `U+2026 HORIZONTAL ELLIPSIS`) to represent clipped text. The ellipsis is displayed inside the [content area](css_box_model/introduction_to_the_css_box_model), decreasing the amount of text displayed. If there is not enough space to display the ellipsis, it is clipped.
`<string>` Experimental
The [`<string>`](string) to be used to represent clipped text. The string is displayed inside the [content area](css_box_model/introduction_to_the_css_box_model), shortening the size of the displayed text. If there is not enough space to display the string itself, it is clipped.
`fade` Experimental
This keyword clips the overflowing inline content and applies a fade-out effect near the edge of the line box with complete transparency at the edge.
`fade( <length> | <percentage> )` Experimental
This function clips the overflowing inline content and applies a fade-out effect near the edge of the line box with complete transparency at the edge.
The argument determines the distance over which the fade effect is applied. The [`<percentage>`](percentage) is resolved against the width of the line box. Values lower than `0` are clipped to `0`. Values greater than the width of the line box are clipped to the width of the line box.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `clip` |
| Applies to | block container elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
text-overflow =
clip [|](value_definition_syntax#single_bar)
ellipsis
```
Examples
--------
### One-value syntax
This example shows different values for `text-overflow` applied to a paragraph, for left-to-right and right-to-left text.
#### HTML
```
<div class="ltr">
<h2>Left to right text</h2>
<pre>clip</pre>
<p class="overflow-clip">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
<pre>ellipsis</pre>
<p class="overflow-ellipsis">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
<pre>" [..]"</pre>
<p class="overflow-string">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
</div>
<div class="rtl">
<h2>Right to left text</h2>
<pre>clip</pre>
<p class="overflow-clip">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
<pre>ellipsis</pre>
<p class="overflow-ellipsis">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
<pre>" [..]"</pre>
<p class="overflow-string">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
</div>
```
#### CSS
```
p {
width: 200px;
border: 1px solid;
padding: 2px 5px;
/\* Both of the following are required for text-overflow \*/
white-space: nowrap;
overflow: hidden;
}
.overflow-clip {
text-overflow: clip;
}
.overflow-ellipsis {
text-overflow: ellipsis;
}
.overflow-string {
text-overflow: " [..]";
}
body {
display: flex;
justify-content: space-around;
}
.ltr > p {
direction: ltr;
}
.rtl > p {
direction: rtl;
}
```
#### Result
### Two-value syntax
This example shows the two-value syntax for `text-overflow`, where you can define different overflow behavior for the start and end of the text. To show the effect we have to scroll the line so the start of the line is also hidden.
#### HTML
```
<pre>clip clip</pre>
<p class="overflow-clip-clip">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
<pre>clip ellipsis</pre>
<p class="overflow-clip-ellipsis">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
<pre>ellipsis ellipsis</pre>
<p class="overflow-ellipsis-ellipsis">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
<pre>ellipsis " [..]"</pre>
<p class="overflow-ellipsis-string">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
```
#### CSS
```
p {
width: 200px;
border: 1px solid;
padding: 2px 5px;
/\* Both of the following are required for text-overflow \*/
white-space: nowrap;
overflow: scroll;
}
.overflow-clip-clip {
text-overflow: clip clip;
}
.overflow-clip-ellipsis {
text-overflow: clip ellipsis;
}
.overflow-ellipsis-ellipsis {
text-overflow: ellipsis ellipsis;
}
.overflow-ellipsis-string {
text-overflow: ellipsis " [..]";
}
```
#### JavaScript
```
// Scroll each paragraph so the start is also hidden
const paras = document.querySelectorAll("p");
for (const para of paras) {
para.scroll(100, 0);
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Overflow Module Level 3 # text-overflow](https://w3c.github.io/csswg-drafts/css-overflow/#text-overflow) |
A previous version of this interface reached the *Candidate Recommendation* status. As some not-listed-at-risk features needed to be removed, the spec was demoted to the *Working Draft* level, explaining why browsers implemented this property unprefixed, though not at the CR state.
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `text-overflow` | 1 | 12 | 7
Until Firefox 10, handling of `text-overflow` on blocks with inline overflow on both horizontal sides was incorrect. Before Firefox 10, if only one value was specified (such as `text-overflow: ellipsis;`), text was ellipsed on both sides of the block, instead of only the end edge based on the block's text direction. | 8
6 | 11
9-15 | 1.3 | ≤37 | 18 | 7
Until Firefox 10, handling of `text-overflow` on blocks with inline overflow on both horizontal sides was incorrect. Before Firefox 10, if only one value was specified (such as `text-overflow: ellipsis;`), text was ellipsed on both sides of the block, instead of only the end edge based on the block's text direction. | 11
10.1-14 | 1 | 1.0 |
| `string` | No | No | 9 | No | No | No | No | No | 9 | No | No | No |
| `two_value_syntax` | No | No | 9 | No | No | No | No | No | 9 | No | No | No |
See also
--------
* Related CSS properties: [`overflow`](overflow), [`white-space`](white-space)
* CSS properties that control line breaks in words: [`overflow-wrap`](overflow-wrap), [`word-break`](word-break)
css scroll-snap-destination scroll-snap-destination
=======================
**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the [compatibility table](#browser_compatibility) at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The `scroll-snap-destination` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the position in x and y coordinates within the scroll container's visual [viewport](https://developer.mozilla.org/en-US/docs/Glossary/Viewport) which element snap points align with.
```
/\* <position> value \*/
scroll-snap-destination: 400px 600px;
/\* Global values \*/
scroll-snap-destination: inherit;
scroll-snap-destination: initial;
scroll-snap-destination: unset;
```
Syntax
------
### Values
`<position>` Specifies the offset of the snap destination from the start edge of the scroll container's visual viewport. The first value gives the x coordinate of the snap destination, the second value its y coordinate.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0px 0px` |
| Applies to | scroll containers |
| [Inherited](inheritance) | no |
| Percentages | relative to same axis of the padding-box of the scroll container |
| [Computed value](computed_value) | as specified, but with relative lengths converted into absolute lengths |
| Animation type | a [position](position_value#interpolation) |
Formal syntax
-------------
```
scroll-snap-destination =
<position>
```
Examples
--------
### Setting scroll snap destination
#### HTML
```
<div id="container">
<div>
<p>At coordinate (0, 0)</p>
<div class="scrollContainer destination0">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
</div>
<div>
<p>At coordinate (25, 0)</p>
<div class="scrollContainer destination25">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
</div>
<div>
<p>At coordinate (50, 0)</p>
<div class="scrollContainer destination50">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
</div>
</div>
```
#### CSS
```
#container {
display: flex;
}
#container > div:nth-child(-n + 2) {
margin-right: 20px;
}
.scrollContainer {
width: 100px;
overflow: auto;
white-space: nowrap;
scroll-snap-points-x: repeat(100%);
scroll-snap-type: mandatory;
scroll-snap-destination: 20px 0;
font-size: 0;
}
.destination0 {
scroll-snap-destination: 0 0;
}
.destination25 {
scroll-snap-destination: 25px 0;
}
.destination50 {
scroll-snap-destination: 50px 0;
}
.scrollContainer > div {
width: 100px;
height: 100px;
display: inline-block;
line-height: 100px;
text-align: center;
font-size: 50px;
}
.scrollContainer > div:nth-child(even) {
background-color: #87ea87;
}
.scrollContainer > div:nth-child(odd) {
background-color: #87ccea;
}
```
#### Result
Specifications
--------------
Not part of any standard.
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-snap-destination` | No | No | 39-68 | No | No | No | No | No | 39-68 | No | No | No |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
css grid-column-start grid-column-start
=================
The `grid-column-start` CSS property specifies a grid item's start position within the grid column by contributing a line, a span, or nothing (automatic) to its grid placement. This start position defines the block-start edge of the [grid area](https://developer.mozilla.org/en-US/docs/Glossary/Grid_Areas).
Try it
------
Syntax
------
```
/\* Keyword value \*/
grid-column-start: auto;
/\* <custom-ident> value \*/
grid-column-start: somegridarea;
/\* <integer> + <custom-ident> values \*/
grid-column-start: 2;
grid-column-start: somegridarea 4;
/\* span + <integer> + <custom-ident> values \*/
grid-column-start: span 3;
grid-column-start: span somegridarea;
grid-column-start: span somegridarea 5;
/\* Global values \*/
grid-column-start: inherit;
grid-column-start: initial;
grid-column-start: revert;
grid-column-start: revert-layer;
grid-column-start: unset;
```
This property is specified as a single `<grid-line>` value. A `<grid-line>` value can be specified as:
* either the `auto` keyword
* or a `<custom-ident>` value
* or an `<integer>` value
* or both `<custom-ident>` and `<integer>`, separated by a space
* or the keyword `span` together with either a `<custom-ident>` or an `<integer>` or both.
### Values
`auto` A keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement, an automatic span, or a default span of `1`.
`<custom-ident>` If there is a named line with the name `<custom-ident>-start`, it contributes the first such line to the grid item's placement.
**Note:** Named grid areas automatically generate implicit named lines of this form, so specifying `grid-column-start: foo;` will choose the start edge of that named grid area (unless another line named `foo-start` was explicitly specified before it).
Otherwise, this is treated as if the integer `1` had been specified along with the `<custom-ident>`.
`<integer> && <custom-ident>?` Contributes the nth grid line to the grid item's placement. If a negative integer is given, it counts in reverse, starting from the end edge of the explicit grid.
If a name is given as a `<custom-ident>`, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position.
An [`<integer>`](integer) value of `0` is invalid.
`span && [ <integer> || <custom-ident> ]` Contributes a grid span to the grid item's placement, such that the column start edge of the grid item's grid area is n lines from the end edge.
If a name is given as a `<custom-ident>`, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines on the side of the explicit grid corresponding to the search direction are assumed to have that name for the purpose of counting this span.
If the <integer> is omitted, it defaults to `1`. Negative integers and `0` are invalid.
The `<custom-ident>` cannot take the `span` value.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | grid items and absolutely-positioned boxes whose containing block is a grid container |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
grid-column-start =
<grid-line>
<grid-line> =
auto [|](value_definition_syntax#single_bar)
[<custom-ident>](custom-ident) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) [<integer [-∞,-1]>](integer) [|](value_definition_syntax#single_bar) [<integer [1,∞]>](integer) []](value_definition_syntax#brackets) [&&](value_definition_syntax#double_ampersand) [<custom-ident>](custom-ident)[?](value_definition_syntax#question_mark) []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) span [&&](value_definition_syntax#double_ampersand) [[](value_definition_syntax#brackets) [<integer [1,∞]>](integer) [||](value_definition_syntax#double_bar) [<custom-ident>](custom-ident) []](value_definition_syntax#brackets) []](value_definition_syntax#brackets)
```
Examples
--------
### Setting column start for a grid item
#### HTML
```
<div class="wrapper">
<div class="box1">One</div>
<div class="box2">Two</div>
<div class="box3">Three</div>
<div class="box4">Four</div>
<div class="box5">Five</div>
</div>
```
#### CSS
```
.wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: 100px;
}
.box1 {
grid-column-start: 1;
grid-column-end: 4;
grid-row-start: 1;
grid-row-end: 3;
}
.box2 {
grid-column-start: 1;
grid-row-start: 3;
grid-row-end: 5;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Grid Layout Module Level 2 # line-placement](https://w3c.github.io/csswg-drafts/css-grid/#line-placement) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `grid-column-start` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
See also
--------
* Related CSS properties: [`grid-column-end`](grid-column-end), [`grid-column`](grid-column), [`grid-row-start`](grid-row-start), [`grid-row-end`](grid-row-end), [`grid-row`](grid-row)
* Grid Layout Guide: *[Line-based placement with CSS Grid](css_grid_layout/line-based_placement_with_css_grid)*
* Video tutorial: *[Line-based placement](https://gridbyexample.com/video/series-line-based-placement/)*
css all all
===
The `all` [shorthand](shorthand_properties) [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property resets all of an element's properties except [`unicode-bidi`](unicode-bidi), [`direction`](direction), and [CSS Custom Properties](using_css_custom_properties). It can set properties to their initial or inherited values, or to the values specified in another cascade layer or stylesheet origin.
Try it
------
Syntax
------
```
/\* Global values \*/
all: initial;
all: inherit;
all: unset;
all: revert;
all: revert-layer;
```
The `all` property is specified as one of the CSS global keyword values. Note that none of these values affect the [`unicode-bidi`](unicode-bidi) and [`direction`](direction) properties.
### Values
[`initial`](initial) Specifies that all the element's properties should be changed to their [initial values](initial_value).
[`inherit`](inherit) Specifies that all the element's properties should be changed to their [inherited values](inheritance).
[`unset`](unset) Specifies that all the element's properties should be changed to their inherited values if they inherit by default, or to their initial values if not.
[`revert`](revert) Specifies behavior that depends on the stylesheet origin to which the declaration belongs:
* If the rule belongs to the [author origin](cascade#author_stylesheets), the `revert` value rolls back the <cascade> to the user level, so that the [specified values](specified_value) are calculated as if no author-level rules were specified for the element. For purposes of `revert`, the author origin includes the Override and Animation origins.
* If the rule belongs to the [user origin](cascade#user_stylesheets), the `revert` value rolls back the <cascade> to the user-agent level, so that the [specified values](specified_value) are calculated as if no author-level or user-level rules were specified for the element.
* If the rule belongs to the [user-agent origin](cascade#user-agent_stylesheets), the `revert` value acts like `unset`.
[`revert-layer`](revert-layer) Specifies that all the element's properties should roll back the cascade to a previous [cascade layer](@layer), if one exists. If no other cascade layer exists, the element's properties will roll back to the matching rule, if one exists, in the current layer or to a previous [style origin](https://developer.mozilla.org/en-US/docs/Glossary/Style_origin).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | There is no practical initial value for it. |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as the specified value applies to each property this is a shorthand for. |
| Animation type | as each of the properties of the shorthand (all properties but [`unicode-bidi`](unicode-bidi) and [`direction`](direction)) |
Formal syntax
-------------
```
all =
initial [|](value_definition_syntax#single_bar)
inherit [|](value_definition_syntax#single_bar)
unset [|](value_definition_syntax#single_bar)
revert [|](value_definition_syntax#single_bar)
revert-layer
```
Examples
--------
In this example, the CSS file contains styling for the [`<blockquote>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote) element in addition to some styling for the parent `<body>` element. Various outputs in the Results subsection demonstrate how the styling of the `<blockquote>` element is affected when different values are applied to the `all` property inside the `blockquote` rule.
### HTML
```
<blockquote id="quote">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</blockquote>
Phasellus eget velit sagittis.
```
### CSS
```
body {
font-size: small;
background-color: #f0f0f0;
color: blue;
margin: 0;
padding: 0;
}
blockquote {
background-color: skyblue;
color: red;
}
```
### Results
#### A. No `all` property
This is the scenario in which no `all` property is set inside the `blockquote` rule. The [`<blockquote>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote) element uses the browser's default styling which gives it a margin, together with a specific background and text color as specified in the stylesheet. It also behaves as a *block* element: the text that follows it is beneath it.
#### B. `all: initial`
With the `all` property set to `initial` in the `blockquote` rule, the [`<blockquote>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote) element doesn't use the browser default styling anymore: it is an *inline* element now (initial value), its [`background-color`](background-color#formal_definition) is `transparent` (initial value), its [`font-size`](font-size#formal_definition) is `medium`, and its [`color`](color#formal_definition) is `black` (initial value).
#### C. `all: inherit`
In this case, the [`<blockquote>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote) element doesn't use the browser default styling. Instead, it inherits style values from its parent [`<body>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body) element: it is a *block* element now (inherited value), its [`background-color`](background-color) is `#F0F0F0` (inherited value), its [`font-size`](font-size) is `small` (inherited value), and its [`color`](color) is `blue` (inherited value).
#### D. `all: unset`
When the `unset` value is applied to the `all` property in the `blockquote` rule, the [`<blockquote>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote) element doesn't use the browser default styling. Because [`background-color`](background-color#formal_definition) is a non-inherited property and [`font-size`](font-size#formal_definition) and [`color`](color#formal_definition) are inherited properties, the `<blockquote>` element is an *inline* element now (initial value), its [`background-color`](background-color) is `transparent` (initial value), but its [`font-size`](font-size) is still `small` (inherited value), and its [`color`](color) is `blue` (inherited value).
#### E. `all: revert`
When the `all` property is set to `revert` in the `blockquote` rule, the `blockquote` rule is considered to be non-existent and the styling property values are inherited from the ones applied to the parent element `<body>`. So the `<blockquote>` element gets styled as a *block* element, with [`background-color`](background-color) `#F0F0F0`, [`font-size`](font-size) `small`, and [`color`](color) `blue` - all values inherited from the `body` rule.
#### F. `all: revert-layer`
There are no cascade layers defined in the CSS file, so the `<blockquote>` element inherits its style from the matching `body` rule. The `<blockquote>` element here is styled as a *block* element, with [`background-color`](background-color) `#F0F0F0`, [`font-size`](font-size) `small`, and [`color`](color) `blue` - all values inherited from the `body` rule. This scenario is an example of the case when `all` set to `revert-layer` behaves the same as when `all` is set to `revert`.
Specifications
--------------
| Specification |
| --- |
| [CSS Cascading and Inheritance Level 4 # all-shorthand](https://w3c.github.io/csswg-drafts/css-cascade/#all-shorthand) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `all` | 37 | 79 | 27 | No | 24 | 9.1 | 37 | 37 | 27 | 24 | 9.3 | 3.0 |
See also
--------
CSS global keyword values: [`initial`](initial), [`inherit`](inherit), [`unset`](unset), [`revert`](revert), [`revert-layer`](revert-layer)
| programming_docs |
css @media @media
======
The `@media` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) <at-rule> can be used to apply part of a style sheet based on the result of one or more [media queries](media_queries/using_media_queries). With it, you specify a media query and a block of CSS to apply to the document if and only if the media query matches the device on which the content is being used.
**Note:** In JavaScript, the rules created using `@media` can be accessed with the [`CSSMediaRule`](https://developer.mozilla.org/en-US/docs/Web/API/CSSMediaRule) CSS object model interface.
Try it
------
Syntax
------
The `@media` at-rule may be placed at the top level of your code or nested inside any other [conditional group at-rule](at-rule#conditional_group_rules).
```
/\* At the top level of your code \*/
@media screen and (min-width: 900px) {
article {
padding: 1rem 3rem;
}
}
/\* Nested within another conditional at-rule \*/
@supports (display: flex) {
@media screen and (min-width: 900px) {
article {
display: flex;
}
}
}
```
For a discussion of media query syntax, please see [Using media queries](media_queries/using_media_queries#syntax).
Description
-----------
### Media types
*Media types* describe the general category of a device. Except when using the `not` or `only` logical operators, the media type is optional and the `all` type is implied.
`all` Suitable for all devices.
`print` Intended for paged material and documents viewed on a screen in print preview mode. (Please see [paged media](https://developer.mozilla.org/en-US/docs/Web/CSS/Paged_Media) for information about formatting issues that are specific to these formats.)
`screen` Intended primarily for screens.
**Note:** CSS2.1 and [Media Queries 3](https://drafts.csswg.org/mediaqueries-3/#background) defined several additional media types (`tty`, `tv`, `projection`, `handheld`, `braille`, `embossed`, and `aural`), but they were deprecated in [Media Queries 4](https://drafts.csswg.org/mediaqueries/#media-types) and shouldn't be used.
### Media features
*Media features* describe specific characteristics of the [user agent](https://developer.mozilla.org/en-US/docs/Glossary/User_agent), output device, or environment. Media feature expressions test for their presence or value, and are entirely optional. Each media feature expression must be surrounded by parentheses.
[`any-hover`](@media/any-hover) Does any available input mechanism allow the user to hover over elements? Added in Media Queries Level 4.
[`any-pointer`](@media/any-pointer) Is any available input mechanism a pointing device, and if so, how accurate is it? Added in Media Queries Level 4.
[`aspect-ratio`](@media/aspect-ratio) Width-to-height aspect ratio of the viewport
[`color`](@media/color) Number of bits per color component of the output device, or zero if the device isn't color
[`color-gamut`](@media/color-gamut) Approximate range of colors that are supported by the user agent and output device. Added in Media Queries Level 4.
[`color-index`](@media/color-index) Number of entries in the output device's color lookup table, or zero if the device does not use such a table
[`device-aspect-ratio`](@media/device-aspect-ratio) Deprecated
Width-to-height aspect ratio of the output device. Deprecated in Media Queries Level 4.
[`device-height`](@media/device-height) Deprecated
Height of the rendering surface of the output device. Deprecated in Media Queries Level 4.
[`device-width`](@media/device-width) Deprecated
Width of the rendering surface of the output device. Deprecated in Media Queries Level 4.
[`display-mode`](@media/display-mode) The display mode of the application, as specified in the web app manifest's [`display`](https://developer.mozilla.org/en-US/docs/Web/Manifest#display) member. Defined in the [Web App Manifest spec](https://w3c.github.io/manifest/#the-display-mode-media-feature).
[`dynamic-range`](@media/dynamic-range) Combination of brightness, contrast ratio, and color depth that are supported by the user agent and the output device. Added in Media Queries Level 5.
[`forced-colors`](@media/forced-colors) Detect whether user agent restricts color palette. Added in Media Queries Level 5.
[`grid`](@media/grid) Does the device use a grid or bitmap screen?
[`height`](@media/height) Height of the viewport.
[`hover`](@media/hover) Does the primary input mechanism allow the user to hover over elements? Added in Media Queries Level 4.
[`inverted-colors`](@media/inverted-colors) Is the user agent or underlying OS inverting colors? Added in Media Queries Level 5.
[`monochrome`](@media/monochrome) Bits per pixel in the output device's monochrome frame buffer, or zero if the device isn't monochrome.
[`orientation`](@media/orientation) Orientation of the viewport.
[`overflow-block`](@media/overflow-block) How does the output device handle content that overflows the viewport along the block axis? Added in Media Queries Level 4.
[`overflow-inline`](@media/overflow-inline) Can content that overflows the viewport along the inline axis be scrolled? Added in Media Queries Level 4.
[`pointer`](@media/pointer) Is the primary input mechanism a pointing device, and if so, how accurate is it? Added in Media Queries Level 4.
[`prefers-color-scheme`](@media/prefers-color-scheme) Detect if the user prefers a light or dark color scheme. Added in Media Queries Level 5.
[`prefers-contrast`](@media/prefers-contrast) Detects if the user has requested the system increase or decrease the amount of contrast between adjacent colors. Added in Media Queries Level 5.
[`prefers-reduced-motion`](@media/prefers-reduced-motion) The user prefers less motion on the page. Added in Media Queries Level 5.
[`resolution`](@media/resolution) Pixel density of the output device.
[`scripting`](@media/scripting) Detects whether scripting (i.e. JavaScript) is available. Added in Media Queries Level 5.
[`update`](@media/update-frequency) Experimental
How frequently the output device can modify the appearance of content. Added in Media Queries Level 4.
[`video-dynamic-range`](@media/video-dynamic-range) Combination of brightness, contrast ratio, and color depth that are supported by the video plane of user agent and the output device. Added in Media Queries Level 5.
[`width`](@media/width) Width of the viewport including width of scrollbar.
### Logical operators
The *logical operators* `not`, `and`, `only`, and `or` can be used to compose a complex media query. You can also combine multiple media queries into a single rule by separating them with commas.
`and` Used for combining multiple media features together into a single media query, requiring each chained feature to return `true` for the query to be `true`. It is also used for joining media features with media types.
`not` Used to negate a media query, returning `true` if the query would otherwise return `false`. If present in a comma-separated list of queries, it will only negate the specific query to which it is applied. If you use the `not` operator, you *must also* specify a media type.
**Note:** In Level 3, the `not` keyword can't be used to negate an individual media feature expression, only an entire media query.
`only` Applies a style only if an entire query matches. It is useful for preventing older browsers from applying selected styles. When not using `only`, older browsers would interpret the query `screen and (max-width: 500px)` as `screen`, ignoring the remainder of the query, and applying its styles on all screens. If you use the `only` operator, you *must also* specify a media type.
`,` (comma) Commas are used to combine multiple media queries into a single rule. Each query in a comma-separated list is treated separately from the others Thus, if any of the queries in a list is `true`, the entire media statement returns `true`. In other words, lists behave like a logical `or` operator.
`or` Equivalent to the `,` operator. Added in Media Queries Level 4.
Accessibility concerns
----------------------
To best accommodate people who adjust a site's text size, use [`em`](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#numeric_values)s when you need a [`<length>`](length) for your [media queries](media_queries/using_media_queries).
Both [`em`](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#numeric_values) and [`px`](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#numeric_values) are valid units, but [`em`](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#numeric_values) works better if the user changes the browser text size.
Also consider using Level 4 media queries to improve the user's experience. For example, `prefers-reduced-motion` to [detect if the user has requested that the system minimize the amount of animation](@media/prefers-reduced-motion) or motion it uses.
Security
--------
Because media queries provide insights into the capabilities—and by extension, the features and design—of the device the user is working with, there is the potential that they could be abused to construct a "fingerprint" which identifies the device, or at least categorizes it to some degree of detail that may be undesirable to users.
Because of this potential, a browser may opt to fudge the returned values in some manner in order to prevent them from being used to precisely identify a computer. A browser might also offer additional measures in this area; for example, if Firefox's "Resist Fingerprinting" setting is enabled, many media queries report default values rather than values representing the actual device state.
Formal syntax
-------------
```
@media =
@media [<media-query-list>](media-query-list) { [<stylesheet>](stylesheet) }
```
Examples
--------
### Testing for print and screen media types
```
@media print {
body {
font-size: 10pt;
}
}
@media screen {
body {
font-size: 13px;
}
}
@media screen, print {
body {
line-height: 1.2;
}
}
@media only screen and (min-width: 320px) and (max-width: 480px) and (resolution: 150dpi) {
body {
line-height: 1.4;
}
}
```
Introduced in Media Queries Level 4 is a new range syntax that allows for less verbose media queries when testing for any feature accepting a range, as shown in the below examples:
```
@media (height > 600px) {
body {
line-height: 1.4;
}
}
@media (400px <= width <= 700px) {
body {
line-height: 1.4;
}
}
```
For more examples, please see [Using media queries](media_queries/using_media_queries).
Specifications
--------------
| Specification |
| --- |
| [Media Queries Level 4 # media-descriptor-table](https://w3c.github.io/csswg-drafts/mediaqueries/#media-descriptor-table) |
| [CSS Conditional Rules Module Level 3 # at-media](https://w3c.github.io/csswg-drafts/css-conditional-3/#at-media) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `-moz-device-pixel-ratio` | No | No | 4 | No | No | No | No | No | 4 | No | No | No |
| `-webkit-animation` | 2-36 | No | No | No | 15-23 | 4 | 2-37 | 18-36 | No | 14-24 | 3.2 | 1.0-3.0 |
| `-webkit-device-pixel-ratio` | 1 | 12 | 63
Implemented as an alias for `-moz-device-pixel-ratio`. | No | 15 | 3 | ≤37 | 18 | 63
Implemented as an alias for `-moz-device-pixel-ratio`. | 14 | 1 | 1.0 |
| `-webkit-max-device-pixel-ratio` | 1 | 12 | 63
Implemented as an alias for `max--moz-device-pixel-ratio`. | No | 15 | 3 | ≤37 | 18 | 63
Implemented as an alias for `max--moz-device-pixel-ratio`. | 14 | 1 | 1.0 |
| `-webkit-min-device-pixel-ratio` | 1 | 12 | 63
Implemented as an alias for `min--moz-device-pixel-ratio`. | No | 15 | 3 | ≤37 | 18 | 63
Implemented as an alias for `min--moz-device-pixel-ratio`. | 14 | 1 | 1.0 |
| `-webkit-transform-2d` | 2-36 | No | No | No | 15-23 | 4 | 2-37 | 18-36 | No | 14-24 | 3.2 | 1.0-3.0 |
| `-webkit-transform-3d` | 2 | 12 | 49 | No | 15 | 4 | 4.4 | 18 | 49 | 14 | 3.2 | 1.0 |
| `-webkit-transition` | 2-36 | No | No | No | 15-23 | 4 | 2-37 | 18-36 | No | 14-24 | 3.2 | 1.0-3.0 |
| `@media` | 1 | 12 | 1 | 6 | 9.2 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `any-hover` | 41 | 16 | 64 | No | 28 | 9 | 41 | 41 | 64 | 28 | 9 | 5.0 |
| `any-pointer` | 41 | 12 | 64 | No | 28 | 9 | 41 | 41 | 64 | 28 | 9 | 4.0 |
| `aspect-ratio` | 3 | 12 | 3.5 | 9 | 10 | 5 | ≤37 | 18 | 4 | 10.1 | 4.2 | 1.0 |
| `calc` | 66 | 79 | 59 | No | 53 | 12 | 66 | 66 | 59 | 47 | 12 | 9.0 |
| `color` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `color-gamut` | 58 | 79 | No | No | 45 | 10 | 58 | 58 | No | 43 | 10 | 7.0 |
| `color-index` | 29 | 79 | No | No | 16 | 8 | 4.4 | 29 | No | 16 | 8 | 2.0 |
| `device-aspect-ratio` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `device-height` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `device-width` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `display-mode` | 42 | 79 | 47
Firefox 47 and later support `display-mode` values `fullscreen` and `browser`. Firefox 57 added support for `minimal-ui` and `standalone` values. | No | 29 | 13 | 42 | 42 | 47
Firefox 47 and later support `display-mode` values `fullscreen` and `browser`. Firefox 57 added support for `minimal-ui` and `standalone` values. | 29 | 12.2 | 4.0 |
| `dynamic-range` | 98 | 98 | 100 | No | 84 | 13.1 | 98 | 98 | 100 | 68 | 13.4 | 18.0 |
| `forced-colors` | 89 | 79 | 89 | No | No | No | No
See [bug 970285](https://crbug.com/970285). | No
See [bug 970285](https://crbug.com/970285). | 89 | No | No | No
See [bug 970285](https://crbug.com/970285). |
| `grid` | 1 | 12 | 2 | 10 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `height` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `hover` | 38
Before Chrome 41, the implementation was buggy and reported `(hover: none)` on non-touch-based computers with a mouse/trackpad. See [bug 441613](https://crbug.com/441613). | 12 | 64 | No | 28 | 9 | 38
Before Chrome 41, the implementation was buggy and reported `(hover: none)` on non-touch-based computers with a mouse/trackpad. See [bug 441613](https://crbug.com/441613). | 50 | 64 | 28 | 9 | 5.0 |
| `inverted-colors` | No | No | No | No | No | 9.1 | No | No | No | No | 10 | No |
| `media_features` | 1 | 12 | 1 | 9 | 9.2 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
| `media_query_values` | 66 | 79 | 59 | No | 53 | No | 66 | 66 | 59 | 47 | No | 9.0 |
| `monochrome` | 1 | 79 | 2 | No | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `nested-queries` | 26 | 12 | 11 | No | 12.1 | 7 | 4.4 | 26 | 14 | 12.1 | 7 | 1.5 |
| `orientation` | 3 | 12 | 2 | 9 | 10.6 | 5 | ≤37 | 18 | 4 | 11 | 4.2 | 1.0 |
| `overflow-block` | No | No | 66 | No | No | No | No | No | 66 | No | No | No |
| `overflow-inline` | No | No | 66 | No | No | No | No | No | 66 | No | No | No |
| `pointer` | 41 | 12 | 64 | No | 28 | 9 | 41 | 50 | 64 | 28 | 9 | 5.0 |
| `prefers-color-scheme` | 76 | 79 | 67 | No | 62 | 12.1 | 76 | 76 | 67 | 54 | 13 | 14.2 |
| `prefers-contrast` | 96 | 96 | 101 | No | 82 | 14.1 | 96 | 96 | 101 | No | 14.5 | 17.0 |
| `prefers-reduced-data` | 85
See [bug 1051189](https://crbug.com/1051189). | 85
See [bug 1051189](https://crbug.com/1051189). | No | No | 71
See [bug 1051189](https://crbug.com/1051189). | No | No
See [bug 1051189](https://crbug.com/1051189). | 85
See [bug 1051189](https://crbug.com/1051189). | No | No | No | No |
| `prefers-reduced-motion` | 74 | 79 | 63 | No | 62 | 10.1 | 74 | 74 | 64 | 53 | 10.3 | 11.0 |
| `range_syntax` | 104 | No | 63 | No | No | No | 104 | 104 | 63 | 71 | No | No |
| `resolution` | 29 | 12 | 8
3.5
Supports [`<integer>`](https://developer.mozilla.org/docs/Web/CSS/integer) values only. | 9 | 16
10-15 | No
See [bug 78087](https://webkit.org/b/78087). | 4.4 | 29 | 8
4
Supports [`<integer>`](https://developer.mozilla.org/docs/Web/CSS/integer) values only. | 16
10.1-14 | No
See [bug 78087](https://webkit.org/b/78087). | 2.0 |
| `scripting` | No
See [bug 489957](https://crbug.com/489957). | No
See [bug 489957](https://crbug.com/489957). | No
See [bug 1166581](https://bugzil.la/1166581). | No | No | No | No
See [bug 489957](https://crbug.com/489957). | No
See [bug 489957](https://crbug.com/489957). | No
See [bug 1166581](https://bugzil.la/1166581). | No | No | No
See [bug 489957](https://crbug.com/489957). |
| `update` | No | No | 102 | No | No | No | No | No | 102 | No | No | No |
| `video-dynamic-range` | 98 | 98 | 100 | No | 84 | 13.1 | 98 | 98 | 100 | 68 | 13.4 | 18.0 |
| `width` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
See also
--------
* [Using media queries](media_queries/using_media_queries)
* In JavaScript, `@media` can be accessed via the CSS object model interface [`CSSMediaRule`](https://developer.mozilla.org/en-US/docs/Web/API/CSSMediaRule).
* [Extended Mozilla media features](https://developer.mozilla.org/en-US/docs/Web/CSS/Mozilla_Extensions#media_features)
* [Extended WebKit media features](https://developer.mozilla.org/en-US/docs/Web/CSS/WebKit_Extensions#media_features)
css Specified value Specified value
===============
The **specified value** of a [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property is the value it receives from the document's style sheet. The specified value for a given property is determined according to the following rules:
1. If the document's style sheet explicitly specifies a value for the property, the given value will be used.
2. If the document's style sheet doesn't specify a value but it is an inherited property, the value will be taken from the parent element.
3. If none of the above pertain, the element's [initial value](initial_value) will be used.
Examples
--------
### HTML
```
<p>My specified color is given explicitly in the CSS.</p>
<div>
The specified values of all my properties default to their initial values,
because none of them are given in the CSS.
</div>
<div class="fun">
<p>
The specified value of my font family is not given explicitly in the CSS, so
it is inherited from my parent. However, the border is not an inheriting
property.
</p>
</div>
```
### CSS
```
.fun {
border: 1px dotted pink;
font-family: fantasy;
}
p {
color: green;
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification # specified-value](https://www.w3.org/TR/CSS22/cascade.html#specified-value) |
See also
--------
* CSS key concepts:
+ [CSS syntax](syntax)
+ [At-rules](at-rule)
+ [Comments](comments)
+ [Specificity](specificity)
+ [Inheritance](inheritance)
+ [Box model](css_box_model/introduction_to_the_css_box_model)
+ [Layout modes](layout_mode)
+ [Visual formatting models](visual_formatting_model)
+ [Margin collapsing](css_box_model/mastering_margin_collapsing)
+ Values
- [Initial values](initial_value)
- [Computed values](computed_value)
- [Used values](used_value)
- [Actual values](actual_value)
+ [Value definition syntax](value_definition_syntax)
+ [Shorthand properties](shorthand_properties)
+ [Replaced elements](replaced_element)
css block-size block-size
==========
The `block-size` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the horizontal or vertical size of an element's block, depending on its writing mode. It corresponds to either the [`width`](width) or the [`height`](height) property, depending on the value of [`writing-mode`](writing-mode).
If the writing mode is vertically oriented, the value of `block-size` relates to the width of the element; otherwise, it relates to the height of the element. A related property is [`inline-size`](inline-size), which defines the other dimension of the element.
Try it
------
Syntax
------
```
/\* <length> values \*/
block-size: 300px;
block-size: 25em;
/\* <percentage> values \*/
block-size: 75%;
/\* Keyword values \*/
block-size: max-content;
block-size: min-content;
block-size: fit-content(20em);
block-size: auto;
/\* Global values \*/
block-size: inherit;
block-size: initial;
block-size: revert;
block-size: revert-layer;
block-size: unset;
```
### Values
The `block-size` property takes the same values as the [`width`](width) and [`height`](height) properties.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | same as [`width`](width) and [`height`](height) |
| [Inherited](inheritance) | no |
| Percentages | block-size of containing block |
| [Computed value](computed_value) | same as [`width`](width) and [`height`](height) |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
block-size =
<'width'>
```
Examples
--------
### Block size with vertical text
#### HTML
```
<p class="exampleText">Example text</p>
```
#### CSS
```
.exampleText {
writing-mode: vertical-rl;
background-color: yellow;
block-size: 200px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # dimension-properties](https://w3c.github.io/csswg-drafts/css-logical/#dimension-properties) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `block-size` | 57 | 79 | 41 | No | 44 | 12.1 | 57 | 57 | 41 | 43 | 12.2 | 5.0 |
| `fit-content` | 57 | 79 | 41 | No | 44 | 12.1 | 57 | 57 | 41 | 43 | 12.2 | 5.0 |
| `fit-content_function` | No | No | 91 | No | No | No | No | No | No | No | No | No |
| `max-content` | 57 | 79 | 66
41 | No | 44 | 12.1 | 57 | 57 | 66
41 | 43 | 12.2 | 5.0 |
| `min-content` | 57 | 79 | 66
41 | No | 44 | 12.1 | 57 | 57 | 66
41 | 43 | 12.2 | 5.0 |
See also
--------
* The mapped physical properties: [`width`](width) and [`height`](height)
* [`writing-mode`](writing-mode)
| programming_docs |
css :first-child :first-child
============
The `:first-child` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) represents the first element among a group of sibling elements.
Try it
------
Syntax
------
```
:first-child
```
Examples
--------
### Basic example
#### HTML
```
<div>
<p>This text is selected!</p>
<p>This text isn't selected.</p>
</div>
<div>
<h2>This text isn't selected: it's not a `p`.</h2>
<p>This text isn't selected.</p>
</div>
```
#### CSS
```
p:first-child {
color: lime;
background-color: black;
padding: 5px;
}
```
#### Result
### Styling a list
#### HTML
```
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>
Item 3
<ul>
<li>Item 3.1</li>
<li>Item 3.2</li>
<li>Item 3.3</li>
</ul>
</li>
</ul>
```
#### CSS
```
ul li {
color: blue;
}
ul li:first-child {
color: red;
font-weight: bold;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # first-child-pseudo](https://w3c.github.io/csswg-drafts/selectors/#first-child-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:first-child` | 4 | 12 | 3 | 7
["Internet Explorer 7 doesn't update `:first-child` styles when elements are added dynamically.", "In Internet Explorer 8, if an element is inserted dynamically by clicking on a link, then the `:first-child` style isn't applied until the link loses focus."] | 9.5 | 3.1 | ≤37 | 18 | 4 | 10.1 | 4 | 1.0 |
| `no_parent_required` | 57 | 79 | 52 | No | 44 | No | 57 | 57 | 52 | 43 | No | 7.0 |
See also
--------
* [`:-moz-first-node`](:-moz-first-node) Non-standard
* [`:first-of-type`](:first-of-type)
* [`:last-child`](:last-child)
* [`:nth-child()`](:nth-child)
css CSS Logical Properties and Values CSS Logical Properties and Values
=================================
**CSS Logical Properties and Values** is a module of [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) introducing logical properties and values that provide the ability to control layout through logical, rather than physical, direction and dimension mappings.
The module also defines logical properties and values for properties previously defined in CSS 2.1. Logical properties define direction‐relative equivalents of their corresponding physical properties.
### Block vs. inline
Logical properties and values use the abstract terms *block* and *inline* to describe the direction in which they flow. The physical meaning of these terms depends on the [writing mode](css_writing_modes).
Block dimension The dimension perpendicular to the flow of text within a line, i.e., the vertical dimension in horizontal writing modes, and the horizontal dimension in vertical writing modes. For standard English text, it is the vertical dimension.
Inline dimension The dimension parallel to the flow of text within a line, i.e., the horizontal dimension in horizontal writing modes, and the vertical dimension in vertical writing modes. For standard English text, it is the horizontal dimension.
Reference
---------
### Properties for sizing
* [`block-size`](block-size)
* [`inline-size`](inline-size)
* [`max-block-size`](max-block-size)
* [`max-inline-size`](max-inline-size)
* [`min-block-size`](min-block-size)
* [`min-inline-size`](min-inline-size)
### Properties for margins, borders, and padding
* [`border-block`](border-block)
* [`border-block-color`](border-block-color)
* [`border-block-end`](border-block-end)
* [`border-block-end-color`](border-block-end-color)
* [`border-block-end-style`](border-block-end-style)
* [`border-block-end-width`](border-block-end-width)
* [`border-block-start`](border-block-start)
* [`border-block-start-color`](border-block-start-color)
* [`border-block-start-style`](border-block-start-style)
* [`border-block-start-width`](border-block-start-width)
* [`border-block-style`](border-block-style)
* [`border-block-width`](border-block-width)
* [`border-color`](border-color)
* [`border-inline`](border-inline)
* [`border-inline-color`](border-inline-color)
* [`border-inline-end`](border-inline-end)
* [`border-inline-end-color`](border-inline-end-color)
* [`border-inline-end-style`](border-inline-end-style)
* [`border-inline-end-width`](border-inline-end-width)
* [`border-inline-start`](border-inline-start)
* [`border-inline-start-color`](border-inline-start-color)
* [`border-inline-start-style`](border-inline-start-style)
* [`border-inline-start-width`](border-inline-start-width)
* [`border-inline-style`](border-inline-style)
* [`border-inline-width`](border-inline-width)
* [`border-start-start-radius`](border-start-start-radius)
* [`border-start-end-radius`](border-start-end-radius)
* [`border-end-start-radius`](border-end-start-radius)
* [`border-end-end-radius`](border-end-end-radius)
* [`border-style`](border-style)
* [`border-width`](border-width)
* [`margin`](margin) (`logical` Experimental keyword)
* [`margin-block`](margin-block)
* [`margin-block-end`](margin-block-end)
* [`margin-block-start`](margin-block-start)
* [`margin-inline`](margin-inline)
* [`margin-inline-end`](margin-inline-end)
* [`margin-inline-start`](margin-inline-start)
* [`padding`](padding) (`logical` Experimental keyword)
* [`padding-block`](padding-block)
* [`padding-block-end`](padding-block-end)
* [`padding-block-start`](padding-block-start)
* [`padding-inline`](padding-inline)
* [`padding-inline-end`](padding-inline-end)
* [`padding-inline-start`](padding-inline-start)
### Properties for floating and positioning
* [`clear`](clear) (`inline-end` and `inline-start` keywords)
* [`float`](float) (`inline-end` and `inline-start` keywords)
* [`inset`](inset)
* [`inset-block`](inset-block)
* [`inset-block-end`](inset-block-end)
* [`inset-block-start`](inset-block-start)
* [`inset-inline`](inset-inline)
* [`inset-inline-end`](inset-inline-end)
* [`inset-inline-start`](inset-inline-start)
### Properties for size containment
* [`contain-intrinsic-block-size`](contain-intrinsic-block-size)
* [`contain-intrinsic-inline-size`](contain-intrinsic-inline-size)
### Other properties
* [`caption-side`](caption-side) (`inline-end` and `inline-start` keywords)
* [`overflow-block`](overflow-block)
* [`overflow-inline`](overflow-inline)
* [`overscroll-behavior-block`](overscroll-behavior-block)
* [`overscroll-behavior-inline`](overscroll-behavior-inline)
* [`resize`](resize) (`block` and `inline` keywords)
* [`text-align`](text-align) (`end` and `start` keywords)
### Deprecated properties
* [`offset-block-end`](inset-block-end) Non-standard Deprecated (now [`inset-block-end`](inset-block-end))
* [`offset-block-start`](inset-block-start) Non-standard Deprecated (now [`inset-block-start`](inset-block-start))
* [`offset-inline-end`](inset-inline-end) Non-standard Deprecated (now [`inset-inline-end`](inset-inline-end))
* [`offset-inline-start`](inset-inline-start) Non-standard Deprecated (now [`inset-inline-start`](inset-inline-start))
Guides
------
* [Basic concepts of logical properties and values](css_logical_properties/basic_concepts)
* [Logical properties for sizing](css_logical_properties/sizing)
* [Logical properties for margins, borders, and padding](css_logical_properties/margins_borders_padding)
* [Logical properties for floating and positioning](css_logical_properties/floating_and_positioning)
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1](https://drafts.csswg.org/css-logical/) |
Browser compatibility
---------------------
css -moz-outline-radius-bottomleft -moz-outline-radius-bottomleft
==============================
**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the [compatibility table](#browser_compatibility) at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
In Mozilla applications, the `-moz-outline-radius-bottomleft` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property can be used to round the bottom-left corner of an element's [`outline`](outline).
Syntax
------
The value of `-moz-outline-radius-bottomleft` is either a CSS [`<length>`](length) or a <percentage> of the corresponding dimensions of the border box. The [`calc()`](calc) function may be used as well.
### Values
`<length>` The radius of the circle defining the curvature of the bottom and left edges of the element, specified as a CSS [`<length>`](length).
`<percentage>` The radius of the circle defining the rounding of the bottom-left corner of the element, specified as the [percentages](percentage) of the bottom and left sides of the border box.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| Percentages | refer to the corresponding dimension of the border box |
| [Computed value](computed_value) | as specified |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
-moz-outline-radius-bottomleft =
<outline-radius>
```
Examples
--------
### Rounding an outline
Since this is a Firefox-only property, this example will not display the desired effect if you are viewing this in a browser other than Firefox.
#### HTML
```
<p>Look at this paragraph's bottom-left corner.</p>
```
#### CSS
```
p {
margin: 10px;
border: solid cyan;
outline: dotted green;
-moz-outline-radius-bottomleft: 2em;
}
```
#### Result
Specifications
--------------
Not part of any standard.
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `-moz-outline-radius-bottomleft` | No | No | 1-88
From Firefox 88, [outline](https://developer.mozilla.org/docs/Web/CSS/outline) now follows the shape created by [border-radius](https://developer.mozilla.org/docs/Web/CSS/border-radius) automatically, so this property is no longer needed (see [bug 1694146](https://bugzil.la/1694146)). | No | No | No | No | No | 4-88
From Firefox 88, [outline](https://developer.mozilla.org/docs/Web/CSS/outline) now follows the shape created by [border-radius](https://developer.mozilla.org/docs/Web/CSS/border-radius) automatically, so this property is no longer needed (see [bug 1694146](https://bugzil.la/1694146)). | No | No | No |
See also
--------
* See the [`-moz-outline-radius`](-moz-outline-radius) property for more information.
css ::backdrop ::backdrop
==========
The `::backdrop` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-element](pseudo-elements) is a box the size of the [viewport](https://developer.mozilla.org/en-US/docs/Glossary/Viewport) which is rendered immediately beneath any element being presented in fullscreen mode. This includes both elements which have been placed in fullscreen mode using the [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API) and [`<dialog>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog) elements.
When multiple elements have been placed into fullscreen mode, the backdrop is drawn immediately beneath the frontmost such element, and on top of the older fullscreen elements.
```
/\* Backdrop is only displayed when dialog is opened with dialog.showModal() \*/
dialog::backdrop {
background: rgba(255, 0, 0, 0.25);
}
```
All fullscreen elements are placed in a last-in/first out (LIFO) stack in the top layer, which is a special layer in the viewport which is always rendered last (and therefore on top) before drawing the viewport's contents to the screen. The `::backdrop` pseudo-element makes it possible to obscure, style, or completely hide everything located below the element when it's the topmost one in the top layer.
`::backdrop` neither inherits from nor is inherited by any other elements. No restrictions are made on what properties apply to this pseudo-element.
Syntax
------
```
::backdrop
```
Examples
--------
### Styling the backdrop for fullscreen video
In this example, the backdrop style used when a video is shifted to fullscreen mode is configured to be a grey-blue color rather than the black it defaults to in most browsers.
```
video::backdrop {
background-color: #448;
}
```
The resulting screen looks like this:

[See this example in action](https://mdn.github.io/css-examples/backdrop/index.html), after changing the color of the background cause the video to go fullscreen to see the change to the backdrop color.
Specifications
--------------
| Specification |
| --- |
| [Fullscreen API Standard # ::backdrop-pseudo-element](https://fullscreen.spec.whatwg.org/#::backdrop-pseudo-element) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `::backdrop` | 37
32 | 79
12-79 | 47 | 11 | 24
19 | 15.4 | 37
4.4.3 | 37
32 | 47 | 24
19 | 15.4 | 3.0
2.0 |
| `dialog` | 32 | 79 | 98 | No | 19 | 15.4 | 4.4.3 | 32 | 98 | 19 | 15.4 | 2.0 |
| `fullscreen` | No | 12-79 | 47 | 11 | No | No | No | No | 47 | No | No | No |
See also
--------
* [`:fullscreen`](:fullscreen) pseudo-class
* [`<dialog>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog) HTML element
* [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API)
css !important !important
==========
A `!` delimiter followed by the `important` keyword marks the declaration as important. The `!important` flag alters the rules selecting declarations inside the <cascade>. A declaration that is not *important* is called *normal*.
To mark a declaration important, add the *important flag* (`!important`) after the value in the declaration. While white space is allowed between the delimiter and the keyword, the flag is generally written as `!important` without any white space.
```
selector {
property: value; /\* normal declaration \*/
property: value !important; /\* important declaration (preferred) \*/
property: value ! important; /\* important declaration (not preferred) \*/
}
```
The `!important` comes after the value of the property value pair declaration, preceded by at least one space. The important flag must be the last token in the declaration. In other words, there can be white space and comments between the flag and the declaration's ending semicolon, but nothing else.
Impact on the cascade
---------------------
When it comes to important declarations, the [cascade origin and layer orders](cascade) are reversed. Without the important flag, declarations in the author's style sheets override declarations in a user's style sheet, which override declarations in the user-agent's default style sheet.
When a declaration is important, the order of precedence is reversed. Declarations marked as important in the user-agent style sheets override all important declarations in the user style sheets. Similarly, all important declarations in the user style sheets override all important declarations in the author's style sheets. Finally, all important declarations take precedence over all animations.
**Note:** All important declarations take precedence over all animations. `!important` is not valid within [@keyframes animation](@keyframes) declarations.
Reversing the precedence order for important declarations ensures users with special needs, such as personalized color schemes or large fonts, can override author styles when needed by marking some declarations in their user's style sheet as important. It also guarantees malicious extensions can't override important user-agent styles, which might break functionality or negatively impact security.
Does anything have precedence over important declarations? Yes, [transitions](css_transitions). CSS transitions are a way to control the speed at which the property changes from one value to another. While transitioning from one value to another, a property will not match a specific important declaration.
```
a {
color: red !important;
background-color: yellow;
transition: all 2s linear;
}
a:hover {
color: blue !important;
background-color: orange !important;
}
```
In this example, the `color` and `background-color` properties will transition to the hovered state over two seconds. Even though default states are normal declarations and hover states are `!important` declarations, the transition does happen.
### Cascade layers
Within each of the three origins for style sheets – author, user, and user-agent – normal declarations in unlayered styles override layered style declarations, with the last declared having precedence over the layers declared before it. Important declarations reverse the order of precedence: important declarations in the first layer take precedence over important declarations in the next layer, and so on. Also, all the important declarations have precedence over important declarations made outside any layer.
### Inline styles
Inline styles are styles defined using the [`style`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style) attributes. They can also be normal or important. Inline *normal* styles take precedence over all *normal* declarations, no matter the origin. Inline *important* styles take precedence over all other *important* author styles, no matter the layer, but important styles from user's or user-agent's style sheets and transitions override them.
### !important and specificity
While `!important` is not part of determining specificity, it is related. Important declarations override all other declarations from the same [origin and cascade layer](cascade).
```
#myElement#myElement#myElement .myClass.myClass p:hover {
color: blue;
}
p {
color: red !important;
}
```
This example displays a case of over-specifying a selector. No matter how high the selector <specificity> matches a normal declaration, an important declaration from the same source and cascade layer will always have precedence. In this case, the paragraph will always be red.
When two important declarations from the same origin and layer apply to the same element, browsers select and use the declaration with the highest specificity.
```
#myElement p {
color: green !important;
}
p {
color: purple !important;
}
```
In this case, the selector specificity matters. Only if the selectors had the same specificity would source order matter.
Impact on shorthand properties
------------------------------
Declaring a shorthand property with `!important` sets all of sub-properties as important. To two following selector style blocks are equivalent:
```
p {
background: blue !important;
}
p {
background-image: none !important;
background-position: 0 0 !important;
background-size: auto auto !important;
background-repeat: repeat !important;
background-origin: padding-box !important;
background-clip: border-box !important;
background-attachment: scroll !important;
background-color: blue !important;
}
```
This example shows one of the several reasons avoiding the important flag is generally recommended.
Impact on custom properties
---------------------------
When the `!important` flag is added to a custom property value declaration, it makes the value assignment important. The `!important` flag is then stripped from the custom property value. The `!important` flag is not passed as part of the custom property value to the [`var()`](var()) function.
```
:root {
--myColor: red !important;
--myColor: blue;
}
p {
color: var(--myColor);
}
blockquote {
color: var(--myColor);
color: purple;
}
```
In this example, the paragraph will be red, not blue, as the custom property value assignment is important. The blockquote will be purple, because the purple normal declaration comes after the normal red declaration.
Best practices
--------------
Avoid using `!important` to override specificity. When intentionally creating important declarations for UI requirements, comment in your CSS code to explain to maintainers why they should not override that feature.
Even when working to override high-specificity styles not under your control, such as styles in a 3rd party plugin declared with an [id selector](id_selectors), you don't need to use `!important`. Consider instead importing the 3rd party stylesheet script into a [named or anonymous layer](@layer) as your first cascade layer, instead of using `!important`. As long as the external styles do not include important declarations, your styles will take precedence over the widget styles, no matter the specificity.
If you need to override an external stylesheet containing important declarations, create a cascade layer containing the needed overrides, and declare that layer first.
### Accessibility
Important styles from a user stylesheet take precedence over the author style sheet's important declarations, meaning adding an `!important` flag to a site's styles will not prevent individual users with special requirements, such as large fonts, from being able to override your styles by adding important styles in their own user's style sheet.
Browser compatibility
---------------------
See also
--------
* [CSS Specificity](specificity)
* [CSS Cascade](cascade)
| programming_docs |
css outline-offset outline-offset
==============
The `outline-offset` CSS property sets the amount of space between an <outline> and the edge or border of an element.
Try it
------
Syntax
------
```
/\* <length> values \*/
outline-offset: 3px;
outline-offset: 0.2em;
/\* Global values \*/
outline-offset: inherit;
outline-offset: initial;
outline-offset: revert;
outline-offset: revert-layer;
outline-offset: unset;
```
### Values
`[`<length>`](length)` The width of the space between the element and its outline. A negative value places the outline inside the element. A value of `0` places the outline so that there is no space between it and the element.
Description
-----------
An outline is a line that is drawn around an element, outside the border edge. The space between an element and its outline is transparent. In other words, it is the same as the parent element's background.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified, but with relative lengths converted into absolute lengths |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
outline-offset =
[<length>](length)
```
Examples
--------
### Setting outline offset in pixels
#### HTML
```
<p>Gallia est omnis divisa in partes tres.</p>
```
#### CSS
```
p {
outline: 1px dashed red;
outline-offset: 10px;
background: yellow;
border: 1px solid blue;
margin: 15px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Basic User Interface Module Level 4 # outline-offset](https://w3c.github.io/csswg-drafts/css-ui/#outline-offset) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `outline-offset` | 1 | 15 | 1.5
Before Firefox 88, an outline does not follow the shape of `border-radius`. | No | 9.5 | 1.2 | 37 | 18 | 4
Before Firefox 88, an outline does not follow the shape of `border-radius`. | 14 | 1 | 1.0 |
See also
--------
* [`outline`](outline)
* [`outline-color`](outline-color)
* [`outline-style`](outline-style)
* [`outline-width`](outline-width)
css text-emphasis-position text-emphasis-position
======================
The `text-emphasis-position` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets where emphasis marks are drawn. Like ruby text, if there isn't enough room for emphasis marks, the line height is increased.
Try it
------
Syntax
------
```
/\* Initial value \*/
text-emphasis-position: over right;
/\* Keywords value \*/
text-emphasis-position: over left;
text-emphasis-position: under right;
text-emphasis-position: under left;
text-emphasis-position: left over;
text-emphasis-position: right under;
text-emphasis-position: left under;
/\* Global values \*/
text-emphasis-position: inherit;
text-emphasis-position: initial;
text-emphasis-position: revert;
text-emphasis-position: revert-layer;
text-emphasis-position: unset;
```
### Values
`over` Draws marks over the text in horizontal writing mode.
`under` Draws marks under the text in horizontal writing mode.
`right` Draws marks to the right of the text in vertical writing mode.
`left` Draws marks to the left of the text in vertical writing mode.
Description
-----------
The preferred position of emphasis marks depends on the language. In Japanese for example, the preferred position is `over right`. In Chinese, on the other hand, the preferred position is `under right`. The informative table below summarizes the preferred emphasis mark positions for Chinese, Mongolian and Japanese:
Preferred emphasis mark and ruby position| Language | Preferred position | Illustration |
| --- | --- | --- |
| Horizontal | Vertical |
| Japanese | over | right | | |
| Korean |
| Mongolian |
| Chinese | under | right | |
**Note:** The `text-emphasis-position` cannot be set, and therefore are not reset either, using the [`text-emphasis`](text-emphasis) shorthand property.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `over right` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
text-emphasis-position =
[[](value_definition_syntax#brackets) over [|](value_definition_syntax#single_bar) under []](value_definition_syntax#brackets) [&&](value_definition_syntax#double_ampersand)
[[](value_definition_syntax#brackets) right [|](value_definition_syntax#single_bar) left []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark)
```
Examples
--------
### Preferring ruby over emphasis marks
Some editors prefer to hide emphasis marks when they conflict with ruby. In HTML, this can be done with the following style rule:
```
ruby {
text-emphasis: none;
}
```
### Preferring emphasis marks over ruby
Some other editors prefer to hide ruby when they conflict with emphasis marks. In HTML, this can be done with the following pattern:
```
em {
text-emphasis: dot; /\* Set text-emphasis for <em> elements \*/
}
em rt {
display: none; /\* Hide ruby inside <em> elements \*/
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Text Decoration Module Level 3 # text-emphasis-position-property](https://w3c.github.io/csswg-drafts/css-text-decor/#text-emphasis-position-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `text-emphasis-position` | 99
25 | 99
79 | 46 | No | 15 | 7
7 | 4.4 | 99
25 | 46 | 14 | 7
7 | 18.0
1.5 |
| `left_and_right` | 62 | 79 | 46 | No | 49 | 8 | 62 | 62 | 46 | 46 | 8 | 8.0 |
See also
--------
* The longhand properties [`text-emphasis-style`](text-emphasis-style), [`text-emphasis-color`](text-emphasis-color), and the corresponding shorthand property [`text-emphasis`](text-emphasis).
css :host-context() :host-context()
===============
The `:host-context()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) function selects the shadow host of the [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM) containing the CSS it is used inside (so you can select a custom element from inside its shadow DOM) — but only if the selector given as the function's parameter matches the shadow host's ancestor(s) in the place it sits inside the DOM hierarchy.
In other words, this allows a custom element, or anything within that custom element's shadow DOM, to apply different styles based on its position within the outer DOM or classes/attributes applied to ancestor elements.
One typical use of this is with a descendant selector expression — for example `h1` — to select only instances of the custom element that are inside an `<h1>`. Another typical use would be to allow inner elements to react to classes or attributes on any ancestor elements - for example, applying a different text color when a `.dark-theme` class is applied to `<body>`.
**Note:** This has no effect when used outside a shadow DOM.
```
/\* Selects a shadow root host, only if it is
a descendant of the selector argument given \*/
:host-context(h1) {
font-weight: bold;
}
:host-context(main article) {
font-weight: bold;
}
/\* Changes paragraph text color from black to white when
a .dark-theme class is applied to the document body \*/
p {
color: #000;
}
:host-context(body.dark-theme) p {
color: #fff;
}
```
Syntax
------
```
:host-context( <compound-selector> )
```
Examples
--------
### Selectively styling shadow hosts
The following snippets are taken from our [host-selectors example](https://github.com/mdn/web-components-examples/tree/main/host-selectors) ([see it live also](https://mdn.github.io/web-components-examples/host-selectors/)).
In this example we have a simple custom element — `<context-span>` — that you can wrap around text:
```
<h1>
Host selectors <a href="#"><context-span>example</context-span></a>
</h1>
```
Inside the element's constructor, we create `style` and `span` elements, fill the `span` with the content of the custom element, and fill the `style` element with some CSS rules:
```
const style = document.createElement("style");
const span = document.createElement("span");
span.textContent = this.textContent;
const shadowRoot = this.attachShadow({ mode: "open" });
shadowRoot.appendChild(style);
shadowRoot.appendChild(span);
style.textContent =
"span:hover { text-decoration: underline; }" +
":host-context(h1) { font-style: italic; }" +
':host-context(h1):after { content: " - no links in headers!" }' +
":host-context(article, aside) { color: gray; }" +
":host(.footer) { color : red; }" +
":host { background: rgba(0,0,0,0.1); padding: 2px 5px; }";
```
The `:host-context(h1) { font-style: italic; }` and `:host-context(h1):after { content: " - no links in headers!" }` rules style the instance of the `<context-span>` element (the shadow host in this instance) inside the `<h1>`. We've used it to make it clear that the custom element shouldn't appear inside the `<h1>` in our design.
Specifications
--------------
| Specification |
| --- |
| [CSS Scoping Module Level 1 # host-selector](https://w3c.github.io/csswg-drafts/css-scoping/#host-selector) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:host-context` | 54 | 79 | No
See [bug 1082060](https://bugzil.la/1082060). | No | 41 | No | 54 | 54 | No
See [bug 1082060](https://bugzil.la/1082060). | 41 | No | 6.0 |
See also
--------
* [Web components](https://developer.mozilla.org/en-US/docs/Web/Web_Components)
* [`:host`](:host)
* [`:host()`](:host_function)
css background-color background-color
================
The `background-color` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the background color of an element.
Try it
------
Syntax
------
```
/\* Keyword values \*/
background-color: red;
background-color: indigo;
/\* Hexadecimal value \*/
background-color: #bbff00; /\* Fully opaque \*/
background-color: #bf0; /\* Fully opaque shorthand \*/
background-color: #11ffee00; /\* Fully transparent \*/
background-color: #1fe0; /\* Fully transparent shorthand \*/
background-color: #11ffeeff; /\* Fully opaque \*/
background-color: #1fef; /\* Fully opaque shorthand \*/
/\* RGB value \*/
background-color: rgb(255 255 128); /\* Fully opaque \*/
background-color: rgb(117 190 218 / 0.5); /\* 50% transparent \*/
/\* HSL value \*/
background-color: hsl(50 33% 25%); /\* Fully opaque \*/
background-color: hsl(50 33% 25% / 0.75); /\* 75% opaque, i.e. 25% transparent \*/
/\* Special keyword values \*/
background-color: currentcolor;
background-color: transparent;
/\* Global values \*/
background-color: inherit;
background-color: initial;
background-color: revert;
background-color: revert-layer;
background-color: unset;
```
The `background-color` property is specified as a single `<color>` value.
### Values
[`<color>`](color_value) The uniform color of the background. It is rendered behind any [`background-image`](background-image) that is specified, although the color will still be visible through any transparency in the image.
Accessibility concerns
----------------------
It is important to ensure that the contrast ratio between the background color and the color of the text placed over it is high enough that people experiencing low vision conditions will be able to read the content of the page.
Color contrast ratio is determined by comparing the luminance of the text and background color values. In order to meet current [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/standards-guidelines/wcag/), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and [bold](font-weight) or larger, or 24px or larger.
* [WebAIM: Color Contrast Checker](https://webaim.org/resources/contrastchecker/)
* [MDN Understanding WCAG, Guideline 1.4 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background)
* [Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html)
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `transparent` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | computed color |
| Animation type | a [color](color_value#interpolation) |
Formal syntax
-------------
```
background-color =
[<color>](color_value)
```
Examples
--------
### HTML
```
<div class="exampleone">Lorem ipsum dolor sit amet, consectetuer</div>
<div class="exampletwo">Lorem ipsum dolor sit amet, consectetuer</div>
<div class="examplethree">Lorem ipsum dolor sit amet, consectetuer</div>
```
### CSS
```
.exampleone {
background-color: transparent;
}
.exampletwo {
background-color: rgb(153, 102, 153);
color: rgb(255, 255, 204);
}
.examplethree {
background-color: #777799;
color: #ffffff;
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # background-color](https://w3c.github.io/csswg-drafts/css-backgrounds/#background-color) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `background-color` | 1 | 12 | 1 | 4
In Internet Explorer 8 and 9, there is a bug where a computed `background-color` of `transparent` causes `click` events to not get fired on overlaid elements. | 3.5 | 1 | ≤37 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [Multiple backgrounds](css_backgrounds_and_borders/using_multiple_backgrounds)
* The [`<color>`](color_value) data type
* Other color-related properties: [`color`](color), [`border-color`](border-color), [`outline-color`](outline-color), [`text-decoration-color`](text-decoration-color), [`text-emphasis-color`](text-emphasis-color), [`text-shadow`](text-shadow), [`caret-color`](caret-color), and [`column-rule-color`](column-rule-color)
* [Applying color to HTML elements using CSS](css_colors/applying_color)
css align-tracks align-tracks
============
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `align-tracks` CSS property sets the alignment in the masonry axis for grid containers that have [masonry](css_grid_layout/masonry_layout) in their block axis.
Syntax
------
```
/\* Keyword values \*/
align-tracks: start;
align-tracks: space-between;
align-tracks: center;
align-tracks: start, center, end;
/\* Global values \*/
align-tracks: inherit;
align-tracks: initial;
align-tracks: revert;
align-tracks: unset;
```
The property can take a single value, in which case all tracks are aligned in the same way. If a list of values is used then the first value applies to the first track in the grid axis, the second to the next and so on.
If there are fewer values than tracks, the last value is used for all remaining tracks. If there are more values than tracks, any additional values are ignored.
### Values
`start` The items are packed flush to each other toward the start edge of the alignment container in the masonry axis.
`end` The items are packed flush to each other toward the end edge of the alignment container in the masonry axis.
`center` The items are packed flush to each other toward the center of the alignment container along the masonry axis.
`normal` Acts as `start`.
`baseline first baseline` `last baseline` Specifies participation in first- or last-baseline alignment: aligns the alignment baseline of the box's first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. The fallback alignment for `first baseline` is `start`, the one for `last baseline` is `end`.
`space-between` The items are evenly distributed within the alignment container along the masonry axis. The spacing between each pair of adjacent items is the same. The first item is flush with the main-start edge, and the last item is flush with the main-end edge.
`space-around` The items are evenly distributed within the alignment container along the masonry axis. The spacing between each pair of adjacent items is the same. The empty space before the first and after the last item equals half of the space between each pair of adjacent items.
`space-evenly` The items are evenly distributed within the alignment container along the masonry axis. The spacing between each pair of adjacent items, the main-start edge and the first item, and the main-end edge and the last item, are all exactly the same.
`stretch` The items stretch along the masonry axis to fill the content box. Items with definite size do not stretch.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | Grid containers with masonry layout in their block axis |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
align-tracks =
[[](value_definition_syntax#brackets) normal [|](value_definition_syntax#single_bar) <baseline-position> [|](value_definition_syntax#single_bar) <content-distribution> [|](value_definition_syntax#single_bar) <overflow-position>[?](value_definition_syntax#question_mark) <content-position> []](value_definition_syntax#brackets)[#](value_definition_syntax#hash_mark)
<baseline-position> =
[[](value_definition_syntax#brackets) first [|](value_definition_syntax#single_bar) last []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) [&&](value_definition_syntax#double_ampersand)
baseline
<content-distribution> =
space-between [|](value_definition_syntax#single_bar)
space-around [|](value_definition_syntax#single_bar)
space-evenly [|](value_definition_syntax#single_bar)
stretch
<overflow-position> =
unsafe [|](value_definition_syntax#single_bar)
safe
<content-position> =
center [|](value_definition_syntax#single_bar)
start [|](value_definition_syntax#single_bar)
end [|](value_definition_syntax#single_bar)
flex-start [|](value_definition_syntax#single_bar)
flex-end
```
Examples
--------
### Masonry layout with multiple values for align-tracks
Specifications
--------------
| Specification |
| --- |
| [CSS Grid Layout Module Level 3 # tracks-alignment](https://w3c.github.io/csswg-drafts/css-grid-3/#tracks-alignment) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `align-tracks` | No | No | 77 | No | No | No | No | No | No | No | No | No |
See also
--------
* Related CSS properties: [`justify-tracks`](justify-tracks), [`masonry-auto-flow`](masonry-auto-flow)
| programming_docs |
css transition transition
==========
The `transition` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property is a [shorthand property](shorthand_properties) for [`transition-property`](transition-property), [`transition-duration`](transition-duration), [`transition-timing-function`](transition-timing-function), and [`transition-delay`](transition-delay).
Try it
------
Transitions enable you to define the transition between two states of an element. Different states may be defined using <pseudo-classes> like [`:hover`](:hover) or [`:active`](:active) or dynamically set using JavaScript.
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`transition-delay`](transition-delay)
* [`transition-duration`](transition-duration)
* [`transition-property`](transition-property)
* [`transition-timing-function`](transition-timing-function)
Syntax
------
```
/\* Apply to 1 property \*/
/\* property name | duration \*/
transition: margin-right 4s;
/\* property name | duration | delay \*/
transition: margin-right 4s 1s;
/\* property name | duration | easing function \*/
transition: margin-right 4s ease-in-out;
/\* property name | duration | easing function | delay \*/
transition: margin-right 4s ease-in-out 1s;
/\* Apply to 2 properties \*/
transition: margin-right 4s, color 1s;
/\* Apply to all changed properties \*/
transition: all 0.5s ease-out;
/\* Global values \*/
transition: inherit;
transition: initial;
transition: revert;
transition: revert-layer;
transition: unset;
```
The `transition` property is specified as one or more single-property transitions, separated by commas.
Each single-property transition describes the transition that should be applied to a single property (or the special values `all` and `none`). It includes:
* zero or one value representing the property to which the transition should apply. This may be any one of:
+ the keyword `none`
+ the keyword `all`
+ a [`<custom-ident>`](custom-ident) naming a CSS property.
* zero or one [`<easing-function>`](easing-function) value representing the easing function to use
* zero, one, or two [`<time>`](time) values. The first value that can be parsed as a time is assigned to the [`transition-duration`](transition-duration), and the second value that can be parsed as a time is assigned to [`transition-delay`](transition-delay).
See [how things are handled](css_transitions/using_css_transitions#when_property_value_lists_are_of_different_lengths) when lists of property values aren't the same length. In short, extra transition descriptions beyond the number of properties actually being animated are ignored.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`transition-delay`](transition-delay): `0s`
* [`transition-duration`](transition-duration): `0s`
* [`transition-property`](transition-property): all
* [`transition-timing-function`](transition-timing-function): `ease`
|
| Applies to | all elements, [`::before`](::before) and [`::after`](::after) <pseudo-elements> |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`transition-delay`](transition-delay): as specified
* [`transition-duration`](transition-duration): as specified
* [`transition-property`](transition-property): as specified
* [`transition-timing-function`](transition-timing-function): as specified
|
| Animation type | discrete |
Formal syntax
-------------
```
transition =
<single-transition>[#](value_definition_syntax#hash_mark)
<single-transition> =
[[](value_definition_syntax#brackets) none [|](value_definition_syntax#single_bar) <single-transition-property> []](value_definition_syntax#brackets) [||](value_definition_syntax#double_bar)
[<time>](time) [||](value_definition_syntax#double_bar)
<easing-function> [||](value_definition_syntax#double_bar)
[<time>](time)
<single-transition-property> =
all [|](value_definition_syntax#single_bar)
[<custom-ident>](custom-ident)
<easing-function> =
linear [|](value_definition_syntax#single_bar)
<linear-easing-function> [|](value_definition_syntax#single_bar)
<cubic-bezier-easing-function> [|](value_definition_syntax#single_bar)
<step-easing-function>
<linear-easing-function> =
linear( <linear-stop-list> )
<cubic-bezier-easing-function> =
ease [|](value_definition_syntax#single_bar)
ease-in [|](value_definition_syntax#single_bar)
ease-out [|](value_definition_syntax#single_bar)
ease-in-out [|](value_definition_syntax#single_bar)
cubic-bezier( [<number [0,1]>](number) , [<number>](number) , [<number [0,1]>](number) , [<number>](number) )
<step-easing-function> =
step-start [|](value_definition_syntax#single_bar)
step-end [|](value_definition_syntax#single_bar)
steps( [<integer>](integer) [[](value_definition_syntax#brackets), <step-position> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) )
<linear-stop-list> =
[[](value_definition_syntax#brackets) <linear-stop> []](value_definition_syntax#brackets)[#](value_definition_syntax#hash_mark)
<step-position> =
jump-start [|](value_definition_syntax#single_bar)
jump-end [|](value_definition_syntax#single_bar)
jump-none [|](value_definition_syntax#single_bar)
jump-both [|](value_definition_syntax#single_bar)
start [|](value_definition_syntax#single_bar)
end
<linear-stop> =
[<number>](number) [&&](value_definition_syntax#double_ampersand)
<linear-stop-length>[?](value_definition_syntax#question_mark)
<linear-stop-length> =
[<percentage>](percentage)[{1,2}](value_definition_syntax#curly_braces)
```
Examples
--------
### Simple example
This example performs a four-second font size transition with a one-second delay when the user hovers over the element.
#### HTML
```
<a class="target">Hover over me</a>
```
#### CSS
```
.target {
font-size: 14px;
transition: font-size 4s 1s;
}
.target:hover {
font-size: 36px;
}
```
There are several more examples of CSS transitions included in the [Using CSS transitions](css_transitions/using_css_transitions) article.
Specifications
--------------
| Specification |
| --- |
| [CSS Transitions # transition-shorthand-property](https://w3c.github.io/csswg-drafts/css-transitions/#transition-shorthand-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `transition` | 26
1 | 12
12 | 49
16
["Before Firefox 57, transitions do not work when transitioning from a [`text-shadow`](https://developer.mozilla.org/docs/Web/CSS/text-shadow) with a color specified to a `text-shadow` without a color specified (see [bug 726550](https://bugzil.la/726550)).", "Before Firefox 57, cancelling a filling animation (for example, with `animation-fill-mode: forwards` set) can trigger a transition set on the same element, although only once (see [bug 1192592](https://bugzil.la/1192592) and [these test cases](https://bug1192592.bmoattachments.org/attachment.cgi?id=8843824) for more information).", "Before Firefox 57, the [`background-position`](https://developer.mozilla.org/docs/Web/CSS/background-position) property can't be transitioned between two values containing different numbers of [`<position>`](https://developer.mozilla.org/docs/Web/CSS/position_value) values, for example `background-position: 10px 10px;` and `background-position: 20px 20px, 30px 30px;` (see [bug 1390446](https://bugzil.la/1390446))."]
4 | 10
10 | 15
12.1
10.1-15 | 9
3.1 | 4.4
2 | 26
18 | 49
16
["Before Firefox 57, transitions do not work when transitioning from a [`text-shadow`](https://developer.mozilla.org/docs/Web/CSS/text-shadow) with a color specified to a `text-shadow` without a color specified (see [bug 726550](https://bugzil.la/726550)).", "Before Firefox 57, cancelling a filling animation (for example, with `animation-fill-mode: forwards` set) can trigger a transition set on the same element, although only once (see [bug 1192592](https://bugzil.la/1192592) and [these test cases](https://bug1192592.bmoattachments.org/attachment.cgi?id=8843824) for more information).", "Before Firefox 57, the [`background-position`](https://developer.mozilla.org/docs/Web/CSS/background-position) property can't be transitioned between two values containing different numbers of [`<position>`](https://developer.mozilla.org/docs/Web/CSS/position_value) values, for example `background-position: 10px 10px;` and `background-position: 20px 20px, 30px 30px;` (see [bug 1390446](https://bugzil.la/1390446))."]
4 | 14
12.1
10.1-14 | 9
2 | 1.5
1.0 |
| `gradients` | No | 12-79 | No | 10 | No | preview | No | No | No | No | No | No |
See also
--------
* [Using CSS transitions](css_transitions/using_css_transitions)
* [`TransitionEvent`](https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent)
css unicode-bidi unicode-bidi
============
The `unicode-bidi` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property, together with the [`direction`](direction) property, determines how bidirectional text in a document is handled. For example, if a block of content contains both left-to-right and right-to-left text, the user-agent uses a complex Unicode algorithm to decide how to display the text. The `unicode-bidi` property overrides this algorithm and allows the developer to control the text embedding.
Try it
------
The `unicode-bidi` and [`direction`](direction) properties are the only properties that are not affected by the [`all`](all) shorthand.
**Warning:** This property is intended for Document Type Definition (DTD) designers. Web designers and similar authors **should not** override it.
Syntax
------
```
/\* Keyword values \*/
unicode-bidi: normal;
unicode-bidi: embed;
unicode-bidi: isolate;
unicode-bidi: bidi-override;
unicode-bidi: isolate-override;
unicode-bidi: plaintext;
/\* Global values \*/
unicode-bidi: inherit;
unicode-bidi: initial;
unicode-bidi: revert;
unicode-bidi: revert-layer;
unicode-bidi: unset;
```
### Values
`normal` The element does not offer an additional level of embedding with respect to the bidirectional algorithm. For inline elements, implicit reordering works across element boundaries.
`embed` If the element is inline, this value opens an additional level of embedding with respect to the bidirectional algorithm. The direction of this embedding level is given by the [`direction`](direction) property.
`bidi-override` For inline elements this creates an override. For block container elements this creates an override for inline-level descendants not within another block container element. This means that inside the element, reordering is strictly in sequence according to the [`direction`](direction) property; the implicit part of the bidirectional algorithm is ignored.
`isolate` This keyword indicates that the element's container directionality should be calculated without considering the content of this element. The element is therefore *isolated* from its siblings. When applying its bidirectional-resolution algorithm, its container element treats it as one or several `U+FFFC Object Replacement Character`, i.e. like an image.
`isolate-override` This keyword applies the isolation behavior of the `isolate` keyword to the surrounding content and the override behavior of the `bidi-override` keyword to the inner content.
`plaintext` This keyword makes the elements directionality calculated without considering its parent bidirectional state or the value of the [`direction`](direction) property. The directionality is calculated using the P2 and P3 rules of the Unicode Bidirectional Algorithm. This value allows the display of data that is already formatted using a tool following the Unicode Bidirectional Algorithm.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | all elements, though some values have no effect on non-inline elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
unicode-bidi =
normal [|](value_definition_syntax#single_bar)
embed [|](value_definition_syntax#single_bar)
isolate [|](value_definition_syntax#single_bar)
bidi-override [|](value_definition_syntax#single_bar)
isolate-override [|](value_definition_syntax#single_bar)
plaintext
```
Examples
--------
### CSS
```
.bible-quote {
direction: rtl;
unicode-bidi: embed;
}
```
### HTML
```
<div class="bible-quote">A line of text</div>
<div>Another line of text</div>
```
### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Writing Modes Level 4 # unicode-bidi](https://w3c.github.io/csswg-drafts/css-writing-modes/#unicode-bidi) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `unicode-bidi` | 2 | 12 | 1 | 5.5 | 9.2 | 1.3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
| `isolate` | 48
16
["Avoiding using `-webkit-isolate`. It can lock up older versions of Safari (up to version 9) and Chrome (up to version 47).", "Since Chrome 19, the syntax from a previous version of the specification, where the `isolate` keyword could be used together with `bidi-override`, is allowed."] | 79
79 | 50
10-54
From Firefox 10 to Firefox 16 (inclusive), the `isolate` keyword could be used together with `bidi-override`, which was the syntax from a previous version of the specification. From Firefox 17, only one value is allowed. Use `isolate-override` instead the previous `isolate bidi-override`. | No | 35
15
["Avoiding using `-webkit-isolate`. It can lock up older versions of Opera (up to version 34).", "The syntax from a previous version of the specification, where the `isolate` keyword could be used together with `bidi-override`, is allowed."] | 11
6
Avoiding using `-webkit-isolate`. It can lock up older versions of Safari (up to version 9) and Chrome (up to version 47). | 48 | 48 | 50
10-54
From Firefox 10 to Firefox 16 (inclusive), the `isolate` keyword could be used together with `bidi-override`, which was the syntax from a previous version of the specification. From Firefox 17, only one value is allowed. Use `isolate-override` instead the previous `isolate bidi-override`. | 35 | 11
6
Avoiding using `-webkit-isolate`. It can lock up older versions of Safari (up to version 9) and Chrome (up to version 47). | 5.0 |
| `isolate-override` | 48 | 79 | 50
17-54 | No | 35 | 11
7 | 48 | 48 | 50
17-54 | 35 | 11
7 | 5.0 |
| `plaintext` | 48 | 79 | 50
10-54
["Before Firefox 50, the `plaintext` value was ignored for vertical writing modes ([bug 1302734](https://bugzil.la/1302734)).", "Before Firefox 15, `plaintext` didn't do anything to an inline element. The specification changed and the implementation was changed in Firefox 15."] | No | 35 | 11
6 | 48 | 48 | 50
10-54
["Before Firefox 50, the `plaintext` value was ignored for vertical writing modes ([bug 1302734](https://bugzil.la/1302734)).", "Before Firefox 15, `plaintext` didn't do anything to an inline element. The specification changed and the implementation was changed in Firefox 15."] | 35 | 11
6 | 5.0 |
See also
--------
* [`direction`](direction)
css Type selectors Type selectors
==============
The CSS **type selector** matches elements by node name. In other words, it selects all elements of the given type within a document.
```
/\* All <a> elements. \*/
a {
color: red;
}
```
Type selectors can be namespaced when using [`@namespace`](@namespace). This is useful when dealing with documents containing multiple namespaces such as HTML with inline SVG or MathML, or XML that mixes multiple vocabularies.
* `ns|h1` - matches `<h1>` elements in namespace *ns*
* `*|h1` - matches all `<h1>` elements
* `|h1` - matches all `<h1>` elements without any declared namespace
Syntax
------
```
element { style properties }
```
Examples
--------
### CSS
```
span {
background-color: skyblue;
}
```
### HTML
```
<span>Here's a span with some text.</span>
<p>Here's a p with some text.</p>
<span>Here's a span with more text.</span>
```
### Result
### Namespaces
In this example the selector will only match `<h1>` elements in the example namespace.
```
@namespace example url(http://www.example.com);
example|h1 {
color: blue;
}
```
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # type-selectors](https://w3c.github.io/csswg-drafts/selectors/#type-selectors) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `Type_selectors` | 1 | 12 | 1 | 3 | 3.5 | 1 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `namespaces` | 1 | 12 | 1 | 9 | 8 | 1.3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
See also
--------
* [CSS Selectors](css_selectors)
* [Learn CSS: Selectors](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors)
css scroll-padding-inline-start scroll-padding-inline-start
===========================
The `scroll-padding-inline-start` property defines offsets for the start edge in the inline dimension of the *optimal viewing region* of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or to put more breathing room between a targeted element and the edges of the scrollport.
Try it
------
Syntax
------
```
/\* Keyword values \*/
scroll-padding-inline-start: auto;
/\* <length> values \*/
scroll-padding-inline-start: 10px;
scroll-padding-inline-start: 1em;
scroll-padding-inline-start: 10%;
/\* Global values \*/
scroll-padding-inline-start: inherit;
scroll-padding-inline-start: initial;
scroll-padding-inline-start: revert;
scroll-padding-inline-start: revert-layer;
scroll-padding-inline-start: unset;
```
### Values
`<length-percentage>` An inwards offset from the inline start edge of the scrollport, as a valid length or a percentage.
`auto` The offset is determined by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | scroll containers |
| [Inherited](inheritance) | no |
| Percentages | relative to the scroll container's scrollport |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-padding-inline-start =
auto [|](value_definition_syntax#single_bar)
[<length-percentage [0,∞]>](length-percentage)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # padding-longhands-logical](https://w3c.github.io/csswg-drafts/css-scroll-snap/#padding-longhands-logical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-padding-inline-start` | 69 | 79 | 68 | No | 56 | 15 | 69 | 69 | 68 | 48 | 15 | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
| programming_docs |
css border-color border-color
============
The `border-color` [shorthand](shorthand_properties) [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the color of an element's border.
Try it
------
Each side can be set individually using [`border-top-color`](border-top-color), [`border-right-color`](border-right-color), [`border-bottom-color`](border-bottom-color), and [`border-left-color`](border-left-color); or using the writing mode-aware [`border-block-start-color`](border-block-start-color), [`border-block-end-color`](border-block-end-color), [`border-inline-start-color`](border-inline-start-color), and [`border-inline-end-color`](border-inline-end-color).
You can find more information about border colors in [Borders](css_colors/applying_color#borders) in [Applying color to HTML elements using CSS](css_colors/applying_color).
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`border-bottom-color`](border-bottom-color)
* [`border-left-color`](border-left-color)
* [`border-right-color`](border-right-color)
* [`border-top-color`](border-top-color)
Syntax
------
```
/\* <color> values \*/
border-color: red;
/\* top and bottom | left and right \*/
border-color: red #f015ca;
/\* top | left and right | bottom \*/
border-color: red rgb(240, 30, 50, 0.7) green;
/\* top | right | bottom | left \*/
border-color: red yellow green blue;
/\* Global values \*/
border-color: inherit;
border-color: initial;
border-color: revert;
border-color: revert-layer;
border-color: unset;
```
The `border-color` property may be specified using one, two, three, or four values.
* When **one** value is specified, it applies the same color to **all four sides**.
* When **two** values are specified, the first color applies to the **top and bottom**, the second to the **left and right**.
* When **three** values are specified, the first color applies to the **top**, the second to the **left and right**, the third to the **bottom**.
* When **four** values are specified, the colors apply to the **top**, **right**, **bottom**, and **left** in that order (clockwise).
### Values
[`<color>`](color_value) Defines the color of the border.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`border-top-color`](border-top-color): `currentcolor`
* [`border-right-color`](border-right-color): `currentcolor`
* [`border-bottom-color`](border-bottom-color): `currentcolor`
* [`border-left-color`](border-left-color): `currentcolor`
|
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`border-bottom-color`](border-bottom-color): computed color
* [`border-left-color`](border-left-color): computed color
* [`border-right-color`](border-right-color): computed color
* [`border-top-color`](border-top-color): computed color
|
| Animation type | as each of the properties of the shorthand:* [`border-bottom-color`](border-bottom-color): a [color](color_value#interpolation)
* [`border-left-color`](border-left-color): a [color](color_value#interpolation)
* [`border-right-color`](border-right-color): a [color](color_value#interpolation)
* [`border-top-color`](border-top-color): a [color](color_value#interpolation)
|
Formal syntax
-------------
```
border-color =
[<color>](color_value)[{1,4}](value_definition_syntax#curly_braces)
```
Examples
--------
### Complete border-color usage
#### HTML
```
<div id="justone">
<p><code>border-color: red;</code> is equivalent to</p>
<ul>
<li><code>border-top-color: red;</code></li>
<li><code>border-right-color: red;</code></li>
<li><code>border-bottom-color: red;</code></li>
<li><code>border-left-color: red;</code></li>
</ul>
</div>
<div id="horzvert">
<p><code>border-color: gold red;</code> is equivalent to</p>
<ul>
<li><code>border-top-color: gold;</code></li>
<li><code>border-right-color: red;</code></li>
<li><code>border-bottom-color: gold;</code></li>
<li><code>border-left-color: red;</code></li>
</ul>
</div>
<div id="topvertbott">
<p><code>border-color: red cyan gold;</code> is equivalent to</p>
<ul>
<li><code>border-top-color: red;</code></li>
<li><code>border-right-color: cyan;</code></li>
<li><code>border-bottom-color: gold;</code></li>
<li><code>border-left-color: cyan;</code></li>
</ul>
</div>
<div id="trbl">
<p><code>border-color: red cyan black gold;</code> is equivalent to</p>
<ul>
<li><code>border-top-color: red;</code></li>
<li><code>border-right-color: cyan;</code></li>
<li><code>border-bottom-color: black;</code></li>
<li><code>border-left-color: gold;</code></li>
</ul>
</div>
```
#### CSS
```
#justone {
border-color: red;
}
#horzvert {
border-color: gold red;
}
#topvertbott {
border-color: red cyan gold;
}
#trbl {
border-color: red cyan black gold;
}
/\* Set width and style for all divs \*/
div {
border: solid 0.3em;
width: auto;
margin: 0.5em;
padding: 0.5em;
}
ul {
margin: 0;
list-style: none;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # logical-shorthand-keyword](https://w3c.github.io/csswg-drafts/css-logical/#logical-shorthand-keyword) |
| [CSS Backgrounds and Borders Module Level 3 # border-color](https://w3c.github.io/csswg-drafts/css-backgrounds/#border-color) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-color` | 1 | 12 | 1
Firefox also supports the following non-standard CSS properties to set the border sides to multiple colors: [`-moz-border-top-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-top-colors), [`-moz-border-right-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-right-colors), [`-moz-border-bottom-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-bottom-colors), [`-moz-border-left-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-left-colors)
| 4 | 3.5 | 1 | 4 | 18 | 4
Firefox also supports the following non-standard CSS properties to set the border sides to multiple colors: [`-moz-border-top-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-top-colors), [`-moz-border-right-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-right-colors), [`-moz-border-bottom-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-bottom-colors), [`-moz-border-left-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-left-colors)
| 10.1 | 1 | 1.0 |
See also
--------
* Border-color related CSS properties: [`border`](border), [`border-top-color`](border-top-color), [`border-right-color`](border-right-color), [`border-bottom-color`](border-bottom-color), [`border-left-color`](border-left-color),
* Other border-related CSS properties: [`border-width`](border-width), [`border-style`](border-style)
* The [`<color>`](color_value) data type
* Other color-related properties: [`color`](color), [`background-color`](background-color), [`outline-color`](outline-color), [`text-decoration-color`](text-decoration-color), [`text-emphasis-color`](text-emphasis-color), [`text-shadow`](text-shadow), [`caret-color`](caret-color), and [`column-rule-color`](column-rule-color)
* [Applying color to HTML elements using CSS](css_colors/applying_color)
css @container @container
==========
The `@container` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) <at-rule> is a conditional group rule that applies styles to a [containment context](css_container_queries#naming_containment_contexts). Style declarations are filtered by a condition and applied to the container if the condition is true. The condition is evaluated when the container changes size.
An optional case-sensitive [`container-name`](container-name) can be provided which filters the set of query containers considered to just those with a matching query container name. Once an eligible query container has been selected for an element, each container feature in the `<container-condition>` is evaluated against that query container.
Syntax
------
The `@container` at-rule has the following syntax:
```
@container <container-condition> {
<stylesheet>
}
```
For example:
```
@container (width > 400px) {
h2 {
font-size: 1.5em;
}
}
```
### Values
* `<container-condition>`: A set of features that are evaluated against the query container. The condition is evaluated when the container changes size and the styles defined in the `<stylesheet>` are applied if the condition is true. More details on the syntax are covered in the following sections.
* `<stylesheet>`: A set of CSS declarations.
### Logical keywords in container queries
Logical keywords can be used to define the container condition:
* `and` combines two or more conditions.
* `or` combines two or more conditions.
* `not` negates the condition. Only one 'not' condition is allowed per container query and cannot be used with the `and` or `or` keywords.
```
@container not (width < 400px) {
/\* <stylesheet> \*/
}
@container (width > 400px) and (height > 400px) {
/\* <stylesheet> \*/
}
@container (width > 400px) or (height > 400px) {
/\* <stylesheet> \*/
}
@container (width > 400px) and (width > 800px) or (orientation: portrait) {
/\* <stylesheet> \*/
}
```
### Style container queries
Container queries can also evaluate the computed style of the container element. The following container query checks if the [`computed_value`](computed_value) of the the container element's `color` is `blue`:
```
@container style(color: blue) {
/\* <stylesheet> \*/
}
```
### Named containment contexts
A containment context can be named using the [`container-name`](container-name) property.
```
.container {
container-name: sidebar;
container-type: inline-size;
}
```
The shorthand syntax for this is to use [`container`](container) in the form `container: <name> / <type>`, for example:
```
.container {
container: sidebar / inline-size;
}
```
In container queries, the [`container-name`](container-name) property is used to filter the set of containers to those with a matching query container name:
```
@container sidebar (width > 400px) {
/\* <stylesheet> \*/
}
```
Details about usage and naming restrictions are described in the [`container-name`](container-name) page.
### Descriptors
The following descriptors can be used within the container condition:
`aspect-ratio` The [`aspect-ratio`](aspect-ratio) of the container calculated as the width to the height of the container expressed as a [`<ratio>`](ratio) value.
`block-size` The [`block-size`](block-size) of the container expressed as a [`<length>`](length) value.
`height` The height of the container expressed as a [`<length>`](length) value.
`inline-size` The [`inline-size`](inline-size) of the container expressed as a [`<length>`](length) value.
`orientation` The [orientation](@media/orientation) of the container, either `landscape` or `portrait`.
`width` The width of the container expressed as a [`<length>`](length) value.
Examples
--------
### Basic example
Given the following HTML example which is a card component with an image, a title, and some text:
```
<div class="container">
<div class="card">
<img src="image.png" alt="Cat with two different color eyes" />
<h2>Card title</h2>
<p>Card content</p>
</div>
</div>
```
A container context can be created using the `container-type` property:
```
.container {
container-type: inline-size;
}
```
The following example will apply styles to the `.card` element if it's in a container that is wider than 400px and the container's `background-color` is `blue`:
```
@container (min-width: 400px) and style(background-color: blue) {
.card {
display: grid;
grid-template-columns: 2fr 1fr;
}
}
```
### Named container contexts
Given the following HTML example which is a card component with an image, a title, and some text:
```
<div class="container">
<div class="card">
<img
src="image.png"
alt="A mostly white cat with a black heart on the forehead." />
<h2>Card title</h2>
<p>Card content</p>
</div>
</div>
```
First create a container context using `container-type`, add the `container-name` property.
**Note:** A shorthand syntax for this declaration is described in the [`container`](container) page.
```
.container {
container-type: inline-size;
container-name: sidebar;
}
```
You can then target that container by adding the name to the container query:
```
@container sidebar (min-width: 400px) {
.card {
display: grid;
grid-template-columns: 2fr 1fr;
}
}
```
### Nested container queries
It's not possible to target multiple containers in a single container query. It is possible to nest container queries which has the same effect.
The following query evaluates to true and applies a style to child elements if the container named `card` is wider than 400px and it has an ancestor container that meets the style condition:
```
@container card (min-width: 400px) {
@container style(--responsive: true) {
/\* <stylesheet> \*/
}
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Containment Module Level 3 # container-rule](https://w3c.github.io/csswg-drafts/css-contain-3/#container-rule) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `@container` | 105 | 105 | preview | No | 91 | 16 | 105 | 105 | No | 72 | 16 | No |
See also
--------
* [Container queries](css_container_queries)
* [`container-name`](container-name)
* [`container-type`](container-type)
* [`contain`](contain)
* [`content-visibility`](content-visibility)
css contain contain
=======
The `contain` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property indicates that an element and its contents are, as much as possible, independent from the rest of the document tree. Containment enables isolating a subsection of the DOM, providing performance benefits by limiting calculations of layout, style, paint, size, or any combination to a DOM subtree rather than the entire page. Containment can also be used to scope CSS counters and quotes.
Try it
------
There are four types of CSS containment: size, layout, style, and paint, which are set on the container. The property is a space-separated list of a subset of the five standard values or one of the two shorthand values. Changes to the contained properties within the container are not propagated outside of the contained element to the rest of the page. The main benefit of containment is that the browser does not have to re-render the DOM or page layout as often, leading to small performance benefits during the rendering of static pages and greater performance benefits in more dynamic applications.
Using the `contain` property is useful on pages with groups of elements that are supposed to be independent, as it can prevent element internals from having side effects outside of its bounding-box.
**Note:** using `layout`, `paint`, `strict` or `content` values for this property creates:
1. A new [containing block](containing_block) (for the descendants whose [`position`](position) property is `absolute` or `fixed`).
2. A new [stacking context](css_positioning/understanding_z_index/the_stacking_context).
3. A new [block formatting context](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context).
Syntax
------
```
/\* Keyword values \*/
contain: none;
contain: strict;
contain: content;
contain: size;
contain: inline-size;
contain: layout;
contain: style;
contain: paint;
/\* Multiple keywords \*/
contain: size paint;
contain: size layout paint;
contain: inline-size layout;
/\* Global values \*/
contain: inherit;
contain: initial;
contain: revert;
contain: revert-layer;
contain: unset;
```
### Values
The `contain` property can have any of the following values:
* The keyword `none` **or**
* One or more of the space-separated keywords `size` (or `inline-size`), `layout`, `style`, and `paint` in any order **or**
* One of the shorthand values `strict` or `content`
The keywords have the following meanings:
`none` The element renders as normal, with no containment applied.
`strict` All containment rules are applied to the element. This is equivalent to `contain: size layout paint style`.
`content` All containment rules except `size` are applied to the element. This is equivalent to `contain: layout paint style`.
`size` Size containment is applied to the element in both the inline and block directions. The size of the element can be computed in isolation, ignoring the child elements. This value cannot be combined with `inline-size`.
`inline-size` Inline size containment is applied to the element. The inline size of the element can be computed in isolation, ignoring the child elements. This value cannot be combined with `size`.
`layout` The internal layout of the element is isolated from the rest of the page. This means nothing outside the element affects its internal layout, and vice versa.
`style` For properties that can affect more than just an element and its descendants, the effects don't escape the containing element. Counters and quotes are scoped to the element and its contents.
`paint` Descendants of the element don't display outside its bounds. If the containing box is offscreen, the browser does not need to paint its contained elements — these must also be offscreen as they are contained completely by that box. If a descendant overflows the containing element's bounds, then that descendant will be clipped to the containing element's border-box.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
contain =
none [|](value_definition_syntax#single_bar)
strict [|](value_definition_syntax#single_bar)
content [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) size [||](value_definition_syntax#double_bar) layout [||](value_definition_syntax#double_bar) style [||](value_definition_syntax#double_bar) paint []](value_definition_syntax#brackets)
```
Examples
--------
### Paint containment
The following example shows how to use `contain: paint` to prevent an element's descendants from painting outside of its bounds.
```
div {
width: 100px;
height: 100px;
background: red;
margin: 10px;
font-size: 20px;
}
```
```
<div style="contain: paint">
<p>This text will be clipped to the bounds of the box.</p>
</div>
<div>
<p>This text will not be clipped to the bounds of the box.</p>
</div>
```
### Layout containment
Consider the example below which shows how elements behave with and without layout containment applied:
```
<div class="card" style="contain: layout;">
<h2>Card 1</h2>
<div class="fixed"><p>Fixed box 1</p></div>
<div class="float"><p>Float box 1</p></div>
</div>
<div class="card">
<h2>Card 2</h2>
<div class="fixed"><p>Fixed box 2</p></div>
<div class="float"><p>Float box 2</p></div>
</div>
<div class="card">
<h2>Card 3</h2>
<!-- ... -->
</div>
```
```
.card {
width: 70%;
height: 90px;
}
.fixed {
position: fixed;
right: 10px;
top: 10px;
background: coral;
}
.float {
float: left;
margin: 10px;
background: aquamarine;
}
```
The first card has layout containment applied, and its layout is isolated from the rest of the page. We can reuse this card in other places on the page without worrying about layout recalculation of the other elements. If floats overlap the card bounds, elements on the rest of the page are not affected. When the browser recalculates the containing element's subtree, only that element is recalculated. Nothing outside of the contained element needs to be recalculated. Additionally, the fixed box uses the card as a layout container to position itself.
The second and third cards have no containment. The layout context for the fixed box in the second card is the root element so the fixed box is positioned in the top right corner of the page. A float overlaps the second card's bounds causing the third card to have unexpected layout shift that's visible in the positioning of the `<h2>` element. When recalculation occurs, it is not limited to a container. This impacts performance and interferes with the rest of the page layout.
### Style containment
Style containment scopes [counters](css_counter_styles/using_css_counters) and <quotes> to the contained element. For CSS counters, the [`counter-increment`](counter-increment) and [`counter-set`](counter-set) properties are scoped to the element as if the element is at the root of the document.
#### Containment and counters
The example below takes a look at how counters work when style containment is applied:
```
<ul>
<li>Item A</li>
<li>Item B</li>
<li class="container">Item C</li>
<li>Item D</li>
<li>Item E</li>
</ul>
```
```
body {
counter-reset: list-items;
}
li::before {
counter-increment: list-items;
content: counter(list-items) ": ";
}
.container {
contain: style;
}
```
Without containment, the counter would increment from 1 to 5 for each list item. Style containment causes the [`counter-increment`](counter-increment) property to be scoped to the element's subtree and the counter begins again at 1:
#### Containment and quotes
CSS quotes are similarly affected in that the [`content`](content) values relating to quotes are scoped to the element:
```
<!-- With style containment -->
<span class="open-quote">
outer
<span style="contain: style;">
<span class="open-quote"> inner </span>
</span>
</span>
<span class="close-quote"> close </span>
<br />
<!-- Without containment -->
<span class="open-quote">
outer
<span>
<span class="open-quote"> inner </span>
</span>
</span>
<span class="close-quote"> close </span>
```
```
body {
quotes: "[" "]" "‹" "›";
}
.open-quote:before {
content: open-quote;
}
.close-quote:after {
content: close-quote;
}
```
Because of containment, the first closing quote ignores the inner span and uses the outer span's closing quote instead:
Specifications
--------------
| Specification |
| --- |
| [CSS Containment Module Level 2 # contain-property](https://w3c.github.io/csswg-drafts/css-contain/#contain-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `contain` | 52 | 79 | 69 | No | 39 | 15.4 | 52 | 52 | 79 | 41 | 15.4 | 6.0 |
| `inline-size` | 105 | 105 | 101 | No | 91 | 15.4 | 105 | 105 | 101 | 72 | 15.4 | No |
| `style` | 52 | 79 | 103 | No | 39 | 15.4 | 52 | 52 | 103 | 41 | 15.4 | 6.0 |
See also
--------
* [CSS containment](css_containment)
* [CSS container queries](css_container_queries)
* CSS [`content-visibility`](content-visibility) property
* CSS [`position`](position) property
| programming_docs |
css offset-position offset-position
===============
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `offset-position` CSS property defines the [initial position](https://www.w3.org/TR/motion-1/#valdef-offsetpath-initial-position) of the [`offset-path`](offset-path).
Syntax
------
```
/\* Keyword values \*/
offset-position: auto;
offset-position: top;
offset-position: bottom;
offset-position: left;
offset-position: right;
offset-position: center;
/\* <percentage> values \*/
offset-position: 25% 75%;
/\* <length> values \*/
offset-position: 0 0;
offset-position: 1cm 2cm;
offset-position: 10ch 8em;
/\* Edge offsets values \*/
offset-position: bottom 10px right 20px;
offset-position: right 3em bottom 10px;
offset-position: bottom 10px right;
offset-position: top right 10px;
/\* Global values \*/
offset-position: inherit;
offset-position: initial;
offset-position: revert;
offset-position: revert-layer;
offset-position: unset;
```
### Values
`auto` The initial position is the position of the box specified by the [`position`](position) property.
`<position>` A [`<position>`](position_value). A position defines an x/y coordinate, to place an item relative to the edges of an element's box. It can be defined using one to four values. If two non-keyword values are used, the first value represents the horizontal position and the second represents the vertical position. If only one value is specified, the second value is assumed to be `center`. If three or four values are used, the length-percentage values are offsets for the preceding keyword value(s). For more explanation of these value types, see [`background-position`](background-position).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | transformable elements |
| [Inherited](inheritance) | no |
| Percentages | referToSizeOfContainingBlock |
| [Computed value](computed_value) | for [`<length>`](length) the absolute value, otherwise a percentage |
| Animation type | a [position](position_value#interpolation) |
Formal syntax
-------------
```
offset-position =
auto [|](value_definition_syntax#single_bar)
<position>
<position> =
[[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) right []](value_definition_syntax#brackets) [||](value_definition_syntax#double_bar) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) bottom []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) right [|](value_definition_syntax#single_bar) <length-percentage> []](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) bottom [|](value_definition_syntax#single_bar) <length-percentage> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) right []](value_definition_syntax#brackets) <length-percentage> []](value_definition_syntax#brackets) [&&](value_definition_syntax#double_ampersand) [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) bottom []](value_definition_syntax#brackets) <length-percentage> []](value_definition_syntax#brackets)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Setting initial offset position
```
<div id="motion-demo"></div>
```
```
#motion-demo {
offset-path: path("M20,20 C20,100 200,0 200,100");
offset-position: left top;
animation: move 3000ms infinite alternate ease-in-out;
width: 40px;
height: 40px;
background: cyan;
}
@keyframes move {
0% {
offset-distance: 0%;
}
100% {
offset-distance: 100%;
}
}
```
Specifications
--------------
| Specification |
| --- |
| [Motion Path Module Level 1 # offset-position-property](https://drafts.fxtf.org/motion/#offset-position-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `offset-position` | No
See [bug 638055](https://crbug.com/638055). | No
See [bug 638055](https://crbug.com/638055). | No
See [bug 1559232](https://bugzil.la/1559232). | No | No
See [bug 638055](https://crbug.com/638055). | preview | No
See [bug 638055](https://crbug.com/638055). | No
See [bug 638055](https://crbug.com/638055). | No
See [bug 1559232](https://bugzil.la/1559232). | No
See [bug 638055](https://crbug.com/638055). | No | No
See [bug 638055](https://crbug.com/638055). |
See also
--------
* [`offset`](offset)
* [`offset-anchor`](offset-anchor)
* [`offset-distance`](offset-distance)
* [`offset-path`](offset-path)
* [`offset-rotate`](offset-rotate)
css border-image-outset border-image-outset
===================
The `border-image-outset` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the distance by which an element's [border image](border-image) is set out from its border box.
The parts of the border image that are rendered outside the element's border box with `border-image-outset` do not trigger overflow scrollbars and don't capture mouse events.
Try it
------
Syntax
------
```
/\* <length> value \*/
border-image-outset: 1rem;
/\* <number> value \*/
border-image-outset: 1.5;
/\* top and bottom | left and right \*/
border-image-outset: 1 1.2;
/\* top | left and right | bottom \*/
border-image-outset: 30px 2 45px;
/\* top | right | bottom | left \*/
border-image-outset: 7px 12px 14px 5px;
/\* Global values \*/
border-image-outset: inherit;
border-image-outset: initial;
border-image-outset: revert;
border-image-outset: revert-layer;
border-image-outset: unset;
```
The `border-image-outset` property may be specified as one, two, three, or four values. Each value is a [`<length>`](length) or [`<number>`](number). Negative values are invalid and will cause the `border-image-outset` declaration to be ignored.
1. If **one** value is specified, it applies to **all four sides**.
2. If **two** values are specified, the first applies to the **top and bottom** and the second to the **left and right**.
3. If **three** values are specified, the first applies to the **top**, the second to the **left and right**, and the third to the **bottom**.
4. If **four** values are specified, they apply to the **top**, **right**, **bottom**, and **left** in that order (clockwise).
### Values
[`<length>`](length) The size of the `border-image` outset as a dimension — a number with a unit.
[`<number>`](number) The size of the `border-image` outset as a multiple of the element's corresponding [`border-width`](border-width)s. For example, if an element has `border-width: 1em 2px 0 1.5rem`, and `border-image-outset: 2`, the final `border-image-outset` would be calculated as `2em 4px 0 3rem`.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements, except internal table elements when [`border-collapse`](border-collapse) is `collapse`. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified, but with relative lengths converted into absolute lengths |
| Animation type | by computed value type |
Formal syntax
-------------
```
border-image-outset =
[[](value_definition_syntax#brackets) [<length [0,∞]>](length) [|](value_definition_syntax#single_bar) [<number [0,∞]>](number) []](value_definition_syntax#brackets)[{1,4}](value_definition_syntax#curly_braces)
```
Examples
--------
### Outsetting a border image
#### HTML
```
<div id="outset">This element has an outset border image!</div>
```
#### CSS
```
#outset {
width: 10rem;
background: #cef;
border: 1.4rem solid;
border-image: radial-gradient(#ff2, #55f) 40;
border-image-outset: 1.5; /\* 1.5 × 1.4rem = 2.1rem \*/
margin: 2.1rem;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # the-border-image-outset](https://w3c.github.io/csswg-drafts/css-backgrounds/#the-border-image-outset) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-image-outset` | 15 | 12 | 15 | 11 | 15 | 6 | 4.4 | 18 | 15 | 14 | 6 | 1.0 |
See also
--------
* [Backgrounds and borders](css_backgrounds_and_borders)
* [Learn CSS: Backgrounds and borders](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Backgrounds_and_borders)
css border-width border-width
============
The `border-width` [shorthand](shorthand_properties) [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the width of an element's border.
Try it
------
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`border-bottom-width`](border-bottom-width)
* [`border-left-width`](border-left-width)
* [`border-right-width`](border-right-width)
* [`border-top-width`](border-top-width)
Syntax
------
```
/\* Keyword values \*/
border-width: thin;
border-width: medium;
border-width: thick;
/\* <length> values \*/
border-width: 4px;
border-width: 1.2rem;
/\* top and bottom | left and right \*/
border-width: 2px 1.5em;
/\* top | left and right | bottom \*/
border-width: 1px 2em 1.5cm;
/\* top | right | bottom | left \*/
border-width: 1px 2em 0 4rem;
/\* Global values \*/
border-width: inherit;
border-width: initial;
border-width: revert;
border-width: revert-layer;
border-width: unset;
```
The `border-width` property may be specified using one, two, three, or four values.
* When **one** value is specified, it applies the same width to **all four sides**.
* When **two** values are specified, the first width applies to the **top and bottom**, the second to the **left and right**.
* When **three** values are specified, the first width applies to the **top**, the second to the **left and right**, the third to the **bottom**.
* When **four** values are specified, the widths apply to the **top**, **right**, **bottom**, and **left** in that order (clockwise).
### Values
`<line-width>` Defines the width of the border, either as an explicit nonnegative [`<length>`](length) or a keyword. If it's a keyword, it must be one of the following values:
* `thin`
* `medium`
* `thick`
**Note:** Because the specification doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific. Nevertheless, they always follow the pattern `thin ≤ medium ≤ thick`, and the values are constant within a single document.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`border-top-width`](border-top-width): `medium`
* [`border-right-width`](border-right-width): `medium`
* [`border-bottom-width`](border-bottom-width): `medium`
* [`border-left-width`](border-left-width): `medium`
|
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`border-bottom-width`](border-bottom-width): the absolute length or `0` if [`border-bottom-style`](border-bottom-style) is `none` or `hidden`
* [`border-left-width`](border-left-width): the absolute length or `0` if [`border-left-style`](border-left-style) is `none` or `hidden`
* [`border-right-width`](border-right-width): the absolute length or `0` if [`border-right-style`](border-right-style) is `none` or `hidden`
* [`border-top-width`](border-top-width): the absolute length or `0` if [`border-top-style`](border-top-style) is `none` or `hidden`
|
| Animation type | as each of the properties of the shorthand:* [`border-bottom-width`](border-bottom-width): a [length](length#interpolation)
* [`border-left-width`](border-left-width): a [length](length#interpolation)
* [`border-right-width`](border-right-width): a [length](length#interpolation)
* [`border-top-width`](border-top-width): a [length](length#interpolation)
|
Formal syntax
-------------
```
border-width =
<line-width>[{1,4}](value_definition_syntax#curly_braces)
<line-width> =
[<length [0,∞]>](length) [|](value_definition_syntax#single_bar)
thin [|](value_definition_syntax#single_bar)
medium [|](value_definition_syntax#single_bar)
thick
```
Examples
--------
### A mix of values and lengths
#### HTML
```
<p id="sval">one value: 6px wide border on all 4 sides</p>
<p id="bival">
two different values: 2px wide top and bottom border, 10px wide right and left
border
</p>
<p id="treval">
three different values: 0.3em top, 9px bottom, and zero width right and left
</p>
<p id="fourval">
four different values: "thin" top, "medium" right, "thick" bottom, and 1em
left
</p>
```
#### CSS
```
#sval {
border: ridge #ccc;
border-width: 6px;
}
#bival {
border: solid red;
border-width: 2px 10px;
}
#treval {
border: dotted orange;
border-width: 0.3em 0 9px;
}
#fourval {
border: solid lightgreen;
border-width: thin medium thick 1em;
}
p {
width: auto;
margin: 0.25em;
padding: 0.25em;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # the-border-width](https://w3c.github.io/csswg-drafts/css-backgrounds/#the-border-width) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-width` | 1 | 12 | 1 | 4 | 3.5 | 1 | 2 | 18 | 4 | 10.1 | 3 | 1.0 |
See also
--------
* The border-related shorthand properties: [`border`](border), [`border-style`](border-style), [`border-color`](border-color)
* The border-width-related properties: [`border-bottom-width`](border-bottom-width), [`border-left-width`](border-left-width), [`border-right-width`](border-right-width), [`border-top-width`](border-top-width)
css padding-block-end padding-block-end
=================
The `padding-block-end` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the logical block end padding of an element, which maps to a physical padding depending on the element's writing mode, directionality, and text orientation.
Try it
------
Syntax
------
```
/\* <length> values \*/
padding-block-end: 10px; /\* An absolute length \*/
padding-block-end: 1em; /\* A length relative to the text size \*/
/\* <percentage> value \*/
padding-block-end: 5%; /\* A padding relative to the block container's width \*/
/\* Global values \*/
padding-block-end: inherit;
padding-block-end: initial;
padding-block-end: revert;
padding-block-end: revert-layer;
padding-block-end: unset;
```
### Values
[`<length>`](length) The size of the padding as a fixed value. Must be nonnegative.
[`<percentage>`](percentage) The size of the padding as a percentage, relative to the inline size (*width* in a horizontal language, defined by [`writing-mode`](writing-mode)) of the [containing block](containing_block). Must be nonnegative.
Description
-----------
The `padding-block-end` property is defined in the specification as taking the same values as the [`padding-top`](padding-top) property. However, the physical property it maps to depends on the values set for [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation). Therefore, it could map to [`padding-bottom`](padding-bottom), [`padding-right`](padding-right), or [`padding-left`](padding-left)
It relates to [`padding-block-start`](padding-block-start), [`padding-inline-start`](padding-inline-start), and [`padding-inline-end`](padding-inline-end), which define the other paddings of the element.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements, except `table-row-group`, `table-header-group`, `table-footer-group`, `table-row`, `table-column-group` and `table-column` |
| [Inherited](inheritance) | no |
| Percentages | logical-width of containing block |
| [Computed value](computed_value) | as [`<length>`](length) |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
padding-block-end =
<'padding-top'>
```
Examples
--------
### Setting block end padding for vertical text
#### HTML
```
<div>
<p class="exampleText">Example text</p>
</div>
```
#### CSS
```
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-lr;
padding-block-end: 20px;
background-color: #c8c800;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # padding-properties](https://w3c.github.io/csswg-drafts/css-logical/#padding-properties) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `padding-block-end` | 87 | 87 | 41 | No | 73 | 12.1 | 87 | 87 | 41 | 62 | 12.2 | 14.0 |
See also
--------
* [CSS Logical Properties and Values](css_logical_properties)
* The mapped physical properties: [`padding-top`](padding-top), [`padding-right`](padding-right), [`padding-bottom`](padding-bottom), and [`padding-left`](padding-left)
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)
css :placeholder-shown :placeholder-shown
==================
The `:placeholder-shown` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) represents any [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) or [`<textarea>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) element that is currently displaying [placeholder text](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder).
Try it
------
Syntax
------
```
:placeholder-shown
```
Examples
--------
### Basic example
This example applies special font and border styles when the placeholder is shown.
#### HTML
```
<input placeholder="Type something here!" />
```
#### CSS
```
input {
border: 1px solid black;
padding: 3px;
}
input:placeholder-shown {
border-color: teal;
color: purple;
font-style: italic;
}
```
#### Result
### Overflowing text
When form fields are too small, placeholder text can get cropped in an undesirable way. You can use the [`text-overflow`](text-overflow) property to alter the way overflowing text is displayed.
#### HTML
```
<input id="input1" placeholder="Name, Rank, and Serial Number" /> <br /><br />
<input id="input2" placeholder="Name, Rank, and Serial Number" />
```
#### CSS
```
#input2:placeholder-shown {
text-overflow: ellipsis;
}
```
#### Result
### Customized input field
The following example highlights the Student ID field with a custom style.
#### HTML
```
<form id="test">
<p>
<label for="name">Enter Student Name:</label>
<input id="name" placeholder="Student Name" />
</p>
<p>
<label for="branch">Enter Student Branch:</label>
<input id="branch" placeholder="Student Branch" />
</p>
<p>
<label for="sid">Enter Student ID:</label>
<input
type="number"
pattern="[0-9]{8}"
title="8 digit ID"
id="sid"
class="studentid"
placeholder="8 digit id" />
</p>
<input type="submit" />
</form>
```
#### CSS
```
input {
background-color: #e8e8e8;
color: black;
}
input.studentid:placeholder-shown {
background-color: yellow;
color: red;
font-style: italic;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # placeholder](https://w3c.github.io/csswg-drafts/selectors/#placeholder) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:placeholder-shown` | 47 | 79 | 51
4-51 | 10 | 34 | 9 | 47 | 47 | 51
4-51 | 34 | 9 | 5.0 |
| `non_text_types` | 47 | 79 | 59 | No | 34 | 9 | 47 | 47 | 59 | 34 | 9 | 5.0 |
See also
--------
* The [`::placeholder`](::placeholder) pseudo-element styles the placeholder *itself*.
* Related HTML elements: [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input), [`<textarea>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea)
* [HTML forms](https://developer.mozilla.org/en-US/docs/Learn/Forms)
| programming_docs |
css border-block border-block
============
The `border-block` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property is a [shorthand property](shorthand_properties) for setting the individual logical block border property values in a single place in the style sheet.
Try it
------
`border-block` can be used to set the values for one or more of [`border-block-width`](border-block-width), [`border-block-style`](border-block-style), and [`border-block-color`](border-block-color) setting both the start and end in the block dimension at once. The physical borders to which it maps depends on the element's writing mode, directionality, and text orientation. It corresponds to the [`border-top`](border-top) and [`border-bottom`](border-bottom) or [`border-right`](border-right), and [`border-left`](border-left) properties depending on the values defined for [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation).
The borders in the other dimension can be set with [`border-inline`](border-inline), which sets [`border-inline-start`](border-inline-start), and [`border-inline-end`](border-inline-end).
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`border-block-color`](border-block-color)
* [`border-block-style`](border-block-style)
* [`border-block-width`](border-block-width)
Syntax
------
```
border-block: 1px;
border-block: 2px dotted;
border-block: medium dashed blue;
/\* Global values \*/
border-block: inherit;
border-block: initial;
border-block: revert;
border-block: revert-layer;
border-block: unset;
```
### Values
The `border-block` is specified with one or more of the following, in any order:
`<'border-width'>` The width of the border. See [`border-width`](border-width).
`<'border-style'>` The line style of the border. See [`border-style`](border-style).
`<'color'>` The color of the border. See [`color`](color).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`border-top-width`](border-top-width): `medium`
* [`border-top-style`](border-top-style): `none`
* [`border-top-color`](border-top-color): `currentcolor`
|
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`border-top-width`](border-top-width): the absolute length or `0` if [`border-top-style`](border-top-style) is `none` or `hidden`
* [`border-top-style`](border-top-style): as specified
* [`border-top-color`](border-top-color): computed color
|
| Animation type | discrete |
Formal syntax
-------------
```
border-block =
<'border-block-start'>
```
Examples
--------
### Border with vertical text
#### HTML
```
<div>
<p class="exampleText">Example text</p>
</div>
```
#### CSS
```
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-rl;
border-block: 5px dashed blue;
}
```
#### Results
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # propdef-border-block](https://w3c.github.io/csswg-drafts/css-logical/#propdef-border-block) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-block` | 87 | 87 | 66 | No | 73 | 14.1 | 87 | 87 | 66 | 62 | 14.5 | 14.0 |
See also
--------
* [CSS Logical Properties and Values](css_logical_properties)
* This property maps to one of the physical border properties: [`border-top`](border-top), [`border-right`](border-right), [`border-bottom`](border-bottom), or [`border-left`](border-left).
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)
css :last-of-type :last-of-type
=============
The `:last-of-type` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) represents the last element of its type among a group of sibling elements.
Try it
------
Syntax
------
```
:last-of-type
```
Examples
--------
### Styling the last paragraph
#### HTML
```
<h2>Heading</h2>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
```
#### CSS
```
p:last-of-type {
color: red;
font-style: italic;
}
```
#### Result
### Nested elements
This example shows how nested elements can also be targeted. Note that the [universal selector](universal_selectors) (`*`) is implied when no simple selector is written.
#### HTML
```
<article>
<div>This `div` is first.</div>
<div>This <span>nested `span` is last</span>!</div>
<div>
This <em>nested `em` is first</em>, but this <em>nested `em` is last</em>!
</div>
<p>This `p` qualifies!</p>
<div>This is the final `div`!</div>
</article>
```
#### CSS
```
article :last-of-type {
background-color: pink;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # last-of-type-pseudo](https://w3c.github.io/csswg-drafts/selectors/#last-of-type-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:last-of-type` | 1 | 12
Before Edge 16, Microsoft Edge treats all unknown elements (such as custom elements) as the same element type. | 3.5 | 9
Internet Explorer treats all unknown elements (such as custom elements) as the same element type. | 9.5 | 3.1 | 2 | 18 | 4 | 10.1 | 2 | 1.0 |
See also
--------
* [`:last-child`](:last-child), [`:nth-last-of-type`](:nth-last-of-type)
css border-left-style border-left-style
=================
The `border-left-style` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the line style of an element's left [`border`](border).
Try it
------
**Note:** The specification doesn't define how borders of different styles connect in the corners.
Syntax
------
```
/\* Keyword values \*/
border-left-style: none;
border-left-style: hidden;
border-left-style: dotted;
border-left-style: dashed;
border-left-style: solid;
border-left-style: double;
border-left-style: groove;
border-left-style: ridge;
border-left-style: inset;
border-left-style: outset;
/\* Global values \*/
border-left-style: inherit;
border-left-style: initial;
border-left-style: revert;
border-left-style: revert-layer;
border-left-style: unset;
```
The `border-left-style` property is specified as a single keyword chosen from those available for the [`border-style`](border-style) property.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
border-left-style =
<line-style>
<line-style> =
none [|](value_definition_syntax#single_bar)
hidden [|](value_definition_syntax#single_bar)
dotted [|](value_definition_syntax#single_bar)
dashed [|](value_definition_syntax#single_bar)
solid [|](value_definition_syntax#single_bar)
double [|](value_definition_syntax#single_bar)
groove [|](value_definition_syntax#single_bar)
ridge [|](value_definition_syntax#single_bar)
inset [|](value_definition_syntax#single_bar)
outset
```
Examples
--------
### Setting border-left-style
#### HTML
```
<table>
<tr>
<td class="b1">none</td>
<td class="b2">hidden</td>
<td class="b3">dotted</td>
<td class="b4">dashed</td>
</tr>
<tr>
<td class="b5">solid</td>
<td class="b6">double</td>
<td class="b7">groove</td>
<td class="b8">ridge</td>
</tr>
<tr>
<td class="b9">inset</td>
<td class="b10">outset</td>
</tr>
</table>
```
#### CSS
```
/\* Define look of the table \*/
table {
border-width: 2px;
background-color: #52e385;
}
tr,
td {
padding: 3px;
}
/\* border-left-style example classes \*/
.b1 {border-left-style: none;}
.b2 {border-left-style: hidden;}
.b3 {border-left-style: dotted;}
.b4 {border-left-style: dashed;}
.b5 {border-left-style: solid;}
.b6 {border-left-style: double;}
.b7 {border-left-style: groove;}
.b8 {border-left-style: ridge;}
.b9 {border-left-style: inset;}
.b10 {border-left-style: outset;}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # the-border-style](https://w3c.github.io/csswg-drafts/css-backgrounds/#the-border-style) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-left-style` | 1 | 12 | 1
Before Firefox 50, border styles of rounded corners (with [`border-radius`](https://developer.mozilla.org/docs/Web/CSS/border-radius)) were always rendered as if `border-bottom-style` was `solid`. This has been fixed in Firefox 50. | 5.5 | 9.2 | 1 | 2.2 | 18 | 14
Before Firefox 50, border styles of rounded corners (with [`border-radius`](https://developer.mozilla.org/docs/Web/CSS/border-radius)) were always rendered as if `border-bottom-style` was `solid`. This has been fixed in Firefox 50. | 14 | 1 | 1.0 |
See also
--------
* The other style-related border properties: [`border-bottom-style`](border-bottom-style), [`border-right-style`](border-right-style), [`border-top-style`](border-top-style), and [`border-style`](border-style).
* The other left-border-related properties: [`border-left`](border-left), [`border-left-color`](border-left-color), and [`border-left-width`](border-left-width).
css vertical-align vertical-align
==============
The `vertical-align` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets vertical alignment of an inline, inline-block or table-cell box.
Try it
------
The vertical-align property can be used in two contexts:
* To vertically align an inline element's box inside its containing line box. For example, it could be used to [vertically position an image in a line of text](#vertical_alignment_in_a_line_box).
* To vertically align [the content of a cell in a table](#vertical_alignment_in_a_table_cell).
Note that `vertical-align` only applies to inline, inline-block and table-cell elements: you can't use it to vertically align [block-level elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements).
Syntax
------
```
/\* Keyword values \*/
vertical-align: baseline;
vertical-align: sub;
vertical-align: super;
vertical-align: text-top;
vertical-align: text-bottom;
vertical-align: middle;
vertical-align: top;
vertical-align: bottom;
/\* <length> values \*/
vertical-align: 10em;
vertical-align: 4px;
/\* <percentage> values \*/
vertical-align: 20%;
/\* Global values \*/
vertical-align: inherit;
vertical-align: initial;
vertical-align: revert;
vertical-align: revert-layer;
vertical-align: unset;
```
The `vertical-align` property is specified as one of the values listed below.
### Values for inline elements
#### Parent-relative values
These values vertically align the element relative to its parent element:
`baseline` Aligns the baseline of the element with the baseline of its parent. The baseline of some [replaced elements](replaced_element), like [`<textarea>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea), is not specified by the HTML specification, meaning that their behavior with this keyword may vary between browsers.
`sub` Aligns the baseline of the element with the subscript-baseline of its parent.
`super` Aligns the baseline of the element with the superscript-baseline of its parent.
`text-top` Aligns the top of the element with the top of the parent element's font.
`text-bottom` Aligns the bottom of the element with the bottom of the parent element's font.
`middle` Aligns the middle of the element with the baseline plus half the x-height of the parent.
[`<length>`](length) Aligns the baseline of the element to the given length above the baseline of its parent. A negative value is allowed.
[`<percentage>`](percentage) Aligns the baseline of the element to the given percentage above the baseline of its parent, with the value being a percentage of the [`line-height`](line-height) property. A negative value is allowed.
#### Line-relative values
The following values vertically align the element relative to the entire line:
`top` Aligns the top of the element and its descendants with the top of the entire line.
`bottom` Aligns the bottom of the element and its descendants with the bottom of the entire line.
For elements that do not have a baseline, the bottom margin edge is used instead.
### Values for table cells
`baseline` (and `sub`, `super`, `text-top`, `text-bottom`, `<length>`, and `<percentage>`) Aligns the baseline of the cell with the baseline of all other cells in the row that are baseline-aligned.
`top` Aligns the top padding edge of the cell with the top of the row.
`middle` Centers the padding box of the cell within the row.
`bottom` Aligns the bottom padding edge of the cell with the bottom of the row.
Negative values are allowed.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `baseline` |
| Applies to | inline-level and table-cell elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | no |
| Percentages | refer to the [`line-height`](line-height) of the element itself |
| [Computed value](computed_value) | for percentage and length values, the absolute length, otherwise the keyword as specified |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
vertical-align =
[[](value_definition_syntax#brackets) first [|](value_definition_syntax#single_bar) last []](value_definition_syntax#brackets) [||](value_definition_syntax#double_bar)
<'alignment-baseline'> [||](value_definition_syntax#double_bar)
<'baseline-shift'>
```
Examples
--------
### Basic example
#### HTML
```
<div>
An <img src="frame\_image.svg" alt="link" width="32" height="32" /> image with
a default alignment.
</div>
<div>
An
<img class="top" src="frame\_image.svg" alt="link" width="32" height="32" />
image with a text-top alignment.
</div>
<div>
An
<img class="bottom" src="frame\_image.svg" alt="link" width="32" height="32" />
image with a text-bottom alignment.
</div>
<div>
An
<img class="middle" src="frame\_image.svg" alt="link" width="32" height="32" />
image with a middle alignment.
</div>
```
#### CSS
```
img.top {
vertical-align: text-top;
}
img.bottom {
vertical-align: text-bottom;
}
img.middle {
vertical-align: middle;
}
```
#### Result
### Vertical alignment in a line box
#### HTML
```
<p>
top: <img style="vertical-align: top" src="star.png"/>
middle: <img style="vertical-align: middle" src="star.png"/>
bottom: <img style="vertical-align: bottom" src="star.png"/>
super: <img style="vertical-align: super" src="star.png"/>
sub: <img style="vertical-align: sub" src="star.png"/>
</p>
<p>
text-top: <img style="vertical-align: text-top" src="star.png"/>
text-bottom: <img style="vertical-align: text-bottom" src="star.png"/>
0.2em: <img style="vertical-align: 0.2em" src="star.png"/>
-1em: <img style="vertical-align: -1em" src="star.png"/>
20%: <img style="vertical-align: 20%" src="star.png"/>
-100%: <img style="vertical-align: -100%" src="star.png"/>
</p>
```
#### Result
### Vertical alignment in a table cell
#### HTML
```
<table>
<tr>
<td style="vertical-align: baseline">baseline</td>
<td style="vertical-align: top">top</td>
<td style="vertical-align: middle">middle</td>
<td style="vertical-align: bottom">bottom</td>
<td>
<p>
There is a theory which states that if ever anyone discovers exactly
what the Universe is for and why it is here, it will instantly disappear
and be replaced by something even more bizarre and inexplicable.
</p>
<p>
There is another theory which states that this has already happened.
</p>
</td>
</tr>
</table>
```
#### CSS
```
table {
margin-left: auto;
margin-right: auto;
width: 80%;
}
table,
th,
td {
border: 1px solid black;
}
td {
padding: 0.5em;
font-family: monospace;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification # propdef-vertical-align](https://w3c.github.io/csswg-drafts/css2/#propdef-vertical-align) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `vertical-align` | 1 | 12 | 1 | 4 | 4 | 1 | 4.4 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [Typical use cases of Flexbox, section "Center item"](css_flexible_box_layout/typical_use_cases_of_flexbox#center_item)
* [`line-height`](line-height), [`text-align`](text-align), [`margin`](margin)
* [Understanding `vertical-align`, or "How (Not) To Vertically Center Content"](http://phrogz.net/css/vertical-align/index.html)
* [Vertical-Align: All You Need To Know](https://christopheraue.net/design/vertical-align)
css font-weight font-weight
===========
The `font-weight` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the weight (or boldness) of the font. The weights available depend on the [`font-family`](font-family) that is currently set.
Try it
------
Syntax
------
```
/\* Keyword values \*/
font-weight: normal;
font-weight: bold;
/\* Keyword values relative to the parent \*/
font-weight: lighter;
font-weight: bolder;
/\* Numeric keyword values \*/
font-weight: 100;
font-weight: 200;
font-weight: 300;
font-weight: 400; /\* normal \*/
font-weight: 500;
font-weight: 600;
font-weight: 700; /\* bold \*/
font-weight: 800;
font-weight: 900;
/\* Global values \*/
font-weight: inherit;
font-weight: initial;
font-weight: revert;
font-weight: revert-layer;
font-weight: unset;
```
The `font-weight` property is specified using any one of the values listed below.
### Values
`normal` Normal font weight. Same as `400`.
`bold` Bold font weight. Same as `700`.
`lighter` One relative font weight lighter than the parent element. Note that only four font weights are considered for relative weight calculation; see the [Meaning of relative weights](#meaning_of_relative_weights) section below.
`bolder` One relative font weight heavier than the parent element. Note that only four font weights are considered for relative weight calculation; see the [Meaning of relative weights](#meaning_of_relative_weights) section below.
`<number>` A [`<number>`](number) value between 1 and 1000, inclusive. Higher numbers represent weights that are bolder than (or as bold as) lower numbers. Certain commonly used values correspond to common weight names, as described in the [Common weight name mapping](#common_weight_name_mapping) section below.
In earlier versions of the `font-weight` specification, the property accepts only keyword values and the numeric values 100, 200, 300, 400, 500, 600, 700, 800, and 900; non-variable fonts can only really make use of these set values, although fine-grained values (e.g. 451) will be translated to one of these values for non-variable fonts using the [Fallback weights](#fallback_weights) system.
CSS Fonts Level 4 extends the syntax to accept any number between 1 and 1000 and introduces [Variable fonts](#variable_fonts), which can make use of this much finer-grained range of font weights.
### Fallback weights
If the exact weight given is unavailable, then the following rule is used to determine the weight actually rendered:
* If the target weight given is between `400` and `500` inclusive:
+ Look for available weights between the target and `500`, in ascending order.
+ If no match is found, look for available weights less than the target, in descending order.
+ If no match is found, look for available weights greater than `500`, in ascending order.
* If a weight less than `400` is given, look for available weights less than the target, in descending order. If no match is found, look for available weights greater than the target, in ascending order.
* If a weight greater than `500` is given, look for available weights greater than the target, in ascending order. If no match is found, look for available weights less than the target, in descending order.
### Meaning of relative weights
When `lighter` or `bolder` is specified, the below chart shows how the absolute font weight of the element is determined.
Note that when using relative weights, only four font weights are considered — thin (100), normal (400), bold (700), and heavy (900). If a font-family has more weights available, they are ignored for the purposes of relative weight calculation.
| Inherited value | `bolder` | `lighter` |
| --- | --- | --- |
| 100 | 400 | 100 |
| 200 | 400 | 100 |
| 300 | 400 | 100 |
| 400 | 700 | 100 |
| 500 | 700 | 100 |
| 600 | 900 | 400 |
| 700 | 900 | 400 |
| 800 | 900 | 700 |
| 900 | 900 | 700 |
### Common weight name mapping
The numerical values `100` to `900` roughly correspond to the following common weight names (see the [OpenType specification](https://docs.microsoft.com/typography/opentype/spec/os2#usweightclass)):
| Value | Common weight name |
| --- | --- |
| 100 | Thin (Hairline) |
| 200 | Extra Light (Ultra Light) |
| 300 | Light |
| 400 | Normal (Regular) |
| 500 | Medium |
| 600 | Semi Bold (Demi Bold) |
| 700 | Bold |
| 800 | Extra Bold (Ultra Bold) |
| 900 | Black (Heavy) |
| 950 | [Extra Black (Ultra Black)](https://docs.microsoft.com/dotnet/api/system.windows.fontweights?view=netframework-4.8#remarks) |
### Variable fonts
Most fonts have a particular weight which corresponds to one of the numbers in [Common weight name mapping](#common_weight_name_mapping). However some fonts, called variable fonts, can support a range of weights with a more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight.
For TrueType or OpenType variable fonts, the "wght" variation is used to implement varying widths.
**Note:** For the example below to work, you'll need a browser that supports the CSS Fonts Level 4 syntax in which `font-weight` can be any number between `1` and `1000`. The demo loads with `font-weight: 500;`. Change the value to see the weight of the text change.
Accessibility concerns
----------------------
People experiencing low vision conditions may have difficulty reading text set with a `font-weight` value of `100` (Thin/Hairline) or `200` (Extra Light), especially if the font has a [low contrast color ratio](color#accessibility_concerns).
* [MDN Understanding WCAG, Guideline 1.4 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background)
* [Understanding Success Criterion 1.4.8 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-visual-presentation.html)
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | the keyword or the numerical value as specified, with `bolder` and `lighter` transformed to the real value |
| Animation type | a [font weight](font-weight#Interpolation) |
Formal syntax
-------------
```
font-weight =
<font-weight-absolute> [|](value_definition_syntax#single_bar)
bolder [|](value_definition_syntax#single_bar)
lighter
<font-weight-absolute> =
normal [|](value_definition_syntax#single_bar)
bold [|](value_definition_syntax#single_bar)
[<number [1,1000]>](number)
```
Examples
--------
### Setting font weights
#### HTML
```
<p>
Alice was beginning to get very tired of sitting by her sister on the bank,
and of having nothing to do: once or twice she had peeped into the book her
sister was reading, but it had no pictures or conversations in it, "and what
is the use of a book," thought Alice "without pictures or conversations?"
</p>
<div>
I'm heavy<br />
<span>I'm lighter</span>
</div>
```
#### CSS
```
/\* Set paragraph text to be bold. \*/
p {
font-weight: bold;
}
/\* Set div text to two steps heavier than
normal but less than a standard bold. \*/
div {
font-weight: 600;
}
/\* Set span text to be one step lighter
than its parent. \*/
span {
font-weight: lighter;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Fonts Module Level 4 # font-weight-prop](https://w3c.github.io/csswg-drafts/css-fonts/#font-weight-prop) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `font-weight` | 2 | 12 | 1 | 3 | 3.5 | 1 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
| `number` | 62 | 17 | 61 | No | 49 | 11 | 62 | 62 | 61 | 46 | 11 | 8.0 |
See Also
--------
* [`font-family`](font-family)
* [`font-style`](font-style)
* [Fundamental text and font styling](https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_text/Fundamentals)
| programming_docs |
css shape-outside shape-outside
=============
The `shape-outside` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines a shape—which may be non-rectangular—around which adjacent inline content should wrap. By default, inline content wraps around its margin box; `shape-outside` provides a way to customize this wrapping, making it possible to wrap text around complex objects rather than simple boxes.
Try it
------
Syntax
------
```
/\* Keyword values \*/
shape-outside: none;
shape-outside: margin-box;
shape-outside: content-box;
shape-outside: border-box;
shape-outside: padding-box;
/\* Function values \*/
shape-outside: circle();
shape-outside: ellipse();
shape-outside: inset(10px 10px 10px 10px);
shape-outside: polygon(10px 10px, 20px 20px, 30px 30px);
shape-outside: path(
"M0.5,1 C0.5,1,0,0.7,0,0.3 A0.25,0.25,1,1,1,0.5,0.3 A0.25,0.25,1,1,1,1,0.3 C1,0.7,0.5,1,0.5,1 Z"
);
/\* <url> value \*/
shape-outside: url(image.png);
/\* <gradient> value \*/
shape-outside: linear-gradient(45deg, rgba(255, 255, 255, 0) 150px, red 150px);
/\* Global values \*/
shape-outside: inherit;
shape-outside: initial;
shape-outside: revert;
shape-outside: revert-layer;
shape-outside: unset;
```
The `shape-outside` property is specified using the values from the list below, which define the *float area* for *float elements*. The float area determines the shape around which inline content (float elements) wrap.
### Values
`none` The float area is unaffected. Inline content wraps around the element's margin box, like usual.
`<shape-box>` The float area is computed according to the shape of a float element's edges (as defined by the [CSS box model](css_box_model/introduction_to_the_css_box_model)). This can be `margin-box`, `border-box`, `padding-box`, or `content-box`. The shape includes any curvature created by the [`border-radius`](border-radius) property (behavior which is similar to [`background-clip`](background-clip)).
`margin-box` Defines the shape enclosed by the outside margin edge. The corner radii of this shape are determined by the corresponding [`border-radius`](border-radius) and [`margin`](margin) values. If the `border-radius / margin` ratio is `1` or more, then the margin box corner radius is `border-radius + margin`. If the ratio is less than `1`, then the margin box corner radius is `border-radius + (margin * (1 + (ratio-1)^3))`.
`border-box` Defines the shape enclosed by the outside border edge. The shape follows the normal border radius shaping rules for the outside of the border.
`padding-box` Defines the shape enclosed by the outside padding edge. The shape follows the normal border radius shaping rules for the inside of the border.
`content-box` Defines the shape enclosed by the outside content edge. Each corner radius of this box is the larger of `0` or `border-radius - border-width - padding`.
[`<basic-shape>`](basic-shape) The float area is computed based on the shape created by of one of [`inset()`](basic-shape/inset), [`circle()`](basic-shape/circle), [`ellipse()`](basic-shape/ellipse), [`polygon()`](basic-shape/polygon) or, as added in the level 2 specification, `path()`. If a `<shape-box>` is also supplied, it defines the reference box for the `<basic-shape>` function. Otherwise, the reference box defaults to `margin-box`.
[`<image>`](image) The float area is extracted and computed based on the alpha channel of the specified [`<image>`](image) as defined by [`shape-image-threshold`](shape-image-threshold).
**Note:** [User agents](https://developer.mozilla.org/en-US/docs/Glossary/User_agent) must use the potentially CORS-enabled fetch method defined by the HTML specification for all URLs in a `shape-outside` value. When fetching, user agents must use "Anonymous" mode, set the referrer source to the stylesheet's URL, and set the origin to the URL of the containing document. If this results in network errors such that there is no valid fallback image, the effect is as if the value `none` had been specified.
Interpolation
-------------
When animating between one `<basic-shape>` and a second, the rules below are applied. The values in the shape functions interpolate as a simple list. The list values interpolate as [`<length>`](length), [`<percentage>`](percentage), or [`calc()`](calc) where possible. If list values are not one of those types but are identical (such as finding `nonzero` in the same list position in both lists), those values do interpolate.
* Both shapes must use the same reference box.
* If both shapes are the same type, that type is `ellipse()` or `circle()`, and none of the radii use the `closest-side` or `farthest-side` keywords, interpolate between each value in the shape functions.
* If both shapes are of type `inset()`, interpolate between each value in the shape functions.
* If both shapes are of type `polygon()`, both polygons have the same number of vertices, and use the same `<fill-rule>`, interpolate between each value in the shape functions.
* In all other cases no interpolation occurs.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | floats |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as defined for [`<basic-shape>`](basic-shape) (with [`shape-box`](shape-outside) following, if supplied), the [`<image>`](image) with its URI made absolute, otherwise as specified. |
| Animation type | yes, as specified for [`<basic-shape>`](basic-shape), otherwise no |
Formal syntax
-------------
```
shape-outside =
none [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [<basic-shape>](basic-shape) [||](value_definition_syntax#double_bar) <shape-box> []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
<image>
<shape-box> =
<box> [|](value_definition_syntax#single_bar)
margin-box
<image> =
<url> [|](value_definition_syntax#single_bar)
[<gradient>](gradient)
<box> =
border-box [|](value_definition_syntax#single_bar)
padding-box [|](value_definition_syntax#single_bar)
content-box
<url> =
url( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) ) [|](value_definition_syntax#single_bar)
src( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) )
```
Examples
--------
### Funneling text
#### HTML
```
<div class="main">
<div class="left"></div>
<div class="right"></div>
<p>
Sometimes a web page's text content appears to be funneling your attention
towards a spot on the page to drive you to follow a particular link.
Sometimes you don't notice.
</p>
</div>
```
#### CSS
```
.main {
width: 530px;
}
.left,
.right {
width: 40%;
height: 12ex;
background-color: lightgray;
}
.left {
-webkit-shape-outside: polygon(0 0, 100% 100%, 0 100%);
shape-outside: polygon(0 0, 100% 100%, 0 100%);
float: left;
-webkit-clip-path: polygon(0 0, 100% 100%, 0 100%);
clip-path: polygon(0 0, 100% 100%, 0 100%);
}
.right {
-webkit-shape-outside: polygon(100% 0, 100% 100%, 0 100%);
shape-outside: polygon(100% 0, 100% 100%, 0 100%);
float: right;
-webkit-clip-path: polygon(100% 0, 100% 100%, 0 100%);
clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
p {
text-align: center;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Shapes Module Level 1 # shape-outside-property](https://w3c.github.io/csswg-drafts/css-shapes/#shape-outside-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `shape-outside` | 37 | 79 | 62 | No | 24 | 10.1 | 37 | 37 | 62 | 24 | 10.3 | 3.0 |
| `circle` | 37 | 79 | 62 | No | 24 | 10.1 | 37 | 37 | 62 | 24 | 10.3 | 3.0 |
| `gradient` | 37 | 79 | 62 | No | 24 | 10.1 | 37 | 37 | 62 | 24 | 10.3 | 3.0 |
| `image` | 37 | 79 | 62 | No | 24 | 10.1 | 37 | 37 | 62 | 24 | 10.3 | 3.0 |
| `inset` | 37 | 79 | 62 | No | 24 | 10.1 | 37 | 37 | 62 | 24 | 10.3 | 3.0 |
| `polygon` | 37 | 79 | 62 | No | 24 | 10.1 | 37 | 37 | 62 | 24 | 10.3 | 3.0 |
See also
--------
* [CSS Shapes](css_shapes)
* [Overview of CSS Shapes](css_shapes/overview_of_css_shapes)
* [Shapes from Box Values](css_shapes/from_box_values)
* [Basic Shapes](css_shapes/basic_shapes)
* [Shapes from Images](css_shapes/shapes_from_images)
* [`<basic-shape>`](basic-shape)
* [`shape-margin`](shape-margin)
* [`shape-image-threshold`](shape-image-threshold)
css :default :default
========
The `:default` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) selects form elements that are the default in a group of related elements.
Try it
------
What this selector matches is defined in [HTML Standard §4.16.3 Pseudo-classes](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-default) — it may match the [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button), [`<input type="checkbox">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox), [`<input type="radio">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio), and [`<option>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option) elements:
* A default option element is the first one with the `selected` attribute, or the first enabled option in DOM order. `multiple` [`<select>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)s can have more than one `selected` option, so all will match `:default`.
* `<input type="checkbox">` and `<input type="radio">` match if they have the `checked` attribute.
* [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button) matches if it is a [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)'s [default submission button](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#implicit-submission): the first `<button>` in DOM order that belongs to the form. This also applies to [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) types that submit forms, like `image` or `submit`.
Syntax
------
```
:default
```
Examples
--------
### HTML
```
<fieldset>
<legend>Favorite season</legend>
<input type="radio" name="season" id="spring" value="spring" />
<label for="spring">Spring</label>
<input type="radio" name="season" id="summer" value="summer" checked />
<label for="summer">Summer</label>
<input type="radio" name="season" id="fall" value="fall" />
<label for="fall">Fall</label>
<input type="radio" name="season" id="winter" value="winter" />
<label for="winter">Winter</label>
</fieldset>
```
### CSS
```
input:default {
box-shadow: 0 0 2px 1px coral;
}
input:default + label {
color: coral;
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [HTML Standard # selector-default](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-default) |
| [Selectors Level 4 # default-pseudo](https://w3c.github.io/csswg-drafts/selectors/#default-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:default` | 10 | 79 | 4 | No | 10 | 5 | 37 | 18 | 4 | 10.1 | 5 | 1.0 |
See also
--------
* [Web forms — Working with user data](https://developer.mozilla.org/en-US/docs/Learn/Forms)
* [Styling web forms](https://developer.mozilla.org/en-US/docs/Learn/Forms/Styling_web_forms)
* Related HTML elements: [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button), [`<input type="checkbox">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox), [`<input type="radio">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio), and [`<option>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
css :local-link :local-link
===========
The `:local-link` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) represents a link to the same document. Therefore an element that is the source anchor of a hyperlink whose target's absolute URL matches the element's own document URL.
```
/\* Selects any <a> that links to the current document \*/
a:local-link {
color: green;
}
```
Syntax
------
```
:local-link
```
Examples
--------
### HTML
```
<a href="#target">This is a link on the current page.</a><br />
<a href="https://example.com">This is an external link</a><br />
```
### CSS
```
a:local-link {
color: green;
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # local-link-pseudo](https://drafts.csswg.org/selectors/#local-link-pseudo) |
Browser compatibility
---------------------
See also
--------
* Link-related pseudo-classes: [`:link`](:link), [`:visited`](:visited), [`:hover`](:hover), [`:active`](:active), [`:any-link`](:any-link)
css text-rendering text-rendering
==============
The `text-rendering` CSS property provides information to the rendering engine about what to optimize for when rendering text.
The browser makes trade-offs among speed, legibility, and geometric precision.
```
/\* Keyword values \*/
text-rendering: auto;
text-rendering: optimizeSpeed;
text-rendering: optimizeLegibility;
text-rendering: geometricPrecision;
/\* Global values \*/
text-rendering: inherit;
text-rendering: initial;
text-rendering: revert;
text-rendering: revert-layer;
text-rendering: unset;
```
**Note:** The `text-rendering` property is an SVG property that is not defined in any CSS standard. However, Gecko and WebKit browsers let you apply this property to HTML and XML content on Windows, macOS, and Linux.
One very visible effect is `optimizeLegibility`, which enables ligatures (ff, fi, fl, etc.) in text smaller than 20px for some fonts (for example, Microsoft's *Calibri*, *Candara*, *Constantia*, and *Corbel*, or the *DejaVu* font family).
Syntax
------
### Values
`auto` Non-standard
The browser makes educated guesses about when to optimize for speed, legibility, and geometric precision while drawing text. For differences in how this value is interpreted by the browser, see the compatibility table.
`optimizeSpeed` The browser emphasizes rendering speed over legibility and geometric precision when drawing text. It disables kerning and ligatures.
`optimizeLegibility` The browser emphasizes legibility over rendering speed and geometric precision. This enables kerning and optional ligatures.
`geometricPrecision` Non-standard
The browser emphasizes geometric precision over rendering speed and legibility. Certain aspects of fonts — such as kerning — don't scale linearly. So this value can make text using those fonts look good.
In SVG, when text is scaled up or down, browsers calculate the final size of the text (which is determined by the specified font size and the applied scale) and request a font of that computed size from the platform's font system. But if you request a font size of, say, 9 with a scale of 140%, the resulting font size of 12.6 doesn't explicitly exist in the font system, so the browser rounds the font size to 12 instead. This results in stair-step scaling of text.
But the `geometricPrecision` property — when fully supported by the rendering engine — lets you scale your text fluidly. For large scale factors, you might see less-than-beautiful text rendering, but the size is what you would expect—neither rounded up nor down to the nearest font size supported by Windows or Linux.
**Note:** WebKit precisely applies the specified value, but Gecko treats the value the same as `optimizeLegibility`.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | text elements |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
text-rendering =
auto [|](value_definition_syntax#single_bar)
optimizeSpeed [|](value_definition_syntax#single_bar)
optimizeLegibility [|](value_definition_syntax#single_bar)
geometricPrecision
```
Examples
--------
### Automatic application of optimizeLegibility
This demonstrates how `optimizeLegibility` is used by browsers automatically when the `font-size` is smaller than `20px`.
#### HTML
```
<p class="small">LYoWAT - ff fi fl ffl</p>
<p class="big">LYoWAT - ff fi fl ffl</p>
```
#### CSS
```
.small {
font: 19.9px "Constantia", "Times New Roman", "Georgia", "Palatino", serif;
}
.big {
font: 20px "Constantia", "Times New Roman", "Georgia", "Palatino", serif;
}
```
#### Result
### optimizeSpeed vs optimizeLegibility
This example shows the difference between the appearance of `optimizeSpeed` and `optimizeLegibility` (in your browser; other browsers may vary).
#### HTML
```
<p class="speed">LYoWAT - ff fi fl ffl</p>
<p class="legibility">LYoWAT - ff fi fl ffl</p>
```
#### CSS
```
p {
font: 1.5em "Constantia", "Times New Roman", "Georgia", "Palatino", serif;
}
.speed {
text-rendering: optimizeSpeed;
}
.legibility {
text-rendering: optimizeLegibility;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Scalable Vector Graphics (SVG) 2 # TextRenderingProperty](https://svgwg.org/svg2-draft/painting.html#TextRenderingProperty) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `text-rendering` | 4
["This property is only supported on Windows and Linux.", "Initial versions had bugs on Windows and Linux that broke [font substitution](https://crbug.com/114719), [small-caps](https://crbug.com/51973), [letter-spacing](https://crbug.com/55458) or caused [text to overlap](https://crbug.com/149548)."] | 79
["This property is only supported on Windows and Linux.", "Initial versions had bugs on Windows and Linux that broke [font substitution](https://crbug.com/114719), [small-caps](https://crbug.com/51973), [letter-spacing](https://crbug.com/55458) or caused [text to overlap](https://crbug.com/149548)."] | 1
["This property is only supported on Windows and Linux.", "The `optimizeSpeed` option has no effect on Firefox 4 because the standard code for text rendering is already fast and there is not a faster code path at this time. See [bug 595688](https://bugzil.la/595688) for details."] | No | 15 | 5 | 3
From version 3 to 4.3, there is a serious bug where `text-rendering: optimizeLegibility` causes custom web fonts to not render. This was fixed in version 4.4. | 18
["This property is only supported on Windows and Linux.", "Initial versions had bugs on Windows and Linux that broke [font substitution](https://crbug.com/114719), [small-caps](https://crbug.com/51973), [letter-spacing](https://crbug.com/55458) or caused [text to overlap](https://crbug.com/149548)."] | 46 | 14 | 4.2 | 1.0
This property is only supported on Windows and Linux. Samsung Internet is not on Windows or Linux. |
| `auto` | 4
Chrome treats `auto` as `optimizeSpeed`. | 79
Edge treats `auto` as `optimizeSpeed`. | 1
If the font size is 20 pixels or higher, Firefox treats `auto` as `optimizeLegibility`. For smaller text, Firefox treats `auto` as `optimizeSpeed`. The 20-pixel threshold can be changed with the `browser.display.auto_quality_min_font_size` preference. | No | 15
Opera treats `auto` as `optimizeSpeed`. | 5
Safari treats `auto` as `optimizeSpeed`. See [WebKit bug 41363](https://webkit.org/b/41363). | ≤37
WebView treats `auto` as `optimizeSpeed`. | 18
Chrome treats `auto` as `optimizeSpeed`. | 46
If the font size is 20 pixels or higher, Firefox treats `auto` as `optimizeLegibility`. For smaller text, Firefox treats `auto` as `optimizeSpeed`. The 20-pixel threshold can be changed with the `browser.display.auto_quality_min_font_size` preference. | 14
Opera treats `auto` as `optimizeSpeed`. | 4.2
Safari treats `auto` as `optimizeSpeed`. See [WebKit bug 41363](https://webkit.org/b/41363). | 1.0
Samsung Internet treats `auto` as `optimizeSpeed`. |
| `geometricPrecision` | 13
Supports true geometric precision without rounding up or down to the nearest supported font size in the operating system. | 79
Supports true geometric precision without rounding up or down to the nearest supported font size in the operating system. | 1
Firefox treats `geometricPrecision` the same as `optimizeLegibility`. | No | 15
Supports true geometric precision without rounding up or down to the nearest supported font size in the operating system. | 6 | 37
Supports true geometric precision without rounding up or down to the nearest supported font size in the operating system. | 18
Supports true geometric precision without rounding up or down to the nearest supported font size in the operating system. | 46
Firefox treats `geometricPrecision` the same as `optimizeLegibility`. | 14
Supports true geometric precision without rounding up or down to the nearest supported font size in the operating system. | 6 | 1.0
Supports true geometric precision without rounding up or down to the nearest supported font size in the operating system. |
See also
--------
* [Drawing text in a `<canvas>`](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text)
* [CSS Text Decoration](css_text_decoration) CSS module
* Related CSS properties
+ [`text-decoration`](text-decoration) (and its longhand properties, such as [`text-decoration-line`](text-decoration-line), [`text-decoration-style`](text-decoration-style), and [`text-decoration-thickness`](text-decoration-thickness))
+ [`text-emphasis`](text-emphasis) (and its longhand properties, including [`text-emphasis-color`](text-emphasis-color), [`text-emphasis-position`](text-emphasis-position), and [`text-emphasis-style`](text-emphasis-style))
+ [`text-shadow`](text-shadow)
+ [`text-transform`](text-transform)
* The [SVG](https://developer.mozilla.org/en-US/docs/Web/SVG) `[text-rendering](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-rendering)` attribute
* [SVG and CSS](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_and_CSS)
| programming_docs |
css grid-template-rows grid-template-rows
==================
The `grid-template-rows` CSS property defines the line names and track sizing functions of the [grid rows](https://developer.mozilla.org/en-US/docs/Glossary/Grid_Row).
Try it
------
Syntax
------
```
/\* Keyword value \*/
grid-template-rows: none;
/\* <track-list> values \*/
grid-template-rows: 100px 1fr;
grid-template-rows: [linename] 100px;
grid-template-rows: [linename1] 100px [linename2 linename3];
grid-template-rows: minmax(100px, 1fr);
grid-template-rows: fit-content(40%);
grid-template-rows: repeat(3, 200px);
grid-template-rows: subgrid;
grid-template-rows: masonry;
/\* <auto-track-list> values \*/
grid-template-rows: 200px repeat(auto-fill, 100px) 300px;
grid-template-rows:
minmax(100px, max-content)
repeat(auto-fill, 200px) 20%;
grid-template-rows:
[linename1] 100px [linename2]
repeat(auto-fit, [linename3 linename4] 300px)
100px;
grid-template-rows:
[linename1 linename2] 100px
repeat(auto-fit, [linename1] 300px) [linename3];
/\* Global values \*/
grid-template-rows: inherit;
grid-template-rows: initial;
grid-template-rows: revert;
grid-template-rows: revert-layer;
grid-template-rows: unset;
```
This property may be specified as:
* either the keyword value `none`
* or a `<track-list>` value
* or an `<auto-track-list>` value.
### Values
`none` Is a keyword meaning that there is no explicit grid. Any rows will be implicitly generated and their size will be determined by the [`grid-auto-rows`](grid-auto-rows) property.
`[linename]` A [`<custom-ident>`](custom-ident) specifying a name for the line in that location. The ident may be any valid string other than the reserved words `span` and `auto`. Lines may have multiple names separated by a space inside the square brackets, for example `[line-name-a line-name-b]`.
[`<length>`](length) Is a non-negative length.
[`<percentage>`](percentage) Is a non-negative [`<percentage>`](percentage) value, relative to the block size of the grid container. If the size of the grid container depends on the size of its tracks, then the percentage must be treated as `auto` for the purpose of calculating the intrinsic size of the grid container. It must then be resolved against the resulting grid container size for the purpose of laying out the grid and its items. The intrinsic size contributions of the track may be adjusted to the size of the grid container and may increase the final size of the track by the minimum amount that would result in honoring the percentage.
[`<flex>`](flex_value) Is a non-negative dimension with the unit `fr` specifying the track's flex factor. Each `<flex>`-sized track takes a share of the remaining space in proportion to its flex factor. When appearing outside a `minmax()` notation, it implies an automatic minimum (i.e. `minmax(auto, <flex>)`).
[`max-content`](max-content) Is a keyword representing the largest maximal content contribution of the grid items occupying the grid track.
[`min-content`](min-content) Is a keyword representing the largest minimal content contribution of the grid items occupying the grid track.
[`minmax(min, max)`](minmax) Is a functional notation that defines a size range, greater than or equal to *min*, and less than or equal to *max*. If *max* is smaller than *min*, then *max* is ignored and the function is treated as *min*. As a maximum, a `<flex>` value sets the track's flex factor. It is invalid as a minimum.
`auto` As a maximum represents the largest [`max-content`](max-content) size of the items in that track.
As a minimum represents the largest minimum size of items in that track (specified by the [`min-width`](min-width)/[`min-height`](min-height) of the items). This is often, though not always, the [`min-content`](min-content) size.
If used outside of [`minmax()`](minmax) notation, `auto` represents the range between the minimum and maximum described above. This behaves similarly to `minmax(min-content,max-content)` in most cases.
**Note:** `auto` track sizes (and only `auto` track sizes) can be stretched by the [`align-content`](align-content) and [`justify-content`](justify-content) properties. Therefore by default, an `auto` sized track will take up any remaining space in the grid container.
[`fit-content( [ <length> | <percentage> ] )`](fit-content_function) Represents the formula `min(max-content, max(auto, argument))`, which is calculated similar to `auto` (i.e. `minmax(auto, max-content)`), except that the track size is clamped at *argument* if it is greater than the `auto` minimum.
[`repeat( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> )`](repeat) Represents a repeated fragment of the track list, allowing a large number of rows that exhibit a recurring pattern to be written in a more compact form.
[`masonry`](css_grid_layout/masonry_layout) Experimental
The masonry value indicates that this axis should be laid out according to the masonry algorithm.
[`subgrid`](css_grid_layout/subgrid) The `subgrid` value indicates that the grid will adopt the spanned portion of its parent grid in that axis. Rather than being specified explicitly, the sizes of the grid rows/columns will be taken from the parent grid's definition.
**Warning:** The `masonry` value is from Level 3 of the Grid specification and currently only has an experimental implementation behind a flag in Firefox.
The `subgrid` value is from Level 2 of the Grid specification and currently only has implementation in Firefox 71 and onwards.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | grid containers |
| [Inherited](inheritance) | no |
| Percentages | refer to corresponding dimension of the content area |
| [Computed value](computed_value) | as specified, but with relative lengths converted into absolute lengths |
| Animation type | simple list of length, percentage, or calc, provided the only differences are in the values of the length, percentage, or calc components in the list |
Formal syntax
-------------
```
grid-template-rows =
none [|](value_definition_syntax#single_bar)
<track-list> [|](value_definition_syntax#single_bar)
<auto-track-list> [|](value_definition_syntax#single_bar)
subgrid <line-name-list>[?](value_definition_syntax#question_mark)
<track-list> =
[[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) <track-size> [|](value_definition_syntax#single_bar) <track-repeat> []](value_definition_syntax#brackets) []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) <line-names>[?](value_definition_syntax#question_mark)
<auto-track-list> =
[[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) <fixed-size> [|](value_definition_syntax#single_bar) <fixed-repeat> []](value_definition_syntax#brackets) []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk) <line-names>[?](value_definition_syntax#question_mark) <auto-repeat> [[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) <fixed-size> [|](value_definition_syntax#single_bar) <fixed-repeat> []](value_definition_syntax#brackets) []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk) <line-names>[?](value_definition_syntax#question_mark)
<line-name-list> =
[[](value_definition_syntax#brackets) <line-names> [|](value_definition_syntax#single_bar) <name-repeat> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus)
<line-names> =
'[' [<custom-ident>](custom-ident)[\*](value_definition_syntax#asterisk) ']'
<track-size> =
<track-breadth> [|](value_definition_syntax#single_bar)
minmax( <inflexible-breadth> , <track-breadth> ) [|](value_definition_syntax#single_bar)
fit-content( <length-percentage> )
<track-repeat> =
repeat( [[](value_definition_syntax#brackets) [<integer [1,∞]>](integer) []](value_definition_syntax#brackets) , [[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) <track-size> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) <line-names>[?](value_definition_syntax#question_mark) )
<fixed-size> =
<fixed-breadth> [|](value_definition_syntax#single_bar)
minmax( <fixed-breadth> , <track-breadth> ) [|](value_definition_syntax#single_bar)
minmax( <inflexible-breadth> , <fixed-breadth> )
<fixed-repeat> =
repeat( [[](value_definition_syntax#brackets) [<integer [1,∞]>](integer) []](value_definition_syntax#brackets) , [[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) <fixed-size> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) <line-names>[?](value_definition_syntax#question_mark) )
<auto-repeat> =
repeat( [[](value_definition_syntax#brackets) auto-fill [|](value_definition_syntax#single_bar) auto-fit []](value_definition_syntax#brackets) , [[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) <fixed-size> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) <line-names>[?](value_definition_syntax#question_mark) )
<name-repeat> =
repeat( [[](value_definition_syntax#brackets) [<integer [1,∞]>](integer) [|](value_definition_syntax#single_bar) auto-fill []](value_definition_syntax#brackets) , <line-names>[+](value_definition_syntax#plus) )
<track-breadth> =
<length-percentage> [|](value_definition_syntax#single_bar)
[<flex>](flex) [|](value_definition_syntax#single_bar)
min-content [|](value_definition_syntax#single_bar)
max-content [|](value_definition_syntax#single_bar)
auto
<inflexible-breadth> =
<length-percentage> [|](value_definition_syntax#single_bar)
min-content [|](value_definition_syntax#single_bar)
max-content [|](value_definition_syntax#single_bar)
auto
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
<fixed-breadth> =
<length-percentage>
```
Examples
--------
### Specifying grid row sizes
#### HTML
```
<div id="grid">
<div id="areaA">A</div>
<div id="areaB">B</div>
</div>
```
#### CSS
```
#grid {
display: grid;
height: 100px;
grid-template-rows: 30px 1fr;
}
#areaA {
background-color: lime;
}
#areaB {
background-color: yellow;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Grid Layout Module Level 2 # track-sizing](https://w3c.github.io/csswg-drafts/css-grid/#track-sizing) |
| [CSS Grid Layout Module Level 2 # subgrids](https://w3c.github.io/csswg-drafts/css-grid/#subgrids) |
| [CSS Grid Layout Module Level 3 # masonry-layout](https://w3c.github.io/csswg-drafts/css-grid-3/#masonry-layout) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `grid-template-rows` | 57 | 16
12-79 | 52 | 10 | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
| `animation` | 107 | 107 | 66 | No | 93 | 16 | 107 | 107 | 66 | No | 16 | No |
| `fit-content` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
| `masonry` | No | No | 77 | No | No | No | No | No | No | No | No | No |
| `minmax` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
| `repeat` | 57 | 16 | 76
57-76
`repeat(auto-fill, ...)` and `repeat(auto-fit, ...)` only support one repeated column (see [bug 1341507](https://bugzil.la/1341507)).
52-57
[`calc()`](https://developer.mozilla.org/docs/Web/CSS/calc) doesn't work in `repeat()` (see [bug 1350069](https://bugzil.la/1350069)). | No | 44 | 10.1 | 57 | 57 | 79
57-79
`repeat(auto-fill, ...)` and `repeat(auto-fit, ...)` only support one repeated column (see [bug 1341507](https://bugzil.la/1341507)).
52-57
[`calc()`](https://developer.mozilla.org/docs/Web/CSS/calc) doesn't work in `repeat()` (see [bug 1350069](https://bugzil.la/1350069)). | 43 | 10.3 | 6.0 |
| `subgrid` | No
See [bug 618969](https://crbug.com/618969). | No
See [bug 618969](https://crbug.com/618969). | 71 | No | No
See [bug 618969](https://crbug.com/618969). | 16 | No
See [bug 618969](https://crbug.com/618969). | No
See [bug 618969](https://crbug.com/618969). | No | No
See [bug 618969](https://crbug.com/618969). | 16 | No
See [bug 618969](https://crbug.com/618969). |
See also
--------
* Related CSS properties: [`grid-template-columns`](grid-template-columns), [`grid-template-areas`](grid-template-areas), [`grid-template`](grid-template)
* Grid Layout Guide: *[Basic concepts of grid layout - Grid Tracks](css_grid_layout/basic_concepts_of_grid_layout#grid_tracks)*
* Video tutorial: *[Defining a Grid](https://gridbyexample.com/video/series-define-a-grid/)*
* [Subgrid](css_grid_layout/subgrid)
css :last-child :last-child
===========
The `:last-child` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) represents the last element among a group of sibling elements.
Try it
------
Syntax
------
```
:last-child
```
Examples
--------
### Basic example
#### HTML
```
<div>
<p>This text isn't selected.</p>
<p>This text is selected!</p>
</div>
<div>
<p>This text isn't selected.</p>
<h2>This text isn't selected: it's not a `p`.</h2>
</div>
```
#### CSS
```
p:last-child {
color: lime;
background-color: black;
padding: 5px;
}
```
#### Result
### Styling a list
#### HTML
```
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>
Item 3
<ul>
<li>Item 3.1</li>
<li>Item 3.2</li>
<li>Item 3.3</li>
</ul>
</li>
</ul>
```
#### CSS
```
ul li {
color: blue;
}
ul li:last-child {
border: 1px solid red;
color: red;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # the-last-child-pseudo](https://w3c.github.io/csswg-drafts/selectors/#the-last-child-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:last-child` | 1 | 12 | 1 | 9 | 9.5 | 3.1 | ≤37 | 18 | 4 | 10.1 | 2 | 1.0 |
| `no_parent_required` | 57 | 79 | 52 | No | 44 | No | 57 | 57 | 52 | 43 | No | 7.0 |
See also
--------
* [`:-moz-last-node`](:-moz-last-node) Non-standard
* [`:last-of-type`](:last-of-type)
* [`:first-child`](:first-child)
* [`:nth-child`](:nth-child)
css atan() atan()
======
The `atan()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) is a trigonometric function that returns the inverse tangent of a number between `-∞` and `+∞`. The function contains a single calculation that returns the number of radians representing an [`<angle>`](angle) between `-90deg` and `90deg`.
Syntax
------
```
/\* Single <number> values \*/
transform: rotate(atan(1));
transform: rotate(atan(4 * 50));
/\* Other values \*/
transform: rotate(atan(pi / 2));
transform: rotate(atan(e * 3));
```
### Parameter
The `atan(number)` function accepts only one value as its parameter.
`number` A calculation which resolves to a [`<number>`](number) between `-∞` and `+∞`.
### Return value
The inverse tangent of an `number` will always return an [`<angle>`](angle) between `-90deg` and `90deg`.
* If `number` is `0⁻`, the result is `0⁻`.
* If `number` is `+∞` the result is `90deg`.
* If `number` is `-∞` the result is `-90deg`.
That is:
* `atan(-infinity)` representing `-90deg`.
* `atan(-1)` representing `-45deg`
* `atan(0)` representing `0deg`
* `atan(1)` representing `45deg`
* `atan(infinity)` representing `90deg`.
### Formal syntax
```
<atan()> =
atan( <calc-sum> )
<calc-sum> =
<calc-product> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '+' [|](value_definition_syntax#single_bar) '-' []](value_definition_syntax#brackets) <calc-product> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-product> =
<calc-value> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '*' [|](value_definition_syntax#single_bar) '/' []](value_definition_syntax#brackets) <calc-value> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-value> =
[<number>](number) [|](value_definition_syntax#single_bar)
[<dimension>](dimension) [|](value_definition_syntax#single_bar)
[<percentage>](percentage) [|](value_definition_syntax#single_bar)
<calc-constant> [|](value_definition_syntax#single_bar)
( <calc-sum> )
<calc-constant> =
e [|](value_definition_syntax#single_bar)
pi [|](value_definition_syntax#single_bar)
infinity [|](value_definition_syntax#single_bar)
-infinity [|](value_definition_syntax#single_bar)
NaN
```
Examples
--------
### Rotate elements
The `atan()` function can be used to [`rotate`](transform-function/rotate) elements as it return an [`<angle>`](angle).
#### HTML
```
<div class="box box-1"></div>
<div class="box box-2"></div>
<div class="box box-3"></div>
<div class="box box-4"></div>
<div class="box box-5"></div>
```
#### CSS
```
div.box {
width: 100px;
height: 100px;
background: linear-gradient(orange, red);
}
div.box-1 {
transform: rotate(atan(-99999));
}
div.box-2 {
transform: rotate(atan(-1));
}
div.box-3 {
transform: rotate(atan(0));
}
div.box-4 {
transform: rotate(atan(1));
}
div.box-5 {
transform: rotate(atan(99999));
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 4 # trig-funcs](https://w3c.github.io/csswg-drafts/css-values/#trig-funcs) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `atan` | No | No | 108 | No | No | 15.4 | No | No | 108 | No | 15.4 | No |
See also
--------
* [`sin()`](sin)
* [`cos()`](cos)
* [`tan()`](tan)
* [`asin()`](asin)
* [`acos()`](acos)
* [`atan2()`](atan2)
css container-type container-type
==============
The **container-type** [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property is used to define the [type of containment](css_container_queries#naming_containment_contexts) used in a [container query](css_container_queries).
Syntax
------
```
container-type: <type>;
```
### Values
* `size`: Establishes a query container for container size queries on both the inline and block axis in both the [inline and block](css_logical_properties/basic_concepts#block_and_inline_dimensions) dimensions. Applies layout containment, style containment, and size containment to the container.
* `inline-size`: Establishes a query container for dimensional queries on the [inline axis](css_logical_properties/basic_concepts#block_and_inline_dimensions) of the container. Applies layout, style, and inline-size containment to the element.
* `normal`: The element is not a query container for any container size queries, but remains a query container for container style queries.
**Note:** to understand what happens when you apply layout, style, and size containment to a box, see the [`contain`](contain) property.
Example
-------
Given the following HTML example which is a card component with an image, a title, and some text:
```
<div class="container">
<div class="card">
<img src="image.png" alt="Cat with two different color eyes" />
<h2>Card title</h2>
<p>Card content</p>
</div>
</div>
```
To create a container context, add the `container-type` property to an element. The following uses the `inline-size` value to create a containment context for the [inline axis](css_logical_properties/basic_concepts#block_and_inline_dimensions) of the container:
```
.container {
container-type: inline-size;
}
```
Writing a container query via the [`@container`](@container) at-rule will apply styles to the elements of the container when it is wider than 400px:
```
@container (min-width: 400px) {
.card {
display: grid;
grid-template-columns: 2fr 1fr;
}
}
```
For more information on container queries, see the [CSS Container Queries](css_container_queries) page.
Specifications
--------------
| Specification |
| --- |
| [CSS Containment Module Level 3 # container-type](https://w3c.github.io/csswg-drafts/css-contain-3/#container-type) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `container-type` | 105 | 105 | preview | No | 91 | 16 | 105 | 105 | No | 72 | 16 | No |
See also
--------
* [CSS container queries](css_container_queries)
* [`@container`](@container) at-rule
* CSS [`container`](container) shorthand property
* CSS [`container-name`](container-name) property
* CSS [`content-visibility`](content-visibility) property
| programming_docs |
css list-style-position list-style-position
===================
The `list-style-position` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the position of the [`::marker`](::marker) relative to a list item.
Try it
------
It is often more convenient to use the shorthand [`list-style`](list-style).
**Note:** This property is applied to list items, i.e., elements with `[`display`](display): list-item;`. [By default](https://html.spec.whatwg.org/multipage/rendering.html#lists) this includes [`<li>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li) elements. Because this property is inherited, it can be set on the parent element (normally [`<ol>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol) or [`<ul>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul)) to let it apply to all list items.
Note that there is variance among browsers regarding behavior when a block element is placed first within a list element declared as `list-style-position: inside`. Chrome and Safari both place this element on the same line as the marker box, whereas Firefox, Internet Explorer, and Opera place it on the next line. For more information on this, see [bug 36854](https://bugzilla.mozilla.org/show_bug.cgi?id=36854).
Syntax
------
```
/\* Keyword values \*/
list-style-position: inside;
list-style-position: outside;
/\* Global values \*/
list-style-position: inherit;
list-style-position: initial;
list-style-position: revert;
list-style-position: revert-layer;
list-style-position: unset;
```
The `list-style-position` property is specified as one of the keyword values listed below.
### Values
`inside` The [`::marker`](::marker) is the first element among the list item's contents.
`outside` The [`::marker`](::marker) is outside the principal block box.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `outside` |
| Applies to | list items |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
list-style-position =
inside [|](value_definition_syntax#single_bar)
outside
```
Examples
--------
### Setting list item position
#### HTML
```
<ul class="inside">
List 1
<li>List Item 1-1</li>
<li>List Item 1-2</li>
<li>List Item 1-3</li>
<li>List Item 1-4</li>
</ul>
<ul class="outside">
List 2
<li>List Item 2-1</li>
<li>List Item 2-2</li>
<li>List Item 2-3</li>
<li>List Item 2-4</li>
</ul>
<ul class="inside-img">
List 3
<li>List Item 3-1</li>
<li>List Item 3-2</li>
<li>List Item 3-3</li>
<li>List Item 3-4</li>
</ul>
```
#### CSS
```
.inside {
list-style-position: inside;
list-style-type: square;
}
.outside {
list-style-position: outside;
list-style-type: circle;
}
.inside-img {
list-style-position: inside;
list-style-image: url("starsolid.gif");
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Lists and Counters Module Level 3 # list-style-position-property](https://w3c.github.io/csswg-drafts/css-lists/#list-style-position-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `list-style-position` | 1 | 12 | 1 | 4 | 3.5 | 1 | ≤37 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [`list-style`](list-style), [`list-style-type`](list-style-type), [`list-style-image`](list-style-image)
css :enabled :enabled
========
The `:enabled` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) represents any enabled element. An element is enabled if it can be activated (selected, clicked on, typed into, etc.) or accept focus. The element also has a disabled state, in which it can't be activated or accept focus.
Try it
------
Syntax
------
```
:enabled
```
Examples
--------
The following example makes the color of text and button [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)s green when enabled, and gray when disabled. This helps the user understand which elements can be interacted with.
### HTML
```
<form action="url\_of\_form">
<label for="FirstField">First field (enabled):</label>
<input type="text" id="FirstField" value="Lorem" /><br />
<label for="SecondField">Second field (disabled):</label>
<input type="text" id="SecondField" value="Ipsum" disabled="disabled" /><br />
<input type="button" value="Submit" />
</form>
```
### CSS
```
input:enabled {
color: #2b2;
}
input:disabled {
color: #aaa;
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [HTML Standard # selector-enabled](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-enabled) |
| [Selectors Level 4 # enableddisabled](https://w3c.github.io/csswg-drafts/selectors/#enableddisabled) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:enabled` | 1 | 12 | 1 | 9 | 9 | 3.1 | 2 | 18 | 4 | 10.1 | 2 | 1.0 |
See also
--------
* [`:disabled`](:disabled)
css @charset @charset
========
The `@charset` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) <at-rule> specifies the character encoding used in the style sheet. It must be the first element in the style sheet and not be preceded by any character; as it is not a [nested statement](syntax#nested_statements), it cannot be used inside [conditional group at-rules](at-rule#conditional_group_rules). If several `@charset` at-rules are defined, only the first one is used, and it cannot be used inside a `style` attribute on an HTML element or inside the [`<style>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style) element where the character set of the HTML page is relevant.
```
@charset "utf-8";
```
This at-rule is useful when using non-ASCII characters in some CSS properties, like [`content`](content).
As there are several ways to define the character encoding of a style sheet, the browser will try the following methods in the following order (and stop as soon as one yields a result) :
1. The value of the [Unicode byte-order](https://en.wikipedia.org/wiki/Byte_order_mark) character placed at the beginning of the file.
2. The value given by the `charset` attribute of the `Content-Type:` HTTP header or the equivalent in the protocol used to serve the style sheet.
3. The `@charset` CSS at-rule.
4. Use the character encoding defined by the referring document: the `charset` attribute of the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) element. This method is obsolete and should not be used.
5. Assume that the document is UTF-8
Syntax
------
```
@charset "UTF-8";
@charset "iso-8859-15";
```
### Formal syntax
```
@charset "<charset>";
```
*charset* A [`<string>`](string) denoting the character encoding to be used. It must be the name of a web-safe character encoding defined in the [IANA-registry](https://www.iana.org/assignments/character-sets/character-sets.xhtml), and must be double-quoted, following exactly one space character (U+0020), and immediately terminated with a semicolon. If several names are associated with an encoding, only the one marked with *preferred* must be used.
Examples
--------
### Valid and invalid charset declarations
```
@charset "UTF-8"; /\* Set the encoding of the style sheet to Unicode UTF-8 \*/
@charset 'iso-8859-15'; /\* Invalid, wrong quoting style used \*/
@charset "UTF-8"; /\* Invalid, more than one space \*/
@charset "UTF-8"; /\* Invalid, there is a character (a space) before the at-rule \*/
@charset UTF-8; /\* Invalid, without ' or ", the charset is not a CSS <string> \*/
```
Specifications
--------------
| Specification |
| --- |
| [Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification # charset①](#) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `@charset` | 2 | 12 | 1.5
Firefox 1 supported an invalid syntax where the character encoding is not between single or double quotes. | 5.5
From Internet Explorer 5.5 to IE 7 (inclusive), Internet Explorer supported an invalid syntax where the character encoding is not between single or double quotes. | 9 | 4 | 2 | 18 | 4 | 10.1 | 4 | 1.0 |
See also
--------
* [Character set](https://developer.mozilla.org/en-US/docs/Glossary/Character_set) glossary entry
* [Unicode](https://developer.mozilla.org/en-US/docs/Glossary/Unicode) glossary entry
css mask-border-repeat mask-border-repeat
==================
The `mask-border-repeat` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets how the [edge regions](border-image-slice#edge-regions) of a source image are adjusted to fit the dimensions of an element's [mask border](mask-border).
Syntax
------
```
/\* Keyword value \*/
mask-border-repeat: stretch;
mask-border-repeat: repeat;
mask-border-repeat: round;
mask-border-repeat: space;
/\* top and bottom | left and right \*/
mask-border-repeat: round stretch;
/\* Global values \*/
mask-border-repeat: inherit;
mask-border-repeat: initial;
mask-border-repeat: revert;
mask-border-repeat: revert-layer;
mask-border-repeat: unset;
```
The `mask-border-repeat` property may be specified using one or two values chosen from the list of values below.
* When **one** value is specified, it applies the same behavior on **all four sides**.
* When **two** values are specified, the first applies to the **top and bottom**, the second to the **left and right**.
### Values
`stretch` The source image's edge regions are stretched to fill the gap between each border.
`repeat` The source image's edge regions are tiled (repeated) to fill the gap between each border. Tiles may be clipped to achieve the proper fit.
`round` The source image's edge regions are tiled (repeated) to fill the gap between each border. Tiles may be stretched to achieve the proper fit.
`space` The source image's edge regions are tiled (repeated) to fill the gap between each border. Extra space will be distributed in between tiles to achieve the proper fit.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `stretch` |
| Applies to | all elements; In SVG, it applies to container elements excluding the [`<defs>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs) element and all graphics elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
mask-border-repeat =
[[](value_definition_syntax#brackets) stretch [|](value_definition_syntax#single_bar) repeat [|](value_definition_syntax#single_bar) round [|](value_definition_syntax#single_bar) space []](value_definition_syntax#brackets)[{1,2}](value_definition_syntax#curly_braces)
```
Examples
--------
### Basic usage
This property doesn't appear to be supported anywhere yet. When it eventually starts to be supported, it will serve to define how the border mask slice will repeat around the border — i.e. will it just repeat, or be scaled slightly so a whole number of slices fits, or be stretched so one slice fits?
```
mask-border-repeat: round;
```
Chromium-based browsers support an outdated version of this property — `mask-box-image-repeat` — with a prefix:
```
-webkit-mask-box-image-repeat: round;
```
**Note:** The [`mask-border`](mask-border) page features a working example (using the out-of-date prefixed border mask properties supported in Chromium), so you can get an idea of the effect.
Specifications
--------------
| Specification |
| --- |
| [CSS Masking Module Level 1 # the-mask-border-repeat](https://drafts.fxtf.org/css-masking/#the-mask-border-repeat) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `mask-border-repeat` | 1 | 79 | No
See [bug 877294](https://bugzil.la/877294). | No | 15 | 3.1 | 4.4 | 18 | No
See [bug 877294](https://bugzil.la/877294). | 14 | 3 | 1.0 |
See also
--------
* [`mask-border`](mask-border)
* [`mask-border-mode`](mask-border-mode)
* [`mask-border-outset`](mask-border-outset)
* [`mask-border-source`](mask-border-source)
* [`mask-border-width`](mask-border-width)
css asin() asin()
======
The `asin()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) is a trigonometric function that returns the inverse sine of a number between `-1` and `1`. The function contains a single calculation that returns the number of radians representing an [`<angle>`](angle) between `-90deg` and `90deg`.
Syntax
------
```
/\* Single <number> values \*/
transform: rotate(asin(-0.2));
transform: rotate(asin(2 * 0.125));
/\* Other values \*/
transform: rotate(asin(pi / 5));
transform: rotate(asin(e / 3));
```
### Parameter
The `asin(number)` function accepts only one value as its parameter.
`number` A calculation which resolves to a [`<number>`](number) between `-1` and `1`.
### Return value
The inverse sine of an `number` will always return an [`<angle>`](angle) between `-90deg` and `90deg`.
* If `number` is less than `-1` or greater than `1`, the result is `NaN`.
* If `number` is `0⁻`, the result is `0⁻`.
### Formal syntax
```
<asin()> =
asin( <calc-sum> )
<calc-sum> =
<calc-product> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '+' [|](value_definition_syntax#single_bar) '-' []](value_definition_syntax#brackets) <calc-product> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-product> =
<calc-value> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '*' [|](value_definition_syntax#single_bar) '/' []](value_definition_syntax#brackets) <calc-value> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-value> =
[<number>](number) [|](value_definition_syntax#single_bar)
[<dimension>](dimension) [|](value_definition_syntax#single_bar)
[<percentage>](percentage) [|](value_definition_syntax#single_bar)
<calc-constant> [|](value_definition_syntax#single_bar)
( <calc-sum> )
<calc-constant> =
e [|](value_definition_syntax#single_bar)
pi [|](value_definition_syntax#single_bar)
infinity [|](value_definition_syntax#single_bar)
-infinity [|](value_definition_syntax#single_bar)
NaN
```
Examples
--------
### Rotate elements
The `asin()` function can be used to [`rotate`](transform-function/rotate) elements as it return an [`<angle>`](angle).
#### HTML
```
<div class="box box-1"></div>
<div class="box box-2"></div>
<div class="box box-3"></div>
<div class="box box-4"></div>
<div class="box box-5"></div>
```
#### CSS
```
div.box {
width: 100px;
height: 100px;
background: linear-gradient(orange, red);
}
div.box-1 {
transform: rotate(asin(1));
}
div.box-2 {
transform: rotate(asin(0.5));
}
div.box-3 {
transform: rotate(asin(0));
}
div.box-4 {
transform: rotate(asin(-0.5));
}
div.box-5 {
transform: rotate(asin(-1));
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 4 # trig-funcs](https://w3c.github.io/csswg-drafts/css-values/#trig-funcs) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `asin` | No | No | 108 | No | No | 15.4 | No | No | 108 | No | 15.4 | No |
See also
--------
* [`sin()`](sin)
* [`cos()`](cos)
* [`tan()`](tan)
* [`acos()`](acos)
* [`atan()`](atan)
* [`atan2()`](atan2)
css CSS selectors CSS selectors
=============
**CSS selectors** define the pattern to select elements to which a set of CSS rules are then applied.
CSS selectors can be grouped into the following categories based on the type of elements they can select.
Basic selectors
---------------
[Universal selector](universal_selectors) Selects all elements. Optionally, it may be restricted to a specific namespace or to all namespaces.
**Syntax:** `*` `ns|*` `*|*`
**Example:** `*` will match all the elements of the document.
[Type selector](type_selectors) Selects all elements that have the given node name.
**Syntax:** `elementname`
**Example:** `input` will match any [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) element.
[Class selector](class_selectors) Selects all elements that have the given `class` attribute.
**Syntax:** `.classname`
**Example:** `.index` will match any element that has `class="index"`.
[ID selector](id_selectors) Selects an element based on the value of its `id` attribute. There should be only one element with a given ID in a document.
**Syntax:** `#idname`
**Example:** `#toc` will match the element that has `id="toc"`.
[Attribute selector](attribute_selectors) Selects all elements that have the given attribute.
**Syntax:** `[attr]` `[attr=value]` `[attr~=value]` `[attr|=value]` `[attr^=value]` `[attr$=value]` `[attr*=value]`
**Example:** `[autoplay]` will match all elements that have the `autoplay` attribute set (to any value).
Grouping selectors
------------------
[Selector list](selector_list) The `,` selector is a grouping method that selects all the matching nodes.
**Syntax:** `A, B`
**Example:** `div, span` will match both [`<span>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span) and [`<div>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div) elements.
Combinators
-----------
[Descendant combinator](descendant_combinator) The " " (space) combinator selects nodes that are descendants of the first element.
**Syntax:** `A B`
**Example:** `div span` will match all [`<span>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span) elements that are inside a [`<div>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div) element.
[Child combinator](child_combinator) The `>` combinator selects nodes that are direct children of the first element.
**Syntax:** `A > B`
**Example:** `ul > li` will match all [`<li>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li) elements that are nested directly inside a [`<ul>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul) element.
[General sibling combinator](general_sibling_combinator) The `~` combinator selects siblings. This means that the second element follows the first (though not necessarily immediately), and both share the same parent.
**Syntax:** `A ~ B`
**Example:** `p ~ span` will match all [`<span>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span) elements that follow a [`<p>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p), immediately or not.
[Adjacent sibling combinator](adjacent_sibling_combinator) The `+` combinator matches the second element only if it *immediately* follows the first element.
**Syntax:** `A + B`
**Example:** `h2 + p` will match the first [`<p>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p) element that *immediately* follows an [`<h2>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements) element.
[Column combinator](column_combinator) Experimental
The `||` combinator selects nodes which belong to a column.
**Syntax:** `A || B`
**Example:** `col || td` will match all [`<td>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td) elements that belong to the scope of the [`<col>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col).
Pseudo-classes and pseudo-elements
----------------------------------
[Pseudo classes](pseudo-classes) The `:` pseudo allow the selection of elements based on state information that is not contained in the document tree.
**Example:** `a:visited` will match all [`<a>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) elements that have been visited by the user.
[Pseudo elements](pseudo-elements) The `::` pseudo represent entities that are not included in HTML.
**Example:** `p::first-line` will match the first line of all [`<p>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p) elements.
Structure of a selector
-----------------------
The term 'selector' can refer to one of the following:
Simple selector A selector with a single component, such as a single id selector or type selector, that's not used in combination with or contains any other selector component or combinator. A given element is said to match a simple selector when that simple selector accurately describes the element. All [basic selectors](#basic_selectors), attributes, and single [pseudo-classes and pseudo-elements](#pseudo-classes_and_pseudo-elements) are simple selectors.
Compound selector A sequence of [simple selectors](#simple_selector) that are not separated by a [combinator](#combinators). A compound selector represents a set of simultaneous conditions on a single element. A given element is said to match a compound selector when the element matches all the simple selectors in the compound selector.
In a compound selector, the [type selector](type_selectors) or a [universal selector](universal_selectors) in a compound selector must come first in the sequence of selectors. Only one type selector or universal selector is allowed in the sequence. Since whitespace represents the [descendant combinator](descendant_combinator), no whitespace is allowed between the simple selectors in a compound selector.
**Example:** `a#selected {...}`
Complex selector A sequence of one or more simple and/or [compound selectors](#compound_selector) that are separated by [combinators](#combinators). A complex selector represents a set of simultaneous conditions on a set of elements. These conditions apply in the context of relationships described by the combinators. A given element is said to match a complex selector when the element matches compound selectors and the combinators between the compound selectors.
**Examples:** `a#selected > .icon {...}`, `.box h2 + p {...}`, `a .icon {...}`
Relative selector A selector that represents an element relative to one or more [anchor elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) preceded by a combinator. Relative selectors that don't begin with an explicit [combinator](#combinators) have an implied [descendant combinator](descendant_combinator).
**Examples:** `+ div#topic > #reference {...}`, `> .icon {...}`
[Selector list](selector_list) A comma-separated list of [simple](#simple_selector), [compound](#compound_selector), or [complex](#complex_selector) selectors. If the constituent selector type of a selector list is important but unspecified, it is called a *complex selector list*. A given element is said to match a selector list when the element matches any (at least one) of the selectors in that selector list. Read more about when a selector list is deemed [invalid](selector_list#invalid_selector_list) and how to construct a [forgiving selector list](selector_list#forgiving_selector_list).
**Example:** `#main, article.heading {...}`
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4](https://drafts.csswg.org/selectors/) |
See the [pseudo-class](pseudo-classes#specifications) and [pseudo-element](pseudo-elements#specifications) specification tables for details on those.
See also
--------
* [`:has()` pseudo class](:has)
* [CSS Specificity](specificity)
* [Selector list](selector_list)
| programming_docs |
css counter-reset counter-reset
=============
The `counter-reset` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property resets a [CSS counter](css_counter_styles/using_css_counters) to a given value. This property will create a new counter or reversed counter with the given name on the specified element.
Normal counters have a default initial value of 0. Reversed counters are intended to count down, and have a default initial value set to the number of elements at the current level. The default initial values make it easy to implement the two most common numbering patterns: counting up from one to the number of elements, and counting down from the number of elements to one.
A counter's value is increased or decreased using the [`counter-increment`](counter-increment) CSS property, and the value of an existing counter may be set using [`counter-set`](counter-set).
Try it
------
In addition to author-created counters, the property can also reset the `list-item` counters used by ordered lists (as created using [`<ol>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol) elements). These have the same behavior as author-created counters, except they are *automatically* incremented/decremented by one with each list element. This behavior can be overridden using [`counter-increment`](counter-increment).
Syntax
------
```
/\* Set "my-counter" to 0 \*/
counter-reset: my-counter;
/\* Set "my-counter" to -3 \*/
counter-reset: my-counter -3;
/\* Set reversed "my-counter" to "the number of peer elements" \*/
counter-reset: reversed(my-counter);
/\* Set reversed "my-counter" to -1 \*/
counter-reset: reversed(my-counter) -1;
/\* Set counter2 to 9 and reversed "counter1" and "counter3" to 1 and 4, respectively\*/
counter-reset: reversed(counter1) 1 counter2 9 reversed(counter3) 4;
/\* Cancel any reset that could have been set in less specific rules \*/
counter-reset: none;
/\* Global values \*/
counter-reset: inherit;
counter-reset: initial;
counter-reset: revert;
counter-reset: revert-layer;
counter-reset: unset;
```
The `counter-reset` property is specified as either one of the following:
* A `<custom-ident>` or a `reversed(<custom-ident>)` naming the counter, followed optionally by an `<integer>`. Note that the `reversed()` method is used to create a "reversed" counter. You may specify as many counters and reversed counters to reset as you want, with each counter or counter-number pair separated by a space.
* The keyword value `none`.
The "implicit" counter named `list-item` can be used to control the numbering for ordered lists, as created using [`<ol>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol)
### Values
[`<custom-ident>`](custom-ident) The name of the counter to reset.
[`<integer>`](integer) The value to reset the counter to on each occurrence of the element. Defaults to `0` if not specified.
`none` No counter reset is to be performed. This can be used to override a `counter-reset` defined in a less specific rule.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
counter-reset =
[[](value_definition_syntax#brackets) [<counter-name>](counter-name) [<integer>](integer)[?](value_definition_syntax#question_mark) [|](value_definition_syntax#single_bar) <reversed-counter-name> [<integer>](integer)[?](value_definition_syntax#question_mark) []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) [|](value_definition_syntax#single_bar)
none
<reversed-counter-name> =
reversed( [<counter-name>](counter-name) )
```
Examples
--------
The following examples show how to reset the counters, but not how they are incremented, decremented, and displayed.
For more-complete examples see [Using CSS Counters](css_counter_styles/using_css_counters).
### Resetting named counters
```
h1 {
counter-reset: chapter section 1 page;
/\* Sets the chapter and page counters to 0,
and the section counter to 1 \*/
}
```
### Reversing a counter
```
h1 {
counter-reset: reversed(chapter) reversed(section) 1 page;
/\* Sets the reversed flag on the chapter and section counters.
Sets the chapter to the number of elements, the section counter to 1,
and the page counters to 0\*/
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Lists and Counters Module Level 3 # counter-reset](https://w3c.github.io/csswg-drafts/css-lists/#counter-reset) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `counter-reset` | 2 | 12 | 1 | 8 | 9.2 | 3 | 4.4 | 18 | 25 | 10.1 | 1 | 1.0 |
| `reset_does_not_affect_siblings` | No | No | 82 | No | No | No | No | No | 82 | No | No | No |
| `reversed` | No | No | 96 | No | No | No | No | No | 96 | No | No | No |
See also
--------
* [Using CSS Counters](css_counter_styles/using_css_counters)
* [`counter-increment`](counter-increment)
* [`counter-set`](counter-set)
* [`@counter-style`](@counter-style)
* [`counter()`](counter) and [`counters()`](counters) functions
* [`content`](content) property
css CSS Box Alignment CSS Box Alignment
=================
The CSS Box Alignment module specifies CSS features that relate to the alignment of boxes in the various CSS box layout models: block layout, table layout, flex layout, and grid layout. The module aims to create a consistent method of alignment across all of CSS. This document details the general concepts found in the specification.
**Note:** The documentation for each layout method will detail how Box Alignment is applied there.
Older alignment methods
-----------------------
CSS traditionally had very limited alignment capabilities. We were able to align text using [`text-align`](text-align), center blocks using auto [`margin`](margin)s, and in table or inline-block layouts using the [`vertical-align`](vertical-align) property. Alignment of text is now covered by the [Inline Layout](https://www.w3.org/TR/css-inline-3/) and [CSS Text](https://www.w3.org/TR/css-text-3/) modules, and for the first time in Box Alignment we have full horizontal and vertical alignment capabilities.
If you initially learned [Flexbox](css_flexible_box_layout) then you may consider these properties to be part of the Flexbox specification, and some of the properties are indeed listed in Level 1 of Flexbox. However the specification notes that the Box Alignment specification should be referred to as it may add additional capabilities over what is currently in Flexbox.
Basic examples
--------------
The following examples demonstrate how some of the Box Alignment Properties are applied in [Grid](css_grid_layout) and [Flexbox](css_flexible_box_layout).
### CSS grid layout alignment example
In this example using Grid Layout, there is extra space in the grid container after laying out the fixed width tracks on the inline (main) axis. This space is distributed using [`justify-content`](justify-content). On the block (cross) axis the alignment of the items inside their grid areas is controlled with [`align-items`](align-items). The first item overrides the `align-items` value set on the group by setting [`align-self`](align-self) to `center`.
### Flexbox Alignment Example
In this example, three flex items are aligned on the main axis using `justify-content` and on the Cross Axis using `align-items`. The first item overrides the `align-items` set on the group by setting `align-self` to `center`.
Key concepts and terminology
----------------------------
The specification details some alignment terminology to make it easier to discuss these alignment properties outside of their implementation within a particular layout method. There are also some key concepts which are common to all layout methods.
### Relationship to writing modes
Alignment is linked to writing modes in that when we align an item we do not consider whether we are aligning it to the physical dimensions of top, right, bottom and left. Instead we describe alignment in terms of the start and end of the particular dimension we are working with. This ensures that alignment works in the same way whichever writing mode the document has.
### Two dimensions of alignment
When using the box alignment properties you will align content on one of two axes — the inline (or main) axis, and the block (or cross) axis. The inline axis is the axis along which words in a sentence flow in the writing mode being used — for English, for example, the inline axis is horizontal. The block axis is the axis along which blocks, such as paragraph elements, are laid out and it runs across the Inline axis.
When aligning items on the inline axis you will use the properties which begin with `justify-`:
* [`justify-items`](justify-items)
* [`justify-self`](justify-self)
* [`justify-content`](justify-content)
When aligning items on the block axis you will use the properties that begin `align-`:
* [`align-items`](align-items)
* [`align-self`](align-self)
* [`align-content`](align-content)
Flexbox adds an additional complication in that the above is true when [`flex-direction`](flex-direction) is set to `row`. The properties are swapped when flexbox is set to `column`. Therefore, when working with flexbox it is easier to think about the main and cross axis rather than inline and block. The `justify-` properties are always used to align on the main axis, the `align-` properties on the cross axis.
### The alignment subject
The **alignment subject** is the thing that is being aligned. For `justify-self` or `align-self`, or when setting these values as a group with `justify-items` or `align-items`, this will be the margin box of the element that this property is being used on. The `justify-content` and `align-content` properties differ per layout method.
### The alignment container
The **alignment container** is the box the subject is being aligned inside. This will typically be the alignment subject's containing block. An alignment container may contain one or many alignment subjects.
The below image shows an alignment container with two alignment subjects inside.
### Fallback alignment
If you set an alignment that cannot be fulfilled, then the **fallback alignment** will come into play and deal with the available space. This fallback alignment is specified individually for each layout method and detailed on the page for that method.
Types of alignment
------------------
There are three different types of alignment that the specification details; these use keyword values.
* **Positional alignment**: specifying the position of an alignment subject with relation to its alignment container.
* **Baseline alignment**: These keywords define alignment as a relationship among the baselines of multiple alignment subjects within an alignment context.
* **Distributed alignment**: These keywords define alignment as a distribution of space among alignment subjects.
### Positional alignment keyword values
The following values are defined for positional alignment, and can be used as values for content alignment with `justify-content` and `align-content` and also for self alignment with `justify-self` and `align-self`.
* `center`
* `start`
* `end`
* `self-start`
* `self-end`
* `flex-start` for Flexbox only
* `flex-end` for Flexbox only
* `left`
* `right`
Other than the physical values of `left` and `right`, which relate to physical attributes of the screen, all of the other values are logical values and relate to the writing mode of the content.
For example, when working in CSS Grid Layout, if you are working in English and set `justify-content` to `start` this will move the items in the inline dimension to the start, which will be the left as sentences in English start on the left. If you were using Arabic, a right to left language, then the same value of `start` would result in the items moving to the right, as sentences in Arabic start on the right-hand side of the page.
Both of these examples have `justify-content: start`, however the location of start changes according to the writing mode.
### Baseline alignment
The Baseline alignment keywords are used to align the baselines of boxes across a group of alignment subjects. They can be used as values for content alignment with `justify-content` and `align-content` and also for self alignment with `justify-self` and `align-self`.
* `baseline`
* `first baseline`
* `last baseline`
Baseline content alignment — specifying a baseline alignment value for `justify-content` or `align-content` — works in layout methods that lay items out in rows. The alignment subjects are baseline aligned against each other by adding padding inside the boxes.
Baseline self alignment shifts the boxes to align by baseline by adding a margin outside the boxes. Self alignment is when using `justify-self` or `align-self`, or when setting these values as a group with `justify-items` and `align-items`.
### Distributed alignment
The **distributed alignment keywords** are used with the `align-content` and `justify-content` properties. These keywords define what happens to any additional space after alignment subjects have been displayed. The values are as follows:
* `stretch`
* `space-between`
* `space-around`
* `space-evenly`
For example, in Flex Layout items are aligned with `flex-start` initially. Working in a horizontal top to bottom writing mode such as English, with `flex-direction` as `row` the items start on the far left and any available space after displaying the items is placed after the items.
If you set `justify-content: space-between` on the flex container, the available space is now shared out and placed between the items.
There needs to be space available in the dimension you wish to align the items in, in order for these keywords to take effect. With no space, there is nothing to distribute.
Overflow alignment
------------------
The `safe` and `unsafe` keywords help define behavior when an alignment subject is larger than the alignment container. The `safe` keyword will align to `start` in the case of a specified alignment causing an overflow, the aim being to avoid "data loss" where part of the item is outside of the boundaries of the alignment container and can't be scrolled to.
If you specify `unsafe` then the alignment will be honoured even if it would cause such data loss.
Gaps between boxes
------------------
The box alignment specification also includes the `gap`, `row-gap`, and `column-gap` properties. These properties enable the setting of a consistent gap between items in a row or column, in any layout method which has items arranged in this way.
The `gap` property is a shorthand for `row-gap` and `column-gap`, which allows us to set these properties at once:
* [`row-gap`](row-gap)
* [`column-gap`](column-gap)
* [`gap`](gap)
In the below example, a grid layout uses the `gap` shorthand to set a `10px` gap between row tracks, and a `2em` gap between column tracks.
**Note:** The early grid implementation included `-gap` properties prefixed with `grid-`. All browsers now support the unprefixed properties, though you may see the following legacy properties in examples and tutorials: [`grid-row-gap`](row-gap), [`grid-column-gap`](column-gap), and [`grid-gap`](gap). The prefixed versions will be maintained as an alias of the unprefixed ones.
Be aware that other things may increase the visual gap displayed, for example using the space distribution keywords or adding margins to items.
Pages detailing individual alignment properties
-----------------------------------------------
As the CSS box alignment properties are implemented differently depending on the specification they interact with, refer to the following pages for each layout type for details of how to use the alignment properties with it:
* [Box alignment in Flexbox](css_box_alignment/box_alignment_in_flexbox)
* [Box alignment in CSS Grid Layout](css_box_alignment/box_alignment_in_grid_layout)
* [Box alignment in multiple-column layout](css_box_alignment/box_alignment_in_multi-column_layout)
* [Box alignment for block, absolutely positioned and table layout](css_box_alignment/box_alignment_in_block_abspos_tables)
Reference
---------
### CSS Properties
* [`justify-content`](justify-content)
* [`align-content`](align-content)
* [`place-content`](place-content)
* [`justify-items`](justify-items)
* [`align-items`](align-items)
* [`place-items`](place-items)
* [`justify-self`](justify-self)
* [`align-self`](align-self)
* [`place-self`](place-self)
* [`row-gap`](row-gap)
* [`column-gap`](column-gap)
* [`gap`](gap)
### Glossary Entries
* [Cross axis](https://developer.mozilla.org/en-US/docs/Glossary/Cross_Axis)
* [Main axis](https://developer.mozilla.org/en-US/docs/Glossary/Main_Axis)
* [Alignment container](https://developer.mozilla.org/en-US/docs/Glossary/Alignment_Container)
* [Alignment subject](https://developer.mozilla.org/en-US/docs/Glossary/Alignment_Subject)
* [Fallback alignment](https://developer.mozilla.org/en-US/docs/Glossary/Fallback_Alignment)
Guides
------
* CSS Flexbox guide: *[Basic concepts of Flexbox](css_flexible_box_layout/basic_concepts_of_flexbox)*
* CSS Flexbox guide: *[Aligning items in a flex container](css_flexible_box_layout/aligning_items_in_a_flex_container)*
* CSS Grid guide: *[Box alignment in CSS Grid layouts](css_grid_layout/box_alignment_in_css_grid_layout)*
External Resources
------------------
* [Box alignment cheatsheet](https://rachelandrew.co.uk/css/cheatsheets/box-alignment)
* [CSS Grid, Flexbox and Box alignment](https://www.smashingmagazine.com/2016/11/css-grids-flexbox-box-alignment-new-layout-standard/)
* [Thoughts on partial implementations of Box alignment](https://blogs.igalia.com/jfernandez/2017/05/03/can-i-use-css-box-alignment/)
css ruby-align ruby-align
==========
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `ruby-align` CSS property defines the distribution of the different ruby elements over the base.
```
/\* Keyword values \*/
ruby-align: start;
ruby-align: center;
ruby-align: space-between;
ruby-align: space-around;
/\* Global values \*/
ruby-align: inherit;
ruby-align: initial;
ruby-align: revert;
ruby-align: revert-layer;
ruby-align: unset;
```
Syntax
------
### Values
`start` Is a keyword indicating that the ruby will be aligned with the start of the base text.
`center` Is a keyword indicating that the ruby will be aligned at the middle of the base text.
`space-between` Is a keyword indicating that the extra space will be distributed between the elements of the ruby.
`space-around` Is a keyword indicating that the extra space will be distributed between the elements of the ruby, and around it.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `space-around` |
| Applies to | ruby bases, ruby annotations, ruby base containers, ruby annotation containers |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
ruby-align =
start [|](value_definition_syntax#single_bar)
center [|](value_definition_syntax#single_bar)
space-between [|](value_definition_syntax#single_bar)
space-around
```
Examples
--------
### Ruby aligned at the start of the base text
#### HTML
```
<ruby>
<rb>This is a long text to check</rb>
<rp>(</rp><rt>short ruby</rt><rp>)</rp>
</ruby>
```
#### CSS
```
ruby {
ruby-align: start;
}
```
#### Result
### Ruby aligned at the center of the base text
#### HTML
```
<ruby>
<rb>This is a long text to check</rb>
<rp>(</rp><rt>short ruby</rt><rp>)</rp>
</ruby>
```
#### CSS
```
ruby {
ruby-align: center;
}
```
#### Result
### Extra space distributed between ruby elements
#### HTML
```
<ruby>
<rb>This is a long text to check</rb>
<rp>(</rp><rt>short ruby</rt><rp>)</rp>
</ruby>
```
#### CSS
```
ruby {
ruby-align: space-between;
}
```
#### Result
### Extra space distributed between and around ruby elements
#### HTML
```
<ruby>
<rb>This is a long text to check</rb>
<rp>(</rp><rt>short ruby</rt><rp>)</rp>
</ruby>
```
#### CSS
```
ruby {
ruby-align: space-around;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Ruby Annotation Layout Module Level 1 # ruby-align-property](https://w3c.github.io/csswg-drafts/css-ruby/#ruby-align-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `ruby-align` | No | No | 38 | No
Internet Explorer 9 and later supports an earlier draft of CSS Ruby with non-standard values for this property: `auto`, `left`, `center`, `right`, `distribute-letter`, `distribute-space`, and `line-edge`. | No | No | No | No | 38 | No | No | No |
See also
--------
* HTML Ruby elements: [`<ruby>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ruby), [`<rt>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rt), [`<rp>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rp), and [`<rtc>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rtc).
* CSS Ruby properties: [`ruby-position`](ruby-position), `ruby-merge`.
| programming_docs |
css :valid :valid
======
The `:valid` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) represents any [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) or other [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) element whose contents [validate](https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation) successfully. This allows to easily make valid fields adopt an appearance that helps the user confirm that their data is formatted properly.
Try it
------
This pseudo-class is useful for highlighting correct fields for the user.
Syntax
------
```
:valid
```
Examples
--------
### Indicating valid and invalid form fields
In this example, we use structures like this, which include extra `<span>`s to generate content on; we'll use these to provide indicators of valid/invalid data:
```
<div>
<label for="fname">First name *: </label>
<input id="fname" name="fname" type="text" required />
<span></span>
</div>
```
To provide these indicators, we use the following CSS:
```
input + span {
position: relative;
}
input + span::before {
position: absolute;
right: -20px;
top: 5px;
}
input:invalid {
border: 2px solid red;
}
input:invalid + span::before {
content: "✖";
color: red;
}
input:valid + span::before {
content: "✓";
color: green;
}
```
We set the `<span>`s to `position: relative` so that we can position the generated content relative to them. We then absolutely position different generated content depending on whether the form's data is valid or invalid — a green check or a red cross, respectively. To add a bit of extra urgency to the invalid data, we've also given the inputs a thick red border when invalid.
**Note:** We've used `::before` to add these labels, as we were already using `::after` for the "required" labels.
You can try it below:
Notice how the required text inputs are invalid when empty, but valid when they have something filled in. The email input on the other hand is valid when empty, as it is not required, but invalid when it contains something that is not a proper email address.
Accessibility concerns
----------------------
The color green is commonly used to indicate valid input. People who have certain types of color blindness will be unable to determine the input's state unless it is accompanied by an additional indicator that does not rely on color to convey meaning. Typically, descriptive text and/or an icon are used.
* [MDN Understanding WCAG, Guideline 1.4 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background)
* [Understanding Success Criterion 1.4.1 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-without-color.html)
Specifications
--------------
| Specification |
| --- |
| [HTML Standard # selector-valid](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-valid) |
| [Selectors Level 4 # validity-pseudos](https://w3c.github.io/csswg-drafts/selectors/#validity-pseudos) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:valid` | 10 | 12 | 4 | 10 | 10 | 5 | 37 | 18 | 4 | 10.1 | 5 | 1.0 |
| `form` | 40 | 79 | 13 | No | 27 | 9 | 40 | 40 | 14 | 27 | 9 | 4.0 |
See also
--------
* Other validation-related pseudo-classes: [`:required`](:required), [`:optional`](:optional), [`:invalid`](:invalid)
* [Form data validation](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation)
* Accessing the [validity state](https://developer.mozilla.org/en-US/docs/Web/API/ValidityState) from JavaScript
css ::file-selector-button ::file-selector-button
======================
The `::file-selector-button` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-element](pseudo-elements) represents the button of an [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) of [`type="file"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file).
Try it
------
Syntax
------
```
selector::file-selector-button
```
Examples
--------
### Basic example
#### HTML
```
<form>
<label for="fileUpload">Upload file</label>
<input type="file" id="fileUpload" />
</form>
```
#### CSS
```
input[type="file"]::file-selector-button {
border: 2px solid #6c5ce7;
padding: 0.2em 0.4em;
border-radius: 0.2em;
background-color: #a29bfe;
transition: 1s;
}
input[type="file"]::file-selector-button:hover {
background-color: #81ecec;
border: 2px solid #00cec9;
}
```
#### Result
Note that `::file-selector-button` is a whole element, and as such matches the rules from the UA stylesheet. In particular, fonts and colors won't necessarily inherit from the `input` element.
### Fallback example
#### HTML
```
<form>
<label for="fileUpload">Upload file</label>
<input type="file" id="fileUpload" />
</form>
```
#### CSS
```
input[type="file"]::file-selector-button {
border: 2px solid #6c5ce7;
padding: 0.2em 0.4em;
border-radius: 0.2em;
background-color: #a29bfe;
transition: 1s;
}
input[type="file"]::-ms-browse:hover {
background-color: #81ecec;
border: 2px solid #00cec9;
}
input[type="file"]::-webkit-file-upload-button:hover {
background-color: #81ecec;
border: 2px solid #00cec9;
}
input[type="file"]::file-selector-button:hover {
background-color: #81ecec;
border: 2px solid #00cec9;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Pseudo-Elements Module Level 4 # file-selector-button-pseudo](https://w3c.github.io/csswg-drafts/css-pseudo/#file-selector-button-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `::file-selector-button` | 89
1 | 89
79
12-79 | 82 | 10 | 75
15 | 14.1
3 | 89
4.4 | 89
18 | 82 | 63
14 | 14.5
1 | 15.0
1.0 |
See also
--------
* [WebKit CSS extensions](https://developer.mozilla.org/en-US/docs/Web/CSS/WebKit_Extensions)
* [Microsoft CSS extensions](https://developer.mozilla.org/en-US/docs/Web/CSS/Microsoft_Extensions)
* [File and Directory Entries API](https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API)
* [File and Directory Entries API support in Firefox](https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API/Firefox_support)
* [`<input type="file">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file)
css order order
=====
The `order` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the order to lay out an item in a flex or grid container. Items in a container are sorted by ascending `order` value and then by their source code order.
Try it
------
Syntax
------
```
/\* <integer> values \*/
order: 5;
order: -5;
/\* Global values \*/
order: inherit;
order: initial;
order: revert;
order: revert-layer;
order: unset;
```
Since `order` is only meant to affect the *visual order* of elements and not their logical or tab order. `order` must not be used on non-visual media such as [speech](@media#speech).
### Values
[`<integer>`](integer) Represents the ordinal group to be used by the item.
Accessibility concerns
----------------------
Using the `order` property will create a disconnect between the visual presentation of content and DOM order. This will adversely affect users experiencing low vision navigating with the aid of assistive technology such as a screen reader. If the visual (css) order is important, then screen reader users will not have access to the correct reading order.
* [Flexbox & the keyboard navigation disconnect — Tink](https://tink.uk/flexbox-the-keyboard-navigation-disconnect/)
* [Source Order Matters | Adrian Roselli](https://adrianroselli.com/2015/09/source-order-matters.html)
* [MDN Understanding WCAG, Guideline 1.3 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.3_%e2%80%94_create_content_that_can_be_presented_in_different_ways)
* [Understanding Success Criterion 1.3.2 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/content-structure-separation-sequence.html)
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | Flex items, grid items, and absolutely-positioned flex and grid container children |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | an [integer](integer#interpolation) |
Formal syntax
-------------
```
order =
[<integer>](integer)
```
Examples
--------
### Ordering items in a flex container
This example uses CSS to create a classic two-sidebar layout surrounding a content block. The Flexible Box Layout Module automatically creates blocks of equal vertical size and uses as much horizontal space as available.
#### HTML
```
<header>…</header>
<main>
<article>Article</article>
<nav>Nav</nav>
<aside>Aside</aside>
</main>
<footer>…</footer>
```
#### CSS
```
main {
display: flex;
text-align: center;
}
main > article {
flex: 1;
order: 2;
}
main > nav {
width: 200px;
order: 1;
}
main > aside {
width: 200px;
order: 3;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Display Module Level 3 # order-property](https://w3c.github.io/csswg-drafts/css-display/#order-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `order` | 29
21 | 12
12 | 49
20
Since Firefox 28, multi-line flexbox is supported. | 11
10 | 12.1 | 9
7 | ≤37
4.4 | 29
25 | 49
20
Since Firefox 28, multi-line flexbox is supported. | 12.1 | 9
7 | 2.0
1.5 |
See also
--------
* CSS Flexbox Guide: *[Basic Concepts of Flexbox](css_flexible_box_layout/basic_concepts_of_flexbox)*
* CSS Flexbox Guide: *[Ordering flex items](css_flexible_box_layout/ordering_flex_items)*
* CSS Grid Guide: *[CSS Grid Layout and accessibility](css_grid_layout/css_grid_layout_and_accessibility)*
css @document @document
=========
**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the [compatibility table](#browser_compatibility) at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The `@document` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) <at-rule> restricts the style rules contained within it based on the URL of the document. It is designed primarily for user-defined style sheets, though it can be used on author-defined style sheets, too.
```
@document url("https://www.example.com/")
{
h1 {
color: green;
}
}
```
Syntax
------
An `@document` rule can specify one or more matching functions. If any of the functions apply to a given URL, the rule will take effect on that URL. The functions available are:
`url()` Matches an exact URL.
`url-prefix()` Matches if the document URL starts with the value provided.
`domain()` Matches if the document URL is on the domain provided (or a subdomain of it).
`media-document()` Matches the media according to the string in parameter, one of `video`, `image`, `plugin` or `all`.
`regexp()` Deprecated Non-standard
Matches if the document URL is matched by the [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) provided. The expression must match the entire URL.
The values provided to the `url()`, `url-prefix()`, `domain()`, and `media-document()` functions can be optionally enclosed by single or double quotes. The values provided to the `regexp()` function *must* be enclosed in quotes.
Escaped values provided to the `regexp()` function must additionally be escaped from the CSS. For example, a `.` (period) matches any character in regular expressions. To match a literal period, you would first need to escape it using regular expression rules (to `\.`), then escape that string using CSS rules (to `\\.`).
`@document` is currently only supported in Firefox; if you wanted to replicate using such functionality in your own non-Firefox browser, you could try using [this polyfill](https://github.com/An-Error94/Handy-Scripts/tree/master/@document-polyfill) by @An-Error94, which uses a combination of a user script, [data-\* attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*), and [attribute selectors](attribute_selectors).
**Note:** There is a -moz-prefixed version of this property — `@-moz-document`. This has been limited to use only in user and UA sheets in Firefox 59 in Nightly and Beta — an experiment designed to mitigate potential CSS injection attacks (See [bug 1035091](https://bugzilla.mozilla.org/show_bug.cgi?id=1035091)).
Formal syntax
-------------
```
@document [ <url> |
url-prefix(<string>) |
domain(<string>) |
media-document(<string>) |
regexp(<string>)
]# {
<group-rule-body>
}
```
Examples
--------
### Specifying document for CSS rule
```
@document url("http://www.w3.org/"),
url-prefix("http://www.w3.org/Style/"),
domain("mozilla.org"),
media-document("video"),
regexp("https:.\*") {
/\* CSS rules here apply to:
- The page "http://www.w3.org/"
- Any page whose URL begins with "http://www.w3.org/Style/"
- Any page whose URL's host is "mozilla.org"
or ends with ".mozilla.org"
- Any standalone video
- Any page whose URL starts with "https:" \*/
/\* Make the above-mentioned pages really ugly \*/
body {
color: purple;
background: yellow;
}
}
```
Specifications
--------------
[Initially](https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document) in Level 3, `@document` was [postponed](https://www.w3.org/TR/2012/WD-css3-conditional-20121213/#changes) to Level 4, but then subsequently removed.
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `@document` | No | No | 61
Only supports an empty `url-prefix()` value, which is supported due to its [use in Firefox browser detection](https://css-tricks.com/snippets/css/css-hacks-targeting-firefox/). Still supported in user stylesheets.
1.5-61 | No | No | No | No | No | 61
Only supports an empty `url-prefix()` value, which is supported due to its [use in Firefox browser detection](https://css-tricks.com/snippets/css/css-hacks-targeting-firefox/). Still supported in user stylesheets.
4-61 | No | No | No |
| `regexp` | No | No | 6-61 | No | No | No | No | No | 6-61 | No | No | No |
See also
--------
* [Per-site user style sheet rules](https://lists.w3.org/Archives/Public/www-style/2004Aug/0135) on the www-style mailing list.
css CSS Paged Media CSS Paged Media
===============
**CSS Paged Media** is a module of CSS that defines how page switches are handled.
Reference
---------
### Properties
* [`page-break-after`](page-break-after)
* [`page-break-before`](page-break-before)
* [`page-break-inside`](page-break-inside)
### At-rules
* [`@page`](@page)
### Pseudo-classes
* [`:blank`](:blank)
* [`:first`](:first)
* [`:left`](:left)
* [`:right`](:right)
Specifications
--------------
| Specification |
| --- |
| [CSS Paged Media Module Level 3](https://drafts.csswg.org/css-page/) |
| [CSS Fragmentation Module Level 3](https://drafts.csswg.org/css-break/) |
css Class selectors Class selectors
===============
The [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) **class selector** matches elements based on the contents of their [`class`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#class) attribute.
```
/\* All elements with class="spacious" \*/
.spacious {
margin: 2em;
}
/\* All <li> elements with class="spacious" \*/
li.spacious {
margin: 2em;
}
/\* All <li> elements with a class list that includes both "spacious" and "elegant" \*/
/\* For example, class="elegant retro spacious" \*/
li.spacious.elegant {
margin: 2em;
}
```
Syntax
------
```
.class\_name { style properties }
```
Note that this is equivalent to the following [`attribute selector`](attribute_selectors):
```
[class~=class\_name] { style properties }
```
Examples
--------
### CSS
```
.red {
color: #f33;
}
.yellow-bg {
background: #ffa;
}
.fancy {
font-weight: bold;
text-shadow: 4px 4px 3px #77f;
}
```
### HTML
```
<p class="red">This paragraph has red text.</p>
<p class="red yellow-bg">
This paragraph has red text and a yellow background.
</p>
<p class="red fancy">This paragraph has red text and "fancy" styling.</p>
<p>This is just a regular paragraph.</p>
```
### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # class-html](https://w3c.github.io/csswg-drafts/selectors/#class-html) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `Class_selectors` | 1 | 12 | 1 | 3 | 3.5 | 1 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
See also
--------
* [CSS Selectors](css_selectors)
* [Learn CSS: Selectors](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors)
css box-sizing box-sizing
==========
The `box-sizing` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets how the total width and height of an element is calculated.
Try it
------
By default in the [CSS box model](css_box_model/introduction_to_the_css_box_model), the `width` and `height` you assign to an element is applied only to the element's content box. If the element has any border or padding, this is then added to the `width` and `height` to arrive at the size of the box that's rendered on the screen. This means that when you set `width` and `height`, you have to adjust the value you give to allow for any border or padding that may be added. For example, if you have four boxes with `width: 25%;`, if any has left or right padding or a left or right border, they will not by default fit on one line within the constraints of the parent container.
The `box-sizing` property can be used to adjust this behavior:
* `content-box` gives you the default CSS box-sizing behavior. If you set an element's width to 100 pixels, then the element's content box will be 100 pixels wide, and the width of any border or padding will be added to the final rendered width, making the element wider than 100px.
* `border-box` tells the browser to account for any border and padding in the values you specify for an element's width and height. If you set an element's width to 100 pixels, that 100 pixels will include any border or padding you added, and the content box will shrink to absorb that extra width. This typically makes it much easier to size elements. `box-sizing: border-box` is the default styling that browsers use for the [`<table>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table), [`<select>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select), and [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button) elements, and for [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) elements whose type is `[radio](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio)`, `[checkbox](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox)`, `[reset](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/reset)`, `[button](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/button)`, `[submit](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/submit)`, `[color](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color)`, or `[search](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/search)`.
**Note:** It is often useful to set `box-sizing` to `border-box` to lay out elements. This makes dealing with the sizes of elements much easier, and generally eliminates a number of pitfalls you can stumble on while laying out your content. On the other hand, when using `position: relative` or `position: absolute`, use of `box-sizing: content-box` allows the positioning values to be relative to the content, and independent of changes to border and padding sizes, which is sometimes desirable.
Syntax
------
```
box-sizing: border-box;
box-sizing: content-box;
/\* Global values \*/
box-sizing: inherit;
box-sizing: initial;
box-sizing: revert;
box-sizing: revert-layer;
box-sizing: unset;
```
The `box-sizing` property is specified as a single keyword chosen from the list of values below.
### Values
`content-box` This is the initial and default value as specified by the CSS standard. The [`width`](width) and [`height`](height) properties include the content, but does not include the padding, border, or margin. For example, `.box {width: 350px; border: 10px solid black;}` renders a box that is 370px wide.
Here, the dimensions of the element are calculated as: *width = width of the content*, and *height = height of the content*. (Borders and padding are not included in the calculation.)
`border-box` The [`width`](width) and [`height`](height) properties include the content, padding, and border, but do not include the margin. Note that padding and border will be inside of the box. For example, `.box {width: 350px; border: 10px solid black;}` renders a box that is 350px wide, with the area for content being 330px wide. The content box can't be negative and is floored to 0, making it impossible to use `border-box` to make the element disappear.
Here the dimensions of the element are calculated as: *width = border + padding + width of the content*, and *height = border + padding + height of the content*.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `content-box` |
| Applies to | all elements that accept width or height |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
box-sizing =
content-box [|](value_definition_syntax#single_bar)
border-box
```
Examples
--------
### Box sizes with content-box and border-box
This example shows how different `box-sizing` values alter the rendered size of two otherwise identical elements.
#### HTML
```
<div class="content-box">Content box</div>
<br />
<div class="border-box">Border box</div>
```
#### CSS
```
div {
width: 160px;
height: 80px;
padding: 20px;
border: 8px solid red;
background: yellow;
}
.content-box {
box-sizing: content-box;
/\* Total width: 160px + (2 \* 20px) + (2 \* 8px) = 216px
Total height: 80px + (2 \* 20px) + (2 \* 8px) = 136px
Content box width: 160px
Content box height: 80px \*/
}
.border-box {
box-sizing: border-box;
/\* Total width: 160px
Total height: 80px
Content box width: 160px - (2 \* 20px) - (2 \* 8px) = 104px
Content box height: 80px - (2 \* 20px) - (2 \* 8px) = 24px \*/
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Box Sizing Module Level 3 # box-sizing](https://w3c.github.io/csswg-drafts/css-sizing/#box-sizing) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `box-sizing` | 10
`box-sizing` is not respected when the height is calculated from [`window.getComputedStyle()`](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle).
1 | 12
12 | 49
29
1
Before Firefox 23, `box-sizing` is not respected when the height is calculated from [`window.getComputedStyle()`](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle). | 8
`box-sizing` is not respected when the height is calculated from [`window.getComputedStyle()`](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle). | 7 | 5.1
3 | 4
`box-sizing` is not respected when the height is calculated from [`window.getComputedStyle()`](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle).
2 | 18
`box-sizing` is not respected when the height is calculated from [`window.getComputedStyle()`](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle).
18 | 49
29
4
Before Firefox 23, `box-sizing` is not respected when the height is calculated from [`window.getComputedStyle()`](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle). | 14
`box-sizing` is not respected when the height is calculated from [`window.getComputedStyle()`](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle).
14 | 6
1 | 1.0
`box-sizing` is not respected when the height is calculated from [`window.getComputedStyle()`](https://developer.mozilla.org/docs/Web/API/Window/getComputedStyle).
1.0 |
| `padding-box` | No | No | 1-50 | No | No | No | No | No | 4-50 | No | No | No |
See also
--------
* [CSS box model](css_box_model/introduction_to_the_css_box_model)
| programming_docs |
css unset unset
=====
The `unset` CSS keyword resets a property to its inherited value if the property naturally inherits from its parent, and to its [initial value](initial_value) if not. In other words, it behaves like the [`inherit`](inherit) keyword in the first case, when the property is an [inherited property](inheritance#inherited_properties), and like the [`initial`](initial) keyword in the second case, when the property is a [non-inherited property](inheritance#non-inherited_properties).
`unset` can be applied to any CSS property, including the CSS shorthand property [`all`](all).
Examples
--------
### Color
[`color`](color#formal_definition) is an inherited property.
#### HTML
```
<p>This text is red.</p>
<div class="foo">
<p>This text is also red.</p>
</div>
<div class="bar">
<p>This text is green (default inherited value).</p>
</div>
```
#### CSS
```
.foo {
color: blue;
}
.bar {
color: green;
}
p {
color: red;
}
.bar p {
color: unset;
}
```
#### Result
### Border
[`border`](border#formal_definition) is a non-inherited property.
#### HTML
```
<p>This text has a red border.</p>
<div>
<p>This text has a red border.</p>
</div>
<div class="bar">
<p>This text has a black border (initial default, not inherited).</p>
</div>
```
#### CSS
```
div {
border: 1px solid green;
}
p {
border: 1px solid red;
}
.bar p {
border-color: unset;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Cascading and Inheritance Level 4 # inherit-initial](https://w3c.github.io/csswg-drafts/css-cascade/#inherit-initial) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `unset` | 41 | 13 | 27 | No | 28 | 9.1 | 41 | 41 | 27 | 28 | 9.3 | 4.0 |
See also
--------
* Use the [`initial`](initial) keyword to set a property to its initial value.
* Use the [`inherit`](inherit) keyword to make an element's property the same as its parent.
* Use the [`revert`](revert) keyword to reset a property to the value established by the user-agent stylesheet (or by user styles, if any exist).
* Use the [`revert-layer`](revert-layer) keyword to reset a property to the value established in a previous cascade layer.
* The [`all`](all) property lets you reset all properties to their initial, inherited, reverted, or unset state at once.
css appearance appearance
==========
The `appearance` CSS property is used to control native appearance of UI controls, that are based on operating system's theme.
Try it
------
Before standardization this property allowed simple elements to be shown as widgets, such as buttons or check boxes. It was considered a misfeature and authors are encouraged to use only standard keywords now.
**Note:** If you wish to use this property on websites, you should test it very carefully. Although it is supported in most modern browsers, its implementation varies. In older browsers, even the keyword `none` does not have the same effect on all form elements across different browsers, and some do not support it at all. The differences are smaller in the newest browsers.
Syntax
------
```
/\* CSS Basic User Interface Module Level 4 values \*/
appearance: none;
appearance: auto;
appearance: menulist-button;
appearance: textfield;
/\* "Compat-auto" values, which have the same effect as 'auto' \*/
appearance: button;
appearance: searchfield;
appearance: textarea;
appearance: push-button;
appearance: slider-horizontal;
appearance: checkbox;
appearance: radio;
appearance: square-button;
appearance: menulist;
appearance: listbox;
appearance: meter;
appearance: progress-bar;
/\* Partial list of available values in Gecko \*/
-moz-appearance: scrollbarbutton-up;
-moz-appearance: button-bevel;
/\* Partial list of available values in WebKit/Blink (as well as Gecko and Edge) \*/
-webkit-appearance: media-mute-button;
-webkit-appearance: caret;
/\* Global values \*/
appearance: inherit;
appearance: initial;
appearance: revert;
appearance: revert-layer;
appearance: unset;
```
### Values
#### Standard keywords
| Value | Browser | Description |
| --- | --- | --- |
| `none` | Firefox Chrome Safari Edge | Hides certain features of widgets, such as arrow displayed in select element, indicating that list can be expanded. |
| `auto` | Firefox Chrome Edge | The user agent selects the appropriate special styling based on the element. Acts as `none` on elements with no special styling. |
| `menulist-button` | Firefox Chrome Safari Edge | |
| `textfield` | Firefox Chrome Safari Edge | |
| The following values are treated as equivalent to `auto`: |
| `button` | Firefox Chrome Safari Edge | The element used to be drawn like a button. |
| `checkbox` | Firefox Chrome Safari Edge | The element used to be drawn like a checkbox, including only the actual "checkbox" portion. |
| `listbox` | Firefox Chrome Safari Edge | |
| `menulist` | Firefox Chrome Safari Edge | |
| `meter` | Chrome Safari Firefox | |
| `progress-bar` | Chrome Safari Firefox | |
| `push-button` | Chrome Safari Edge | |
| `radio` | Firefox Chrome Safari Edge | The element used to be drawn like a radio button, including only the actual "radio button" portion. |
| `searchfield` | Firefox Chrome Safari Edge | |
| `slider-horizontal` | Chrome Safari Edge | |
| `square-button` | Chrome Safari Edge | |
| `textarea` | Firefox Chrome Safari Edge | |
#### Non-standard keywords
The following values may be operational on historical browser versions using `-moz-appearance` or `-webkit-appearance` prefix, but not on the standard `appearance` property.
| Value | Browser | Description |
| --- | --- | --- |
| `attachment` | Safari | |
| `borderless-attachment` | Safari | |
| `button-bevel` | Firefox Chrome Safari Edge | |
| `caps-lock-indicator` | Safari Edge | |
| `caret` | Firefox Chrome Safari Edge | |
| `checkbox-container` | Firefox | The element is drawn like a container for a checkbox, which may include a prelighting background effect under certain platforms. Normally it would contain a label and a checkbox. |
| `checkbox-label` | Firefox | |
| `checkmenuitem` | Firefox | |
| `color-well` | Safari | `input type=color` |
| `continuous-capacity-level-indicator` | Safari | |
| `default-button` | Safari Edge | |
| `discrete-capacity-level-indicator` | Safari | |
| `inner-spin-button` | Firefox Chrome Safari | |
| `image-controls-button` | Safari | |
| `list-button` | Safari | datalist |
| `listitem` | Firefox Chrome Safari Edge | |
| `media-enter-fullscreen-button` | Chrome Safari | |
| `media-exit-fullscreen-button` | Chrome Safari | |
| `media-fullscreen-volume-slider` | Safari | |
| `media-fullscreen-volume-slider-thumb` | Safari | |
| `media-mute-button` | Chrome Safari Edge | |
| `media-play-button` | Chrome Safari Edge | |
| `media-overlay-play-button` | Chrome Safari | |
| `media-return-to-realtime-button` | Safari | |
| `media-rewind-button` | Safari | |
| `media-seek-back-button` | Safari Edge | |
| `media-seek-forward-button` | Safari Edge | |
| `media-toggle-closed-captions-button` | Chrome Safari | |
| `media-slider` | Chrome Safari Edge | |
| `media-sliderthumb` | Chrome Safari Edge | |
| `media-volume-slider-container` | Chrome Safari | |
| `media-volume-slider-mute-button` | Safari | |
| `media-volume-slider` | Chrome Safari | |
| `media-volume-sliderthumb` | Chrome Safari | |
| `media-controls-background` | Chrome Safari | |
| `media-controls-dark-bar-background` | Safari | |
| `media-controls-fullscreen-background` | Chrome Safari | |
| `media-controls-light-bar-background` | Safari | |
| `media-current-time-display` | Chrome Safari | |
| `media-time-remaining-display` | Chrome Safari | |
| `menulist-text` | Firefox Chrome Safari Edge | |
| `menulist-textfield` | Firefox Chrome Safari Edge | The element is styled as the text field for a menulist. (Not implemented for the Windows platform) |
| `meterbar` | Firefox | Use `meter` instead. |
| `number-input` | Firefox | |
| `progress-bar-value` | Chrome Safari | |
| `progressbar` | Firefox | The element is styled like a progress bar. Use `progress-bar` instead |
| `progressbar-vertical` | Firefox | |
| `range` | Firefox | |
| `range-thumb` | Firefox | |
| `rating-level-indicator` | Safari | |
| `relevancy-level-indicator` | Safari | |
| `scale-horizontal` | Firefox | |
| `scalethumbend` | Firefox | |
| `scalethumb-horizontal` | Firefox | |
| `scalethumbstart` | Firefox | |
| `scalethumbtick` | Firefox | |
| `scalethumb-vertical` | Firefox | |
| `scale-vertical` | Firefox | |
| `scrollbarthumb-horizontal` | Firefox | |
| `scrollbarthumb-vertical` | Firefox | |
| `scrollbartrack-horizontal` | Firefox | |
| `scrollbartrack-vertical` | Firefox | |
| `searchfield-decoration` | Safari Edge | |
| `searchfield-results-decoration` | Chrome Safari Edge | (Works on Chrome 51 on Windows 7) |
| `searchfield-results-button` | Safari Edge | |
| `searchfield-cancel-button` | Chrome Safari Edge | |
| `snapshotted-plugin-overlay` | Safari | |
| `sheet` | None | |
| `slider-vertical` | Chrome Safari Edge | |
| `sliderthumb-horizontal` | Chrome Safari Edge | |
| `sliderthumb-vertical` | Chrome Safari Edge | |
| `textfield-multiline` | Firefox | Use `textarea` instead. |
| `-apple-pay-button` | Safari | **iOS and macOS only**. Available on the web starting in iOS 10.1 and macOS 10.12.1 |
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
appearance =
none [|](value_definition_syntax#single_bar)
auto [|](value_definition_syntax#single_bar)
<compat-auto> [|](value_definition_syntax#single_bar)
<compat-special>
<compat-auto> =
searchfield [|](value_definition_syntax#single_bar)
textarea [|](value_definition_syntax#single_bar)
push-button [|](value_definition_syntax#single_bar)
slider-horizontal [|](value_definition_syntax#single_bar)
checkbox [|](value_definition_syntax#single_bar)
radio [|](value_definition_syntax#single_bar)
square-button [|](value_definition_syntax#single_bar)
menulist [|](value_definition_syntax#single_bar)
listbox [|](value_definition_syntax#single_bar)
meter [|](value_definition_syntax#single_bar)
progress-bar [|](value_definition_syntax#single_bar)
button
<compat-special> =
textfield [|](value_definition_syntax#single_bar)
menulist-button
```
Examples
--------
### Make an element look like a menulist button
```
.exampleone {
-webkit-appearance: menulist-button;
-moz-appearance: menulist-button;
appearance: menulist-button;
}
```
### Apply custom styling
#### HTML
```
<select class="none">
<option>appearance: none</option>
</select>
<select class="auto">
<option>appearance: auto</option>
</select>
```
#### CSS
```
.none {
appearance: none;
}
.auto {
appearance: auto;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Basic User Interface Module Level 4 # appearance-switching](https://w3c.github.io/csswg-drafts/css-ui/#appearance-switching) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `appearance` | 84
1 | 84
12 | 80
64
1 | No | 70
15 | 15.4
3 | 84
4.4 | 84
18 | 80
64
4 | 60
14 | 15.4
1 | 14.0
1.0 |
| `auto` | 83 | 83 | 80 | No | 69 | 15.4 | 83 | 83 | 80 | 59 | 15.4 | 13.0 |
| `compat-auto` | 1 | 12 | 1 | No | 15 | 3 | 4.4 | 18 | 4 | 14 | 1 | 1.0 |
| `menulist-button` | 1 | 12 | 80
1
See [bug 1481615](https://bugzil.la/1481615). | No | 15 | 3 | 4.4 | 18 | 80
4
See [bug 1481615](https://bugzil.la/1481615). | 14 | 1 | 1.0 |
| `none` | 1 | 12 | 54
1
Doesn't work with `<input type="checkbox">` and `<input type="radio">`. | No | 15 | 3 | 4.4 | 18 | 54
4
Doesn't work with `<input type="checkbox">` and `<input type="radio">`. | 14 | 3 | 1.0 |
| `textfield` | 1 | 12 | 1 | No | 15 | 3 | 4.4 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [Definition of `appearance` in CSS Basic User Interface Module Level 4](https://drafts.csswg.org/css-ui/#appearance-switching)
css scroll-margin-block-end scroll-margin-block-end
=======================
The `scroll-margin-block-end` property defines the margin of the scroll snap area at the end of the block dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets.
Try it
------
Syntax
------
```
/\* <length> values \*/
scroll-margin-block-end: 10px;
scroll-margin-block-end: 1em;
/\* Global values \*/
scroll-margin-block-end: inherit;
scroll-margin-block-end: initial;
scroll-margin-block-end: revert;
scroll-margin-block-end: revert-layer;
scroll-margin-block-end: unset;
```
### Values
`<length>` An outset from the block end edge of the scroll container.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-margin-block-end =
[<length>](length)
```
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # margin-longhands-logical](https://w3c.github.io/csswg-drafts/css-scroll-snap/#margin-longhands-logical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-margin-block-end` | 69 | 79 | 68 | No | 56 | 14.1 | 69 | 69 | 68 | 48 | 14.5 | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
css <image> <image>
=======
The `<image>` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [data type](css_types) represents a two-dimensional image.
Syntax
------
The `<image>` data type can be represented with any of the following:
* An image denoted by the [`url()`](url) data type
* A [`<gradient>`](gradient) data type
* A part of the webpage, defined by the [`element()`](element()) function
* An image, image fragment or solid patch of color, defined by the [`image()`](image/image) function
* A blending of two or more images defined by the [`cross-fade()`](cross-fade) function.
* A selection of images chosen based on resolution defined by the [`image-set()`](image/image-set) function.
Description
-----------
CSS can handle the following kinds of images:
* Images with *intrinsic dimensions* (a natural size), like a JPEG, PNG, or other [raster format](https://en.wikipedia.org/wiki/Raster_graphics).
* Images with *multiple intrinsic dimensions*, existing in multiple versions inside a single file, like some .ico formats. (In this case, the intrinsic dimensions will be those of the image largest in area and the aspect ratio most similar to the containing box.)
* Images with no intrinsic dimensions but with *an intrinsic aspect ratio* between its width and height, like an SVG or other [vector format](https://en.wikipedia.org/wiki/Vector_graphics).
* Images with *neither intrinsic dimensions, nor an intrinsic aspect ratio*, like a CSS gradient.
CSS determines an object's *concrete size* using (1) its *intrinsic dimensions*; (2) its *specified size*, defined by CSS properties like [`width`](width), [`height`](height), or [`background-size`](background-size); and (3) its *default size*, determined by the kind of property the image is used with:
| Kind of Object (CSS Property) | Default object size |
| --- | --- |
| [`background-image`](background-image) | The size of the element's background positioning area |
| [`list-style-image`](list-style-image) | The size of a `1em` character |
| [`border-image-source`](border-image-source) | The size of the element's border image area |
| [`cursor`](cursor) | The browser-defined size matching the usual cursor size on the client's system |
| [`mask-image`](mask-image) | ? |
| [`shape-outside`](shape-outside) | ? |
| [`mask-border-source`](mask-border-source) | ? |
| [`symbols()`](@counter-style/symbols) for @counter-style | At risk feature. If supported, the browser-defined size matching the usual cursor size on the client's system |
| [`content`](content) for a pseudo-element ([`::after`](::after)/[`::before`](::before)) | A 300px × 150px rectangle |
The concrete object size is calculated using the following algorithm:
* If the specified size defines *both the width and the height*, these values are used as the concrete object size.
* If the specified size defines *only the width or only the height*, the missing value is determined using the intrinsic ratio, if there is any, the intrinsic dimensions if the specified value matches, or the default object size for that missing value.
* If the specified size defines *neither the width nor the height*, the concrete object size is calculated so that it matches the intrinsic aspect ratio of the image but without exceeding the default object size in any dimension. If the image has no intrinsic aspect ratio, the intrinsic aspect ratio of the object it applies to is used; if this object has none, the missing width or height are taken from the default object size.
**Note:** Not all browsers support every type of image on every property. See the [browser compatibility section](#browser_compatibility) for details.
Accessibility concerns
----------------------
Browsers do not provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document.
* [MDN Understanding WCAG, Guideline 1.1 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.1_%e2%80%94_providing_text_alternatives_for_non-text_content)
* [Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/2016/NOTE-UNDERSTANDING-WCAG20-20161007/text-equiv-all.html)
Formal syntax
-------------
```
<image> =
<url> [|](value_definition_syntax#single_bar)
[<gradient>](gradient)
<url> =
url( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) ) [|](value_definition_syntax#single_bar)
src( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) )
```
Examples
--------
### Valid images
```
url(test.jpg) /\* A <url>, as long as test.jpg is an actual image \*/
linear-gradient(blue, red) /\* A <gradient> \*/
element(#realid) /\* A part of the webpage, referenced with the element() function,
if "realid" is an existing ID on the page \*/
image(ltr 'arrow.png#xywh=0,0,16,16', red)
/\* A section 16x16 section of <url>, starting from the top, left of the original
image as long as arrow.png is a supported image, otherwise a solid
red swatch. If language is rtl, the image will be horizontally flipped. \*/
cross-fade(20% url(twenty.png), url(eighty.png))
/\* cross faded images, with twenty being 20% opaque
and eighty being 80% opaque. \*/
image-set('test.jpg' 1x, 'test-2x.jpg' 2x)
/\* a selection of images with varying resolutions \*/
```
### Invalid images
```
nourl.jpg /\* An image file must be defined using the url() function. \*/
url(report.pdf) /\* A file pointed to by the url() function must be an image. \*/
element(#fakeid) /\* An element ID must be an existing ID on the page. \*/
image(z.jpg#xy=0,0) /\* The spatial fragment must be written in the format of xywh=#,#,#,# \*/
image-set('cat.jpg' 1x, 'dog.jpg' 1x) /\* every image in an image set must have a different resolutions \*/
```
Specifications
--------------
| Specification |
| --- |
| [CSS Images Module Level 3 # image-values](https://w3c.github.io/csswg-drafts/css-images/#image-values) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `image` | 1 | 12 | 1 | 10 | 2 | 1 | 4.4 | 18 | 4 | 11 | 1 | 1.0 |
| `cross-fade` | 17
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | 79
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | No
See [bug 1657516](https://bugzil.la/1657516). | No | 15
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | 10
Supports the original dual-image with percentage implementation only.
5.1
Supports the original dual-image with percentage implementation only. | 4.4
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | 18
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | No
See [bug 1657516](https://bugzil.la/1657516). | 14
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | 9.3
Support for the original dual-image with percentage implementation only.
5
Supports the original dual-image with percentage implementation only. | 1.0
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] |
| `element` | No | No | 57
29-57
`-moz-element()` is limited to [`background-image`](https://developer.mozilla.org/docs/Web/CSS/background-image), [`background`](https://developer.mozilla.org/docs/Web/CSS/background), [`border-image`](https://developer.mozilla.org/docs/Web/CSS/border-image) and [`border-image-source`](https://developer.mozilla.org/docs/Web/CSS/border-image-source).
4-29
`-moz-element()` is limited to [`background-image`](https://developer.mozilla.org/docs/Web/CSS/background-image) and [`background`](https://developer.mozilla.org/docs/Web/CSS/background). | No | No | No | No | No | 60
29-60
`-moz-element()` is limited to [`background-image`](https://developer.mozilla.org/docs/Web/CSS/background-image), [`background`](https://developer.mozilla.org/docs/Web/CSS/background), [`border-image`](https://developer.mozilla.org/docs/Web/CSS/border-image) and [`border-image-source`](https://developer.mozilla.org/docs/Web/CSS/border-image-source).
4-29
`-moz-element()` is limited to [`background-image`](https://developer.mozilla.org/docs/Web/CSS/background-image) and [`background`](https://developer.mozilla.org/docs/Web/CSS/background). | No | No | No |
| `gradient` | 26
10 | 12 | 3.6
Gradients are limited to [`background-image`](https://developer.mozilla.org/docs/Web/CSS/background-image), [`border-image`](https://developer.mozilla.org/docs/Web/CSS/border-image), and [`mask-image`](https://developer.mozilla.org/docs/Web/CSS/mask-image). | 10 | 15
12.1
11-15 | 7
5.1 | ≤37
≤37 | 26
18 | 4
Gradients are limited to [`background-image`](https://developer.mozilla.org/docs/Web/CSS/background-image), [`border-image`](https://developer.mozilla.org/docs/Web/CSS/border-image), and [`mask-image`](https://developer.mozilla.org/docs/Web/CSS/mask-image). | 14
12.1
11-14 | 7
5 | 1.5
1.0 |
| `image` | No | No | No
["See [bug 703217](https://bugzil.la/703217).", "The [`-moz-image-rect()`](https://developer.mozilla.org/docs/Web/CSS/-moz-image-rect) function supports fragments as of Firefox 4."] | No | No | No | No | No | No
The [`-moz-image-rect()`](https://developer.mozilla.org/docs/Web/CSS/-moz-image-rect) function supports fragments as of Firefox 4. | No | No | No |
| `image-set` | 21 | 79 | 90
88
["In `cursor` and `content` properties, gradients are not supported as arguments to `image-set()`. See [bug 1696314](https://bugzil.la/1696314).", "Before Firefox 89, the `type()` function is not supported as an argument to `image-set()`."] | No | 15 | 6
Support for `url` images only and `x` is the only supported resolution unit. See [bug 160934](https://webkit.org/b/160934). | 4.4 | 25 | 90
88
["In `cursor` and `content` properties, gradients are not supported as arguments to `image-set()`. See [bug 1696314](https://bugzil.la/1696314).", "Before Firefox 89, the `type()` function is not supported as an argument to `image-set()`."] | 14 | 6
Support for `url` images only and `x` is the only supported resolution unit. See [bug 160934](https://webkit.org/b/160934). | 1.5 |
| `paint` | 65 | 79 | No | No | 52 | No | 65 | 65 | No | 47 | No | 9.2 |
See also
--------
* [`<gradient>`](gradient)
* [`element()`](element()) Experimental
* [`image()`](image/image)
* [`image-set()`](image/image-set)
* [`cross-fade()`](cross-fade)
| programming_docs |
css offset-path offset-path
===========
The `offset-path` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property specifies a motion path for an element to follow and defines the element's positioning within the parent container or SVG coordinate system.
Try it
------
Syntax
------
```
/\* Default \*/
offset-path: none;
/\* Function values \*/
offset-path: ray(45deg closest-side contain);
/\* URL \*/
offset-path: url(#path);
/\* Shapes \*/
offset-path: circle(50% at 25% 25%);
offset-path: inset(50% 50% 50% 50%);
offset-path: polygon(30% 0%, 70% 0%, 100% 50%, 30% 100%, 0% 70%, 0% 30%);
offset-path: path("M 0,200 Q 200,200 260,80 Q 290,20 400,0 Q 300,100 400,200");
/\* Geometry Boxes \*/
offset-path: margin-box;
offset-path: stroke-box;
/\* Global values \*/
offset-path: inherit;
offset-path: initial;
offset-path: revert;
offset-path: unset;
```
### Values
`ray()` Taking up to three values, defines a path that is a line segment starting from the position of the box and proceeds in the direction defined by the specified angle similar to the CSS gradient angle where `0deg` is up, with positive angles increasing in the clockwise direction, with the size value being similar to the CSS radial gradient size values from `closest-side` to `farthest-corner`, and the keyterm `contain`.
`url()` References the ID of an SVG shape — `circle`, `ellipse`, `line`, `path`, `polygon`, `polyline`, or `rect` — using the shape's geometry as the path.
`<basic-shape>` Specifies a [CSS shape](css_shapes/basic_shapes) including `circle()`, `ellipse()`, `inset()`, `polygon()`, or `path()`.
[`path()`](path) A path string defined with SVG coordinate syntax.
`none` Specifies no motion path at all.
Description
-----------
This property defines a path an animated element can follow. An offset path is either a specified path with one or multiple sub-paths or the geometry of a not-styled basic shape. The element's exact position on the offset path is determined by the [`offset-distance`](offset-distance) property. Each shape or path must define an initial position for the computed value of `0` for [`offset-distance`](offset-distance) and an initial direction which specifies the rotation of the object to the initial position.
Early versions of the spec called this property `motion-path`. It was changed to `offset-path` because the property describes static positions, not motion.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | transformable elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | as <angle>, <basic-shape> or <path()> |
| Creates [stacking context](css_positioning/understanding_z_index/the_stacking_context) | yes |
Formal syntax
-------------
```
offset-path =
none [|](value_definition_syntax#single_bar)
<ray()> [|](value_definition_syntax#single_bar)
<path()> [|](value_definition_syntax#single_bar)
<url> [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [<basic-shape>](basic-shape) [&&](value_definition_syntax#double_ampersand) <coord-box>[?](value_definition_syntax#question_mark) []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
<coord-box>
<ray()> =
ray( [[](value_definition_syntax#brackets) [<angle>](angle) [&&](value_definition_syntax#double_ampersand) <size> [&&](value_definition_syntax#double_ampersand) contain[?](value_definition_syntax#question_mark) []](value_definition_syntax#brackets) )
<path()> =
path( [<string>](string) )
<url> =
url( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) ) [|](value_definition_syntax#single_bar)
src( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) )
<coord-box> =
content-box [|](value_definition_syntax#single_bar)
padding-box [|](value_definition_syntax#single_bar)
border-box [|](value_definition_syntax#single_bar)
fill-box [|](value_definition_syntax#single_bar)
stroke-box [|](value_definition_syntax#single_bar)
view-box
<size> =
<extent-keyword> [|](value_definition_syntax#single_bar)
[<length [0,∞]>](length) [|](value_definition_syntax#single_bar)
[<length-percentage [0,∞]>](length-percentage)[{2}](value_definition_syntax#curly_braces)
<extent-keyword> =
closest-corner [|](value_definition_syntax#single_bar)
closest-side [|](value_definition_syntax#single_bar)
farthest-corner [|](value_definition_syntax#single_bar)
farthest-side
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Animating an element with offset-path
The `offset-path` properties in the CSS code sample defines a motion path that is identical to the `<path>` element in the SVG. The path, as can be seen in the rendering of the SVG code, is a line drawing of a house with a chimney.
#### SVG
The top and bottom halves of the scissors would appear in the top left of the canvas were they not positioned along the starting point of the motion path defined by `offset-path`.
```
<svg
xmlns="http://www.w3.org/2000/svg"
width="700"
height="450"
viewBox="350 0 1400 900">
<title>House and Scissors</title>
<rect x="595" y="423" width="610" height="377" fill="blue" />
<polygon points="506,423 900,190 1294,423" fill="yellow" />
<polygon points="993,245 993,190 1086,190 1086,300" fill="red" />
<path
id="house"
d="M900,190 L993,245 V201 A11,11 0 0,1 1004,190 H1075 A11,11 0 0,1 1086,201 V300 L1294,423 H1216 A11,11 0 0,0 1205,434 V789 A11,11 0 0,1 1194,800 H606 A11,11 0 0,1 595,789 V434 A11,11 0 0,0 584,423 H506 L900,190"
fill="none"
stroke="black"
stroke-width="13"
stroke-linejoin="round"
stroke-linecap="round" />
<path
id="firstScissorHalf"
class="scissorHalf"
d="M30,0 H-10 A10,10 0 0,0 -20,10 A20,20 0 1,1 -40,-10 H20 A10,10 0 0,1 30,0 M-40,20 A10,10 1 0,0 -40,0 A10,10 1 0,0 -40,20 M0,0"
transform="translate(0,0)"
fill="green"
stroke="black"
stroke-width="5"
stroke-linejoin="round"
stroke-linecap="round"
fill-rule="evenodd" />
<path
id="secondScissorHalf"
class="scissorHalf"
d="M30,0 H-10 A10,10 0 0,1 -20,-10 A20,20 0 1,0 -40,10 H20 A10,10 0 0,0 30,0 M-40,-20 A10,10 1 0,0 -40,0 A10,10 1 0,0 -40,-20 M0,0"
transform="translate(0,0)"
fill="forestgreen"
stroke="black"
stroke-width="5"
stroke-linejoin="round"
stroke-linecap="round"
fill-rule="evenodd" />
</svg>
```
#### CSS
```
.scissorHalf {
offset-path: path(
"M900,190 L993,245 V201 A11,11 0 0,1 1004,190 H1075 A11,11 0 0,1 1086,201 V300 L1294,423 H1216 A11,11 0 0,0 1205,434 V789 A11,11 0 0,1 1194,800 H606 A11,11 0 0,1 595,789 V434 A11,11 0 0,0 584,423 H506 L900,190"
);
animation: followpath 4s linear infinite;
}
@keyframes followpath {
to {
motion-offset: 100%;
offset-distance: 100%;
}
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Motion Path Module Level 1 # offset-path-property](https://drafts.fxtf.org/motion/#offset-path-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `offset-path` | 55
46 | 79
79 | 72 | No | 45
32 | 15.4 | 55
46 | 55
46 | 79 | 43
32 | 15.4 | 6.0
`path()` is the only value type supported.
5.0 |
| `path-support` | 64 | 79 | 72 | No | 51 | preview | 64 | 64 | 79 | 47 | No | 9.0 |
| `ray-support` | 64 | 79 | 72 | No | 51 | preview | 64 | 64 | No | 47 | No | 9.0 |
See also
--------
* [`offset`](offset)
* [`offset-distance`](offset-distance)
* [`offset-rotate`](offset-rotate)
* [SVG <path>](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths)
* [`path()`](path)
Other demos:
* [Examples of the various values](https://codepen.io/team/css-tricks/pen/WZdKMq)
* [Triangle](https://codepen.io/ericwilligers/pen/jMbJPp)
* [Scissors](https://codepen.io/ericwilligers/pen/bwVZNa)
* [Eyes](https://jsfiddle.net/ericwilligers/r1snqdan/)
css :paused :paused
=======
The `:paused` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) selector is a resource state pseudo-class that will match an audio, video, or similar resource that is capable of being "played" or "paused", when that element is "paused".
A resource is paused if the user explicitly paused it, or if it is in a non-activated state.
```
:paused {
}
```
Syntax
------
```
:paused
```
Examples
--------
### CSS
```
:paused {
border: 5px solid orange;
}
```
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # selectordef-paused](https://w3c.github.io/csswg-drafts/selectors/#selectordef-paused) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:paused` | No | No | No | No | No | 15.4 | No | No | No | No | 15.4 | No |
See also
--------
* [`:playing`](:playing)
css Syntax Syntax
======
The basic goal of the Cascading Stylesheet ([CSS](https://developer.mozilla.org/en-US/docs/Web/CSS)) language is to allow a browser engine to paint elements of the page with specific features, like colors, positioning, or decorations. The *CSS syntax* reflects this goal and its basic building blocks are:
* The **property** which is an identifier, that is a human-readable *name*, that defines which feature is considered.
* The **value** which describe how the feature must be handled by the engine. Each property has a set of valid values, defined by a formal grammar, as well as a semantic meaning, implemented by the browser engine.
CSS declarations
----------------
Setting CSS properties to specific values is the core function of the CSS language. A property and value pair is called a **declaration**, and any CSS engine calculates which declarations apply to every single element of a page in order to appropriately lay it out, and to style it.
Both properties and values are case-insensitive by default in CSS. The pair is separated by a colon, '`:`' (`U+003A COLON`), and white spaces before, between, and after properties and values, but not necessarily inside, are ignored.
There are more than [100 different properties](index) in CSS and a nearly infinite number of different values. Not all pairs of properties and values are allowed and each property defines what are the valid values. When a value is not valid for a given property, the declaration is deemed *invalid* and is wholly ignored by the CSS engine.
CSS declaration blocks
----------------------
Declarations are grouped in **blocks**, that is in a structure delimited by an opening brace, '`{`' (`U+007B LEFT CURLY BRACKET`), and a closing one, '`}`' (`U+007D RIGHT CURLY BRACKET`). Blocks sometimes can be nested, so opening and closing braces must be matched.
Such blocks are naturally called **declaration blocks** and declarations inside them are separated by a semicolon, '`;`' (`U+003B SEMICOLON`). A declaration block may be empty, that is containing null declaration. White spaces around declarations are ignored. The last declaration of a block doesn't need to be terminated by a semicolon, though it is often considered *good style* to do it as it prevents forgetting to add it when extending the block with another declaration.
A CSS declaration block is visualized in the diagram below.
**Note:** The content of a CSS declaration block, that is a list of semicolon-separated declarations, without the initial and closing braces, can be put inside an HTML [`style`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#style) attribute.
CSS rulesets
------------
If style sheets could only apply a declaration to each element of a Web page, they would be pretty useless. The real goal is to apply different declarations to different parts of the document.
CSS allows this by associating conditions with declarations blocks. Each (valid) declaration block is preceded by one or more comma-separated [**selectors**](css_selectors), which are conditions selecting some elements of the page. A [selector group](selector_list) and an associated declarations block, together, are called a **ruleset**, or often a **rule**.
A CSS ruleset (or rule) is visualized in the diagram below.
As an element of the page may be matched by several selectors, and therefore by several rules potentially containing a given property several times, with different values, the CSS standard defines which one has precedence over the other and must be applied: this is called the [cascade](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance) algorithm.
**Note:** It is important to note that even if a ruleset characterized by a group of selectors is a kind of shorthand replacing rulesets with a single selector each, this doesn't apply to the validity of the ruleset itself.
This leads to an important consequence: if one single basic selector is invalid, like when using an unknown pseudo-element or pseudo-class, the whole *selector* is invalid and therefore the entire rule is ignored (as invalid too).
CSS statements
--------------
Rulesets are the main building blocks of a style sheet, which often consists of only a big list of them. But there is other information that a Web author wants to convey in the style sheet, like the character set, other external style sheets to import, font face or list counter descriptions and many more. It will use other and specific kinds of statements to do that.
A **statement** is a building block that begins with any non-space characters and ends at the first closing brace or semicolon (outside a string, non-escaped and not included into another {}, () or [] pair).
There are two kinds of statements:
* **Rulesets** (or *rules*) that, as seen, associate a collection of CSS declarations to a condition described by a [selector](css_selectors).
* **At-rules** that start with an at sign, '`@`' (`U+0040 COMMERCIAL AT`), followed by an identifier and then continuing up to the end of the statement, that is up to the next semicolon (;) outside of a block, or the end of the next block. Each type of [at-rules](at-rule), defined by the identifier, may have its own internal syntax, and semantics of course. They are used to convey meta-data information (like [`@charset`](@charset) or [`@import`](@import)), conditional information (like [`@media`](@media) or [`@document`](@document)), or descriptive information (like [`@font-face`](@font-face)).
Any statement which isn't a ruleset or an at-rule is invalid and ignored.
### Nested statements
There is another group of statements – the **nested statements**. These are statements that can be used in a specific subset of at-rules – the *conditional group rules*. These statements only apply if a specific condition is matched: the `@media` at-rule content is applied only if the device on which the browser runs matches the expressed condition; the `@document` at-rule content is applied only if the current page matches some conditions, and so on. In CSS1 and CSS2.1, only *rulesets* could be used inside conditional group rules. That was very restrictive and this restriction was lifted in [*CSS Conditionals Level 3*](css_conditional_rules). Now, though still experimental and not supported by every browser, conditional group rules can contain a wider range of content: rulesets but also some, but not all, at-rules.
See also
--------
* CSS key concepts:
+ [CSS syntax](syntax)
+ [Comments](comments)
+ [Specificity](specificity)
+ [Inheritance](inheritance)
+ [Box model](css_box_model/introduction_to_the_css_box_model)
+ [Layout modes](layout_mode)
+ [Visual formatting models](visual_formatting_model)
+ [Margin collapsing](css_box_model/mastering_margin_collapsing)
+ Values
- [Initial values](initial_value)
- [Computed values](computed_value)
- [Used values](used_value)
- [Actual values](actual_value)
+ [Value definition syntax](value_definition_syntax)
+ [Shorthand properties](shorthand_properties)
+ [Replaced elements](replaced_element)
css padding-left padding-left
============
The `padding-left` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the width of the [padding area](css_box_model/introduction_to_the_css_box_model#padding_area) to the left of an element.
Try it
------
An element's padding area is the space between its content and its border.
**Note:** The [`padding`](padding) property can be used to set paddings on all four sides of an element with a single declaration.
Syntax
------
```
/\* <length> values \*/
padding-left: 0.5em;
padding-left: 0;
padding-left: 2cm;
/\* <percentage> value \*/
padding-left: 10%;
/\* Global values \*/
padding-left: inherit;
padding-left: initial;
padding-left: revert;
padding-left: revert-layer;
padding-left: unset;
```
The `padding-left` property is specified as a single value chosen from the list below. Unlike margins, negative values are not allowed for padding.
### Values
[`<length>`](length) The size of the padding as a fixed value. Must be nonnegative.
[`<percentage>`](percentage) The size of the padding as a percentage, relative to the inline size (*width* in a horizontal language, defined by [`writing-mode`](writing-mode)) of the [containing block](containing_block). Must be nonnegative.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements, except `table-row-group`, `table-header-group`, `table-footer-group`, `table-row`, `table-column-group` and `table-column`. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | no |
| Percentages | refer to the width of the containing block |
| [Computed value](computed_value) | the percentage as specified or the absolute length |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
padding-left =
[<length-percentage [0,∞]>](length-percentage)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Setting left padding using pixels and percentages
```
.content {
padding-left: 5%;
}
.sidebox {
padding-left: 10px;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Box Model Module Level 3 # padding-physical](https://w3c.github.io/csswg-drafts/css-box/#padding-physical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `padding-left` | 1 | 12 | 1 | 4 | 3.5 | 1 | ≤37 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [Introduction to the CSS basic box model](css_box_model/introduction_to_the_css_box_model)
* [`padding-top`](padding-top), [`padding-right`](padding-right), [`padding-bottom`](padding-bottom) and the [`padding`](padding) shorthand
* The mapped logical properties: [`padding-block-start`](padding-block-start), [`padding-block-end`](padding-block-end), [`padding-inline-start`](padding-inline-start), and [`padding-inline-end`](padding-inline-end) and the shorthands [`padding-block`](padding-block) and [`padding-inline`](padding-inline)
| programming_docs |
css :fullscreen :fullscreen
===========
The `:fullscreen` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) matches every element which is currently in fullscreen mode. If multiple elements have been put into fullscreen mode, this selects them all.
Syntax
------
```
:fullscreen
```
Usage notes
-----------
The `:fullscreen` pseudo-class lets you configure your stylesheets to automatically adjust the size, style, or layout of content when elements switch back and forth between fullscreen and traditional presentations.
Examples
--------
In this example, the color of a button is changed depending on whether or not the document is in fullscreen mode. This is done without needing to specifically apply style changes using JavaScript.
### HTML
The page's HTML looks like this:
```
<h1>MDN Web Docs Demo: :fullscreen pseudo-class</h1>
<p>
This demo uses the <code>:fullscreen</code> pseudo-class to automatically
change the style of a button used to toggle fullscreen mode on and off,
entirely using CSS.
</p>
<button id="fs-toggle">Toggle Fullscreen</button>
```
The [`<button>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button) with the ID `"fs-toggle"` will change between pale red and pale green depending on whether or not the document is in fullscreen mode.
### CSS
The magic happens in the CSS. There are two rules here. The first establishes the background color of the "Toggle Fullscreen Mode" button when the element is not in a fullscreen state. The key is the use of the `:not(:fullscreen)`, which looks for the element to not have the `:fullscreen` pseudo-class applied to it.
```
#fs-toggle:not(:fullscreen) {
background-color: #afa;
}
```
When the document *is* in fullscreen mode, the following CSS applies instead, setting the background color to a pale shade of red.
```
#fs-toggle:fullscreen {
background-color: #faa;
}
```
Specifications
--------------
| Specification |
| --- |
| [Fullscreen API Standard # :fullscreen-pseudo-class](https://fullscreen.spec.whatwg.org/#:fullscreen-pseudo-class) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:fullscreen` | 71
15 | 12 | 64
9 | 11 | 58
15 | 6 | 71
37 | 71
18 | 64
9 | 50
14 | No | 10.0
1.0 |
| `all_elements` | No | 12-79 | 43 | 11 | No | No | No | No | 43 | No | No | No |
See also
--------
* [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API)
* [Guide to the Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API/Guide)
* [`:not`](:not)
* [`::backdrop`](::backdrop)
* DOM API: [`Element.requestFullscreen()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen), [`Document.exitFullscreen()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/exitFullscreen), [`Document.fullscreenElement`](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenElement)
* [`allowfullscreen`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-allowfullscreen) attribute
css -moz-outline-radius-topright -moz-outline-radius-topright
============================
**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the [compatibility table](#browser_compatibility) at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
In Mozilla applications, the `-moz-outline-radius-topright` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property can be used to round the top-right corner of an element's [`outline`](outline).
Syntax
------
The value of `-moz-outline-radius-topright` is either a CSS [`<length>`](length) or a <percentage> of the corresponding dimensions of the border box. The [`calc()`](calc) function may be used as well.
### Values
`<length>` The radius of the circle defining the curvature of the top and right edges of the element, specified as a CSS [`<length>`](length).
`<percentage>` The radius of the circle defining the rounding of the top-right corner of the element, specified as the [percentages](percentage) of the top and right sides of the border box.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| Percentages | refer to the corresponding dimension of the border box |
| [Computed value](computed_value) | as specified |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
-moz-outline-radius-topright =
<outline-radius>
```
Examples
--------
### HTML
```
<p>Look at this paragraph's top-right corner.</p>
```
### CSS
```
p {
margin: 5px;
border: solid cyan;
outline: dotted red;
-moz-outline-radius-topright: 2em;
}
```
### Result
**Note:** The example above will not display the desired effect if you are viewing this in a browser other than Firefox.
Specifications
--------------
Not part of any standard.
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `-moz-outline-radius-topright` | No | No | 1-88
From Firefox 88, [outline](https://developer.mozilla.org/docs/Web/CSS/outline) now follows the shape created by [border-radius](https://developer.mozilla.org/docs/Web/CSS/border-radius) automatically, so this property is no longer needed (see [bug 1694146](https://bugzil.la/1694146)). | No | No | No | No | No | 4-88
From Firefox 88, [outline](https://developer.mozilla.org/docs/Web/CSS/outline) now follows the shape created by [border-radius](https://developer.mozilla.org/docs/Web/CSS/border-radius) automatically, so this property is no longer needed (see [bug 1694146](https://bugzil.la/1694146)). | No | No | No |
See also
--------
* See the [`-moz-outline-radius`](-moz-outline-radius) property for more information.
css mask-border mask-border
===========
The `mask-border` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [shorthand property](shorthand_properties) lets you create a mask along the edge of an element's border.
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`mask-border-mode`](mask-border-mode)
* [`mask-border-outset`](mask-border-outset)
* [`mask-border-repeat`](mask-border-repeat)
* [`mask-border-slice`](mask-border-slice)
* [`mask-border-source`](mask-border-source)
* [`mask-border-width`](mask-border-width)
Syntax
------
```
/\* source | slice \*/
mask-border: url("border-mask.png") 25;
/\* source | slice | repeat \*/
mask-border: url("border-mask.png") 25 space;
/\* source | slice | width \*/
mask-border: url("border-mask.png") 25 / 35px;
/\* source | slice | width | outset | repeat | mode \*/
mask-border: url("border-mask.png") 25 / 35px / 12px space alpha;
/\* Global values \*/
mask-border: inherit;
mask-border: initial;
mask-border: revert;
mask-border: revert-layer;
mask-border: unset;
```
### Values
`<'mask-border-source'>` The source image. See [`mask-border-source`](mask-border-source).
`<'mask-border-slice'>` The dimensions for slicing the source image into regions. Up to four values may be specified. See [`mask-border-slice`](mask-border-slice).
`<'mask-border-width'>` The width of the border mask. Up to four values may be specified. See [`mask-border-width`](mask-border-width).
`<'mask-border-outset'>` The distance of the border mask from the element's outside edge. Up to four values may be specified. See [`mask-border-outset`](mask-border-outset).
`<'mask-border-repeat'>` Defines how the edge regions of the source image are adjusted to fit the dimensions of the border mask. Up to two values may be specified. See [`mask-border-repeat`](mask-border-repeat).
`<'mask-border-mode'>` Defines whether the source image is treated as a luminance mask or alpha mask. See [`mask-border-mode`](mask-border-mode).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`mask-border-mode`](mask-border-mode): `alpha`
* [`mask-border-outset`](mask-border-outset): `0`
* [`mask-border-repeat`](mask-border-repeat): `stretch`
* [`mask-border-slice`](mask-border-slice): `0`
* [`mask-border-source`](mask-border-source): `none`
* [`mask-border-width`](mask-border-width): `auto`
|
| Applies to | all elements; In SVG, it applies to container elements excluding the [`<defs>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs) element and all graphics elements |
| [Inherited](inheritance) | no |
| Percentages | as each of the properties of the shorthand:* [`mask-border-slice`](mask-border-slice): refer to size of the mask border image
* [`mask-border-width`](mask-border-width): relative to width/height of the mask border image area
|
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`mask-border-mode`](mask-border-mode): as specified
* [`mask-border-outset`](mask-border-outset): as specified, but with relative lengths converted into absolute lengths
* [`mask-border-repeat`](mask-border-repeat): as specified
* [`mask-border-slice`](mask-border-slice): as specified
* [`mask-border-source`](mask-border-source): as specified, but with [`url()`](url) values made absolute
* [`mask-border-width`](mask-border-width): as specified, but with relative lengths converted into absolute lengths
|
| Animation type | as each of the properties of the shorthand:* [`mask-border-mode`](mask-border-mode): discrete
* [`mask-border-outset`](mask-border-outset): discrete
* [`mask-border-repeat`](mask-border-repeat): discrete
* [`mask-border-slice`](mask-border-slice): discrete
* [`mask-border-source`](mask-border-source): discrete
* [`mask-border-width`](mask-border-width): discrete
|
| Creates [stacking context](css_positioning/understanding_z_index/the_stacking_context) | yes |
Formal syntax
-------------
```
mask-border =
<'mask-border-source'> [||](value_definition_syntax#double_bar)
<'mask-border-slice'> [[](value_definition_syntax#brackets) / <'mask-border-width'>[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) / <'mask-border-outset'> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) [||](value_definition_syntax#double_bar)
<'mask-border-repeat'> [||](value_definition_syntax#double_bar)
<'mask-border-mode'>
```
Examples
--------
### Setting a bitmap-based mask border
In this example, we will mask an element's border with a diamond pattern. The source for the mask is a ".png" file of 90 by 90 pixels, with three diamonds going vertically and horizontally:
To match the size of a single diamond, we will use a value of 90 divided by 3, or `30`, for slicing the image into corner and edge regions. A repeat value of `round` will make the mask slices fit evenly, i.e., without clipping or gaps.
Specifications
--------------
| Specification |
| --- |
| [CSS Masking Module Level 1 # the-mask-border](https://drafts.fxtf.org/css-masking/#the-mask-border) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `mask-border` | 1 | 79 | No
See [bug 877294](https://bugzil.la/877294). | No | 15 | 3.1 | 4.4 | 18 | No
See [bug 877294](https://bugzil.la/877294). | 14 | 3 | 1.0 |
See also
--------
* [`mask-border-mode`](mask-border-mode)
* [`mask-border-outset`](mask-border-outset)
* [`mask-border-repeat`](mask-border-repeat)
* [`mask-border-source`](mask-border-source)
* [`mask-border-width`](mask-border-width)
css :lang() :lang()
=======
The `:lang()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) matches elements based on the language they are determined to be in.
Try it
------
**Note:** In HTML, the language is determined by a combination of the [`lang`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#lang) attribute, the [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) element, and possibly by information from the protocol (such as HTTP headers). For other document types there may be other document methods for determining the language.
Syntax
------
### Formal syntax
```
:lang( <language-code> )
```
### Parameter
`<language-code>` A [`<string>`](string) representing the language you want to target. Acceptable values are specified in the [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML) spec.
Examples
--------
In this example, the `:lang()` pseudo-class is used to match the parents of quote elements ([`<q>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q)) using [child combinators](child_combinator). Note that this doesn't illustrate the only way to do this, and that the best method to use depends on the type of document. Also note that [Unicode](https://developer.mozilla.org/en-US/docs/Glossary/Unicode) values are used to specify some of the special quote characters.
### HTML
```
<div lang="en">
<q>This English quote has a <q>nested</q> quote inside.</q>
</div>
<div lang="fr">
<q>This French quote has a <q>nested</q> quote inside.</q>
</div>
<div lang="de">
<q>This German quote has a <q>nested</q> quote inside.</q>
</div>
```
### CSS
```
:lang(en) > q {
quotes: "\201C""\201D""\2018""\2019";
}
:lang(fr) > q {
quotes: "« " " »";
}
:lang(de) > q {
quotes: "»" "«" "\2039""\203A";
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # lang-pseudo](https://w3c.github.io/csswg-drafts/selectors/#lang-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:lang` | 1 | 12 | 1 | 8 | 8 | 3.1 | 4.4 | 18 | 4 | 10.1 | 2 | 1.0 |
See also
--------
* Language-related pseudo-classes: [`:lang`](:lang), [`:dir`](:dir)
* HTML [`lang`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#lang) attribute
* HTML [`translate`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#translate) attribute
* [RFC 5646: Tags for Identifying Languages (also known as BCP 47)](https://datatracker.ietf.org/doc/html/rfc5646)
css <integer> <integer>
=========
The `<integer>` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [data type](css_types) is a special type of [`<number>`](number) that represents a whole number, whether positive or negative. Integers can be used in numerous CSS properties, such as [`column-count`](column-count), [`counter-increment`](counter-increment), [`grid-column`](grid-column), [`grid-row`](grid-row), and [`z-index`](z-index).
Syntax
------
The `<integer>` data type consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single `+` or `-` sign. There is no unit associated with integers.
**Note:** There is no official range of valid `<integer>` values and the specification do not specify a range.
Interpolation
-------------
When animated, values of the `<integer>` data type are [interpolated](https://developer.mozilla.org/en-US/docs/Glossary/Interpolation) using discrete, whole steps. The calculation is done as if they were real, floating-point numbers; the discrete value is obtained using the [floor function](https://en.wikipedia.org/wiki/Floor_function). The speed of the interpolation is determined by the [timing function](easing-function) associated with the animation.
Examples
--------
### Valid integers
```
12 Positive integer (without a leading + sign)
+123 Positive integer (with a leading + sign)
-456 Negative integer
0 Zero
+0 Zero, with a leading +
-0 Zero, with a leading -
```
### Invalid integers
```
12.0 This is a <number>, not an <integer>, though it represents an integer.
12. Decimal points are not allowed.
+---12 Only one leading +/- is allowed.
ten Letters are not allowed.
_5 Special characters are not allowed.
\35 Escaped Unicode characters are not allowed, even if they are an integer (here: 5).
\4E94 Non-arabic numerals are not allowed, even when escaped (here: the Japanese 5, 五).
3e4 Scientific notation is not allowed.
```
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 4 # integers](https://w3c.github.io/csswg-drafts/css-values/#integers) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `integer` | 1 | 12 | 1 | 3 | 3.5 | 1 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
See also
--------
* [`<number>`](number)
css scroll-behavior scroll-behavior
===============
The `scroll-behavior` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the behavior for a scrolling box when scrolling is triggered by the navigation or CSSOM scrolling APIs.
Try it
------
Note that any other scrolls, such as those performed by the user, are not affected by this property. When this property is specified on the root element, it applies to the viewport instead. This property specified on the `body` element will *not* propagate to the viewport.
User agents are allowed to ignore this property.
Syntax
------
```
/\* Keyword values \*/
scroll-behavior: auto;
scroll-behavior: smooth;
/\* Global values \*/
scroll-behavior: inherit;
scroll-behavior: initial;
scroll-behavior: revert;
scroll-behavior: revert-layer;
scroll-behavior: unset;
```
The `scroll-behavior` property is specified as one of the keyword values listed below.
### Values
`auto` The scrolling box scrolls instantly.
`smooth` The scrolling box scrolls in a smooth fashion using a user-agent-defined timing function over a user-agent-defined period of time. User agents should follow platform conventions, if any.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | scrolling boxes |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
scroll-behavior =
auto [|](value_definition_syntax#single_bar)
smooth
```
Examples
--------
### Setting smooth scroll behavior
#### HTML
```
<nav>
<a href="#page-1">1</a>
<a href="#page-2">2</a>
<a href="#page-3">3</a>
</nav>
<div class="scroll-container">
<div class="scroll-page" id="page-1">1</div>
<div class="scroll-page" id="page-2">2</div>
<div class="scroll-page" id="page-3">3</div>
</div>
```
#### CSS
```
a {
display: inline-block;
width: 50px;
text-decoration: none;
}
nav,
.scroll-container {
display: block;
margin: 0 auto;
text-align: center;
}
nav {
width: 339px;
padding: 5px;
border: 1px solid black;
}
.scroll-container {
width: 350px;
height: 200px;
overflow-y: scroll;
scroll-behavior: smooth;
}
.scroll-page {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
font-size: 5em;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Overflow Module Level 3 # smooth-scrolling](https://w3c.github.io/csswg-drafts/css-overflow/#smooth-scrolling) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-behavior` | 61 | 79 | 36 | No | 48 | 15.4 | 61 | 61 | 36 | 45 | 15.4 | 8.0 |
| programming_docs |
css hyphenate-character hyphenate-character
===================
The `hyphenate-character` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the character (or string) used at the end of a line before a hyphenation break.
Both automatic and soft hyphens are displayed according to the specified hyphenate-character value.
Try it
------
Syntax
------
The value either sets the string to use instead of a hyphen, or indicates that the user agent should select an appropriate string based on the current typographic conventions (default).
```
hyphenate-character: <string>;
hyphenate-character: auto;
```
### Values
`<string>` The [`<string>`](string) to use at the end of the line before a hyphenation break. The user agent may truncate this value if too many characters are used.
`auto` The user-agent selects an appropriate string based on the content language's typographic conventions. This is the default property value, and only needs to be explicitly set in order to override a different inherited value.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | all elements |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
hyphenate-character =
auto [|](value_definition_syntax#single_bar)
[<string>](string)
```
Examples
--------
This example shows two identical blocks of text that have [`hyphens`](hyphens) set to ensure that they break wherever needed, and on soft hyphen breaks (created using `­`). The first block has the value of the hyphen changed to the equals symbol ("`=`"). The second block has no hyphenate-character set, which is equivalent to `hyphenate-character: auto` for user agents that support this property.
### HTML
```
<dl>
<dt><code>hyphenate-character: "="</code></dt>
<dd id="string" lang="en">Superc­alifragilisticexpialidocious</dd>
<dt><code>hyphenate-character is not set</code></dt>
<dd lang="en">Superc­alifragilisticexpialidocious</dd>
</dl>
```
### CSS
```
dd {
width: 90px;
border: 1px solid black;
hyphens: auto;
}
dd#string {
-webkit-hyphenate-character: "=";
hyphenate-character: "=";
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Text Module Level 4 # propdef-hyphenate-character](https://w3c.github.io/csswg-drafts/css-text-4/#propdef-hyphenate-character) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `hyphenate-character` | 106
6 | 106
79 | 98 | No | 92
15 | 5.1 | 106
4.4 | 106
18 | 98 | 72
14 | 5 | 1.0 |
See also
--------
* Related CSS properties: [`hyphens`](hyphens), [`overflow-wrap`](overflow-wrap).
css scroll-margin-bottom scroll-margin-bottom
====================
The `scroll-margin-bottom` property defines the bottom margin of the scroll snap area that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets.
Try it
------
Syntax
------
```
/\* <length> values \*/
scroll-margin-bottom: 10px;
scroll-margin-bottom: 1em;
/\* Global values \*/
scroll-margin-bottom: inherit;
scroll-margin-bottom: initial;
scroll-margin-bottom: revert;
scroll-margin-bottom: revert-layer;
scroll-margin-bottom: unset;
```
### Values
`<length>` An outset from the bottom edge of the scroll container.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-margin-bottom =
[<length>](length)
```
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # margin-longhands-physical](https://w3c.github.io/csswg-drafts/css-scroll-snap/#margin-longhands-physical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-margin-bottom` | 69 | 79 | 68 | No | 56 | 14.1
11
Before version 14.1, scroll margin is not applied for scrolls to fragment target or `scrollIntoView()`, see [bug 189265](https://webkit.org/b/189265). | 69 | 69 | 68 | 48 | 14.5
11
Before version 14.5, scroll margin is not applied for scrolls to fragment target or `scrollIntoView()`, see [bug 189265](https://webkit.org/b/189265). | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
css animation-fill-mode animation-fill-mode
===================
The `animation-fill-mode` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets how a CSS animation applies styles to its target before and after its execution.
Try it
------
It is often convenient to use the shorthand property [`animation`](animation) to set all animation properties at once.
Syntax
------
```
/\* Single animation \*/
animation-fill-mode: none;
animation-fill-mode: forwards;
animation-fill-mode: backwards;
animation-fill-mode: both;
/\* Multiple animations \*/
animation-fill-mode: none, backwards;
animation-fill-mode: both, forwards, none;
/\* Global values \*/
animation-fill-mode: inherit;
animation-fill-mode: initial;
animation-fill-mode: revert;
animation-fill-mode: revert-layer;
animation-fill-mode: unset;
```
### Values
`none` The animation will not apply any styles to the target when it's not executing. The element will instead be displayed using any other CSS rules applied to it. This is the default value.
`forwards` The target will retain the computed values set by the last [keyframe](@keyframes) encountered during execution. The last keyframe depends on the value of [`animation-direction`](animation-direction) and [`animation-iteration-count`](animation-iteration-count):
| `animation-direction` | `animation-iteration-count` | last keyframe encountered |
| --- | --- | --- |
| `normal` | even or odd | `100%` or `to` |
| `reverse` | even or odd | `0%` or `from` |
| `alternate` | even | `0%` or `from` |
| `alternate` | odd | `100%` or `to` |
| `alternate-reverse` | even | `100%` or `to` |
| `alternate-reverse` | odd | `0%` or `from` |
`backwards` The animation will apply the values defined in the first relevant [keyframe](@keyframes) as soon as it is applied to the target, and retain this during the [`animation-delay`](animation-delay) period. The first relevant keyframe depends on the value of [`animation-direction`](animation-direction):
| `animation-direction` | first relevant keyframe |
| --- | --- |
| `normal` or `alternate` | `0%` or `from` |
| `reverse` or `alternate-reverse` | `100%` or `to` |
`both` The animation will follow the rules for both forwards and backwards, thus extending the animation properties in both directions.
**Note:** When you specify multiple comma-separated values on an `animation-*` property, they are applied to the animations in the order in which the [`animation-name`](animation-name)s appear. For situations where the number of animations and `animation-*` property values do not match, see [Setting multiple animation property values](css_animations/using_css_animations#setting_multiple_animation_property_values).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements, [`::before`](::before) and [`::after`](::after) <pseudo-elements> |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | Not animatable |
Formal syntax
-------------
```
animation-fill-mode =
<single-animation-fill-mode>[#](value_definition_syntax#hash_mark)
<single-animation-fill-mode> =
none [|](value_definition_syntax#single_bar)
forwards [|](value_definition_syntax#single_bar)
backwards [|](value_definition_syntax#single_bar)
both
```
Examples
--------
### Setting fill mode
You can see the effect of `animation-fill-mode` in the following example. It demonstrates how, for an animation that runs for an infinite time, you can cause it to remain in its final state rather than reverting to the original state (which is the default).
#### HTML
```
<p>Move your mouse over the gray box!</p>
<div class="demo">
<div class="growsandstays">This grows and stays big.</div>
<div class="grows">This just grows.</div>
</div>
```
#### CSS
```
.demo {
border-top: 100px solid #ccc;
height: 300px;
}
@keyframes grow {
0% {
font-size: 0;
}
100% {
font-size: 40px;
}
}
.demo:hover .grows {
animation-name: grow;
animation-duration: 3s;
}
.demo:hover .growsandstays {
animation-name: grow;
animation-duration: 3s;
animation-fill-mode: forwards;
}
```
#### Result
See [CSS animations](css_animations/using_css_animations) for more examples.
Specifications
--------------
| Specification |
| --- |
| [CSS Animations Level 1 # animation-fill-mode](https://w3c.github.io/csswg-drafts/css-animations/#animation-fill-mode) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `animation-fill-mode` | 43
3 | 12
12 | 49
16
5 | 10 | 30
15
12.1-15
12-15 | 9
5 | 43
≤37 | 43
18 | 49
16
5 | 30
14
12.1-14
12-14 | 9
4 | 4.0
1.0 |
See also
--------
* [Using CSS animations](css_animations/using_css_animations)
* JavaScript [`AnimationEvent`](https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent) API
* Other related animation properties: [`animation`](animation), [`animation-composition`](animation-composition), [`animation-delay`](animation-delay), [`animation-direction`](animation-direction), [`animation-duration`](animation-duration), [`animation-iteration-count`](animation-iteration-count), [`animation-name`](animation-name), [`animation-play-state`](animation-play-state), [`animation-timeline`](animation-timeline), [`animation-timing-function`](animation-timing-function)
css max-width max-width
=========
The `max-width` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the maximum width of an element. It prevents the [used value](used_value) of the [`width`](width) property from becoming larger than the value specified by `max-width`.
Try it
------
`max-width` overrides [`width`](width), but [`min-width`](min-width) overrides `max-width`.
Syntax
------
```
/\* <length> value \*/
max-width: 3.5em;
/\* <percentage> value \*/
max-width: 75%;
/\* Keyword values \*/
max-width: none;
max-width: max-content;
max-width: min-content;
max-width: fit-content(20em);
/\* Global values \*/
max-width: inherit;
max-width: initial;
max-width: revert;
max-width: revert-layer;
max-width: unset;
```
### Values
[`<length>`](length) Defines the `max-width` as an absolute value.
[`<percentage>`](percentage) Defines the `max-width` as a percentage of the containing block's width.
`none` No limit on the size of the box.
`max-content` The intrinsic preferred `max-width`.
`min-content` The intrinsic minimum `max-width`.
`fit-content([`<length-percentage>`](length-percentage))` Uses the `fit-content` formula with the available space replaced by the specified argument, i.e. `min(max-content, max(min-content, argument))`.
Accessibility concerns
----------------------
Ensure that elements set with a `max-width` are not truncated and/or do not obscure other content when the page is zoomed to increase text size.
* [MDN Understanding WCAG, Guideline 1.4 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background)
* [Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html)
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements but non-replaced inline elements, table rows, and row groups |
| [Inherited](inheritance) | no |
| Percentages | refer to the width of the containing block |
| [Computed value](computed_value) | the percentage as specified or the absolute length or `none` |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
max-width =
none [|](value_definition_syntax#single_bar)
[<length-percentage [0,∞]>](length-percentage) [|](value_definition_syntax#single_bar)
min-content [|](value_definition_syntax#single_bar)
max-content [|](value_definition_syntax#single_bar)
fit-content( [<length-percentage [0,∞]>](length-percentage) )
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Setting max width in pixels
In this example, the "child" will be either 150 pixels wide or the width of the "parent," whichever is smaller.
#### HTML
```
<div id="parent">
<div id="child">
Fusce pulvinar vestibulum eros, sed luctus ex lobortis quis.
</div>
</div>
```
#### CSS
```
#parent {
background: lightblue;
width: 300px;
}
#child {
background: gold;
width: 100%;
max-width: 150px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Box Sizing Module Level 4 # width-height-keywords](https://w3c.github.io/csswg-drafts/css-sizing-4/#width-height-keywords) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `max-width` | 1 | 12 | 1
CSS 2.1 leaves the behavior of `max-width` with [`table`](https://developer.mozilla.org/docs/Web/HTML/Element/table) undefined. Firefox supports applying `max-width` to `table` elements. | 7 | 4
CSS 2.1 leaves the behavior of `max-width` with [`table`](https://developer.mozilla.org/docs/Web/HTML/Element/table) undefined. Opera supports applying `max-width` to `table` elements. | 1 | 4.4 | 18 | 4
CSS 2.1 leaves the behavior of `max-width` with [`table`](https://developer.mozilla.org/docs/Web/HTML/Element/table) undefined. Firefox supports applying `max-width` to `table` elements. | 14 | 1 | 1.0 |
| `fit-content` | 46
25 | 79
79 | 3
Firefox implements the definitions given in CSS3 Basic Box. This defines `available` and not `fit-available`. Also, the definition of `fit-content` is simpler than in CSS3 Sizing. | No | 44 | 11
7
2 | 46
≤37 | 46 | 4
Firefox implements the definitions given in CSS3 Basic Box. This defines `available` and not `fit-available`. Also, the definition of `fit-content` is simpler than in CSS3 Sizing. | 43 | 11
7
1 | 5.0 |
| `fit-content_function` | No | No | 91 | No | No | No | No | No | No | No | No | No |
| `max-content` | 46
22 | 79
79 | 66
3 | No | 44 | 11
7
2 | 46
≤37 | 46 | 66
4 | 43 | 11
7
1 | 5.0 |
| `min-content` | 46
25 | 79
79 | 66
3 | No | 44 | 11
7
2 | 46 | 46 | 66
4 | 43 | 11
7
1 | 5.0 |
| `stretch` | 22 | 79 | No | No | 15 | No | 4.4 | 25 | No | 14 | No | 1.5 |
See also
--------
* [The box model](css_box_model/introduction_to_the_css_box_model), [`box-sizing`](box-sizing)
* [`width`](width), [`min-width`](min-width)
* The mapped logical properties: [`max-inline-size`](max-inline-size), [`max-block-size`](max-block-size)
css border border
======
The `border` [shorthand](shorthand_properties) [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets an element's border. It sets the values of [`border-width`](border-width), [`border-style`](border-style), and [`border-color`](border-color).
Try it
------
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`border-color`](border-color)
* [`border-style`](border-style)
* [`border-width`](border-width)
Syntax
------
```
/\* style \*/
border: solid;
/\* width | style \*/
border: 2px dotted;
/\* style | color \*/
border: outset #f33;
/\* width | style | color \*/
border: medium dashed green;
/\* Global values \*/
border: inherit;
border: initial;
border: revert;
border: revert-layer;
border: unset;
```
The `border` property may be specified using one, two, or three of the values listed below. The order of the values does not matter.
**Note:** The border will be invisible if its style is not defined. This is because the style defaults to `none`.
### Values
`<line-width>` Sets the thickness of the border. Defaults to `medium` if absent. See [`border-width`](border-width).
`<line-style>` Sets the style of the border. Defaults to `none` if absent. See [`border-style`](border-style).
[`<color>`](color_value) Sets the color of the border. Defaults to `currentcolor` if absent. See [`border-color`](border-color).
Description
-----------
As with all shorthand properties, any omitted sub-values will be set to their [initial value](initial_value). Importantly, `border` cannot be used to specify a custom value for [`border-image`](border-image), but instead sets it to its initial value, i.e., `none`.
The `border` shorthand is especially useful when you want all four borders to be the same. To make them different from each other, however, you can use the longhand [`border-width`](border-width), [`border-style`](border-style), and [`border-color`](border-color) properties, which accept different values for each side. Alternatively, you can target one border at a time with the physical (e.g., [`border-top`](border-top) ) and logical (e.g., [`border-block-start`](border-block-start)) border properties.
### Borders vs. outlines
Borders and [outlines](outline) are very similar. However, outlines differ from borders in the following ways:
* Outlines never take up space, as they are drawn outside of an element's content.
* According to the spec, outlines don't have to be rectangular, although they usually are.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`border-width`](border-width): as each of the properties of the shorthand:
+ [`border-top-width`](border-top-width): `medium`
+ [`border-right-width`](border-right-width): `medium`
+ [`border-bottom-width`](border-bottom-width): `medium`
+ [`border-left-width`](border-left-width): `medium`
* [`border-style`](border-style): as each of the properties of the shorthand:
+ [`border-top-style`](border-top-style): `none`
+ [`border-right-style`](border-right-style): `none`
+ [`border-bottom-style`](border-bottom-style): `none`
+ [`border-left-style`](border-left-style): `none`
* [`border-color`](border-color): as each of the properties of the shorthand:
+ [`border-top-color`](border-top-color): `currentcolor`
+ [`border-right-color`](border-right-color): `currentcolor`
+ [`border-bottom-color`](border-bottom-color): `currentcolor`
+ [`border-left-color`](border-left-color): `currentcolor`
|
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`border-width`](border-width): as each of the properties of the shorthand:
+ [`border-bottom-width`](border-bottom-width): the absolute length or `0` if [`border-bottom-style`](border-bottom-style) is `none` or `hidden`
+ [`border-left-width`](border-left-width): the absolute length or `0` if [`border-left-style`](border-left-style) is `none` or `hidden`
+ [`border-right-width`](border-right-width): the absolute length or `0` if [`border-right-style`](border-right-style) is `none` or `hidden`
+ [`border-top-width`](border-top-width): the absolute length or `0` if [`border-top-style`](border-top-style) is `none` or `hidden`
* [`border-style`](border-style): as each of the properties of the shorthand:
+ [`border-bottom-style`](border-bottom-style): as specified
+ [`border-left-style`](border-left-style): as specified
+ [`border-right-style`](border-right-style): as specified
+ [`border-top-style`](border-top-style): as specified
* [`border-color`](border-color): as each of the properties of the shorthand:
+ [`border-bottom-color`](border-bottom-color): computed color
+ [`border-left-color`](border-left-color): computed color
+ [`border-right-color`](border-right-color): computed color
+ [`border-top-color`](border-top-color): computed color
|
| Animation type | as each of the properties of the shorthand:* [`border-color`](border-color): as each of the properties of the shorthand:
+ [`border-bottom-color`](border-bottom-color): a [color](color_value#interpolation)
+ [`border-left-color`](border-left-color): a [color](color_value#interpolation)
+ [`border-right-color`](border-right-color): a [color](color_value#interpolation)
+ [`border-top-color`](border-top-color): a [color](color_value#interpolation)
* [`border-style`](border-style): discrete
* [`border-width`](border-width): as each of the properties of the shorthand:
+ [`border-bottom-width`](border-bottom-width): a [length](length#interpolation)
+ [`border-left-width`](border-left-width): a [length](length#interpolation)
+ [`border-right-width`](border-right-width): a [length](length#interpolation)
+ [`border-top-width`](border-top-width): a [length](length#interpolation)
|
Formal syntax
-------------
```
border =
<line-width> [||](value_definition_syntax#double_bar)
<line-style> [||](value_definition_syntax#double_bar)
[<color>](color_value)
<line-width> =
[<length [0,∞]>](length) [|](value_definition_syntax#single_bar)
thin [|](value_definition_syntax#single_bar)
medium [|](value_definition_syntax#single_bar)
thick
<line-style> =
none [|](value_definition_syntax#single_bar)
hidden [|](value_definition_syntax#single_bar)
dotted [|](value_definition_syntax#single_bar)
dashed [|](value_definition_syntax#single_bar)
solid [|](value_definition_syntax#single_bar)
double [|](value_definition_syntax#single_bar)
groove [|](value_definition_syntax#single_bar)
ridge [|](value_definition_syntax#single_bar)
inset [|](value_definition_syntax#single_bar)
outset
```
Examples
--------
### Setting a pink outset border
#### HTML
```
<div>I have a border, an outline, and a box shadow! Amazing, isn't it?</div>
```
#### CSS
```
div {
border: 0.5rem outset pink;
outline: 0.5rem solid khaki;
box-shadow: 0 0 0 2rem skyblue;
border-radius: 12px;
font: bold 1rem sans-serif;
margin: 2rem;
padding: 1rem;
outline-offset: 0.5rem;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # propdef-border](https://w3c.github.io/csswg-drafts/css-backgrounds/#propdef-border) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border` | 1 | 12 | 1 | 4 | 3.5 | 1 | ≤37 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [`border-width`](border-width)
* [`border-style`](border-style)
* [`border-color`](border-color)
* [`outline`](outline)
* [Backgrounds and borders](css_backgrounds_and_borders)
* [Learn CSS: Backgrounds and borders](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Backgrounds_and_borders)
| programming_docs |
css line-height line-height
===========
The `line-height` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the height of a line box. It's commonly used to set the distance between lines of text. On block-level elements, it specifies the minimum height of line boxes within the element. On non-[replaced](replaced_element) inline elements, it specifies the height that is used to calculate line box height.
Try it
------
Syntax
------
```
/\* Keyword value \*/
line-height: normal;
/\* Unitless values: use this number multiplied
by the element's font size \*/
line-height: 3.5;
/\* <length> values \*/
line-height: 3em;
/\* <percentage> values \*/
line-height: 34%;
/\* Global values \*/
line-height: inherit;
line-height: initial;
line-height: revert;
line-height: revert-layer;
line-height: unset;
```
The `line-height` property is specified as any one of the following:
* a `<number>`
* a `<length>`
* a `<percentage>`
* the keyword `normal`.
### Values
`normal` Depends on the user agent. Desktop browsers (including Firefox) use a default value of roughly `1.2`, depending on the element's `font-family`.
`<number>` (unitless) The used value is this unitless [`<number>`](number) multiplied by the element's own font size. The computed value is the same as the specified `<number>`. In most cases, **this is the preferred way** to set `line-height` and avoid unexpected results due to inheritance.
`<length>` The specified [`<length>`](length) is used in the calculation of the line box height. Values given in **em** units may produce unexpected results (see example below).
`<percentage>` Relative to the font size of the element itself. The computed value is this [`<percentage>`](percentage) multiplied by the element's computed font size. **Percentage** values may produce unexpected results (see the second example below).
`-moz-block-height` Non-standard
Sets the line height to the content height of the current block.
Accessibility concerns
----------------------
Use a minimum value of `1.5` for `line-height` for main paragraph content. This will help people experiencing low vision conditions, as well as people with cognitive concerns such as Dyslexia. If the page is zoomed to increase the text size, using a unitless value ensures that the line height will scale proportionately.
[W3C Understanding WCAG 2.1](https://www.w3.org/TR/WCAG21/#visual-presentation)
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | yes |
| Percentages | refer to the font size of the element itself |
| [Computed value](computed_value) | for percentage and length values, the absolute length, otherwise as specified |
| Animation type | either number or length |
Formal syntax
-------------
```
line-height =
normal [|](value_definition_syntax#single_bar)
[<number>](number) [|](value_definition_syntax#single_bar)
<length-percentage>
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Basic example
```
/\* All rules below have the same resultant line height \*/
/\* number/unitless \*/
div {
line-height: 1.2;
font-size: 10pt;
}
/\* length \*/
div {
line-height: 1.2em;
font-size: 10pt;
}
/\* percentage \*/
div {
line-height: 120%;
font-size: 10pt;
}
/\* font shorthand \*/
div {
font: 10pt/1.2 Georgia, "Bitstream Charter", serif;
}
```
It is often more convenient to set `line-height` by using the [`font`](font) shorthand as shown above, but this requires the `font-family` property to be specified as well.
### Prefer unitless numbers for line-height values
This example shows why it is better to use [`<number>`](number) values instead of [`<length>`](length) values. We will use two [`<div>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div) elements. The first, with the green border, uses a unitless `line-height` value. The second, with the red border, uses a `line-height` value defined in `em`s.
#### HTML
```
<div class="box green">
<h1>Avoid unexpected results by using unitless line-height.</h1>
Length and percentage line-heights have poor inheritance behavior.
</div>
<div class="box red">
<h1>Avoid unexpected results by using unitless line-height.</h1>
Length and percentage line-heights have poor inheritance behavior
</div>
<!-- The first <h1> line-height is calculated from its own font-size (30px × 1.1) = 33px -->
<!-- The second <h1> line-height results from the red div's font-size (15px × 1.1) = 16.5px, probably not what you want -->
```
#### CSS
```
.green {
line-height: 1.1;
border: solid limegreen;
}
.red {
line-height: 1.1em;
border: solid red;
}
h1 {
font-size: 30px;
}
.box {
width: 18em;
display: inline-block;
vertical-align: top;
font-size: 15px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Inline Layout Module Level 3 # line-height-property](https://w3c.github.io/csswg-drafts/css-inline/#line-height-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `-moz-block-height` | No | No | 3.6 | No | No | No | No | No | 4 | No | No | No |
| `line-height` | 1 | 12 | 1 | 4 | 7 | 1 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
See also
--------
* [`font`](font), [`font-size`](font-size)
css font-style font-style
==========
The `font-style` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets whether a font should be styled with a normal, italic, or oblique face from its [`font-family`](font-family).
Try it
------
**Italic** font faces are generally cursive in nature, usually using less horizontal space than their unstyled counterparts, while **oblique** faces are usually just sloped versions of the regular face. When the specified style is not available, both italic and oblique faces are simulated by artificially sloping the glyphs of the regular face (use [`font-synthesis`](font-synthesis) to control this behavior).
Syntax
------
```
font-style: normal;
font-style: italic;
font-style: oblique;
font-style: oblique 10deg;
/\* Global values \*/
font-style: inherit;
font-style: initial;
font-style: revert;
font-style: revert-layer;
font-style: unset;
```
The `font-style` property is specified as a single keyword chosen from the list of values below, which can optionally include an angle if the keyword is `oblique`.
### Values
`normal` Selects a font that is classified as `normal` within a [`font-family`](font-family).
`italic` Selects a font that is classified as `italic`. If no italic version of the face is available, one classified as `oblique` is used instead. If neither is available, the style is artificially simulated.
`oblique` Selects a font that is classified as `oblique`. If no oblique version of the face is available, one classified as `italic` is used instead. If neither is available, the style is artificially simulated.
`oblique` [`<angle>`](angle)
Selects a font classified as `oblique`, and additionally specifies an angle for the slant of the text. If one or more oblique faces are available in the chosen font family, the one that most closely matches the specified angle is chosen. If no oblique faces are available, the browser will synthesize an oblique version of the font by slanting a normal face by the specified amount. Valid values are degree values of `-90deg` to `90deg` inclusive. If an angle is not specified, an angle of 14 degrees is used. Positive values are slanted to the end of the line, while negative values are slanted towards the beginning.
In general, for a requested angle of 14 degrees or greater, larger angles are preferred; otherwise, smaller angles are preferred (see the spec's [font matching section](https://drafts.csswg.org/css-fonts-4/#font-matching-algorithm) for the precise algorithm).
### Variable fonts
Variable fonts can offer a fine control over the degree to which an oblique face is slanted. You can select this using the `<angle>` modifier for the `oblique` keyword.
For TrueType or OpenType variable fonts, the `"slnt"` variation is used to implement varying slant angles for oblique, and the `"ital"` variation with a value of 1 is used to implement italic values. See [`font-variation-settings`](font-variation-settings).
**Note:** For the example below to work, you'll need a browser that supports the CSS Fonts Level 4 syntax in which `font-style: oblique` can accept an `<angle>`. The demo loads with `font-style: oblique 23deg;`. Change the value to see the slant of the text change.
Accessibility concerns
----------------------
Large sections of text set with a `font-style` value of `italic` may be difficult for people with cognitive concerns such as Dyslexia to read.
* [MDN Understanding WCAG, Guideline 1.4 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background)
* [W3C Understanding WCAG 2.1](https://www.w3.org/TR/WCAG21/#visual-presentation)
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
font-style =
normal [|](value_definition_syntax#single_bar)
italic [|](value_definition_syntax#single_bar)
oblique [<angle [-90deg,90deg]>](angle)[?](value_definition_syntax#question_mark)
```
Examples
--------
### Font styles
```
.normal {
font-style: normal;
}
.italic {
font-style: italic;
}
.oblique {
font-style: oblique;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Fonts Module Level 4 # font-style-prop](https://w3c.github.io/csswg-drafts/css-fonts/#font-style-prop) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `font-style` | 1 | 12 | 1
Before Firefox 44, `oblique` was not distinguished from `italic`. | 4 | 7 | 1 | 4.4 | 18 | 4
Before Firefox 44, `oblique` was not distinguished from `italic`. | 10.1 | 1 | 1.0 |
| `oblique-angle` | No | No | 61 | No | No | preview | No | No | 61 | No | No | No |
See also
--------
* [`font-family`](font-family)
* [`font-weight`](font-weight)
* [Fundamental text and font styling](https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_text/Fundamentals)
css initial initial
=======
The `initial` CSS keyword applies the [initial (or default) value](initial_value) of a property to an element. It can be applied to any CSS property, including the CSS shorthand property [`all`](all). With `all` set to `initial`, all CSS properties can be restored to their respective initial values in one go instead of restoring each one separately.
On [inherited properties](inheritance#inherited_properties), the initial value may be unexpected. You should consider using the [`inherit`](inherit), [`unset`](unset), [`revert`](revert), or [`revert-layer`](revert-layer) keywords instead.
Examples
--------
### Using initial to reset color for an element
#### HTML
```
<p>
<span>This text is red.</span>
<em>This text is in the initial color (typically black).</em>
<span>This is red again.</span>
</p>
```
#### CSS
```
p {
color: red;
}
em {
color: initial;
}
```
#### Result
With the `initial` keyword in this example, `color` value on the `em` element is restored to the initial value of [`color`](color#formal_definition), as defined in the specification.
Specifications
--------------
| Specification |
| --- |
| [CSS Cascading and Inheritance Level 4 # initial](https://w3c.github.io/csswg-drafts/css-cascade/#initial) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `initial` | 1 | 13 | 19
1-24 | No | 15 | 1.2 | 4.4 | 18 | 19
4-24 | 14 | 1 | 1.0 |
See also
--------
* Use the [`inherit`](inherit) keyword to make an element's property the same as its parent.
* Use the [`revert`](revert) keyword to reset a property to the value established by the user-agent stylesheet (or by user styles, if any exist).
* Use the [`revert-layer`](revert-layer) keyword to reset a property to the value established in a previous cascade layer.
* Use the [`unset`](unset) keyword to set a property to its inherited value if it inherits or to its initial value if not.
* The [`all`](all) property lets you reset all properties to their initial, inherited, reverted, or unset state at once.
css mask-position mask-position
=============
The `mask-position` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the initial position, relative to the mask position layer set by [`mask-origin`](mask-origin), for each defined mask image.
```
/\* Keyword values \*/
mask-position: top;
mask-position: bottom;
mask-position: left;
mask-position: right;
mask-position: center;
/\* <position> values \*/
mask-position: 25% 75%;
mask-position: 0px 0px;
mask-position: 10% 8em;
/\* Multiple values \*/
mask-position: top right;
mask-position: 1rem 1rem, center;
/\* Global values \*/
mask-position: inherit;
mask-position: initial;
mask-position: revert;
mask-position: revert-layer;
mask-position: unset;
```
Syntax
------
One or more `<position>` values, separated by commas.
### Values
[`<position>`](position_value) One to four values representing a 2D position regarding the edges of the element's box. Relative or absolute offsets can be given. Note that the position can be set outside of the element's box.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `center` |
| Applies to | all elements; In SVG, it applies to container elements excluding the [`<defs>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs) element and all graphics elements |
| [Inherited](inheritance) | no |
| Percentages | refer to size of mask painting area minus size of mask layer image (see the text for [`background-position`](background-position)) |
| [Computed value](computed_value) | Consists of two keywords representing the origin and two offsets from that origin, each given as an absolute length (if given a <length>), otherwise as a percentage. |
| Animation type | repeatable list of simple list of length, percentage, or calc |
Formal syntax
-------------
```
mask-position =
<position>[#](value_definition_syntax#hash_mark)
<position> =
[[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) right []](value_definition_syntax#brackets) [||](value_definition_syntax#double_bar) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) bottom []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) right [|](value_definition_syntax#single_bar) <length-percentage> []](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) bottom [|](value_definition_syntax#single_bar) <length-percentage> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) right []](value_definition_syntax#brackets) <length-percentage> []](value_definition_syntax#brackets) [&&](value_definition_syntax#double_ampersand) [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) bottom []](value_definition_syntax#brackets) <length-percentage> []](value_definition_syntax#brackets)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Setting mask position
Change the `mask-position` value to any of the allowed values detailed above. If viewing the example in a Chromium-based browser change the value of `-webkit-mask-position`.
Specifications
--------------
| Specification |
| --- |
| [CSS Masking Module Level 1 # the-mask-position](https://drafts.fxtf.org/css-masking/#the-mask-position) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `mask-position` | 1 | 79
18-79 | 53 | No | 15 | 15.4
3.1 | 2 | 18 | 53 | 14 | 15.4
2 | 1.0 |
See also
--------
* [Clipping and Masking in CSS](https://css-tricks.com/clipping-masking-css/)
css border-inline-color border-inline-color
===================
The `border-inline-color` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the color of the logical inline borders of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. It corresponds to the [`border-top-color`](border-top-color) and [`border-bottom-color`](border-bottom-color), or [`border-right-color`](border-right-color) and [`border-left-color`](border-left-color) property depending on the values defined for [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation).
Try it
------
The border color in the other dimension can be set with [`border-block-color`](border-block-color) which sets [`border-block-start-color`](border-block-start-color), and [`border-block-end-color`](border-block-end-color).
Syntax
------
```
border-inline-color: yellow;
border-inline-color: #f5f6f7;
/\* Global values \*/
border-inline-color: inherit;
border-inline-color: initial;
border-inline-color: revert;
border-inline-color: revert-layer;
border-inline-color: unset;
```
### Values
`<'color'>` The color of the border. See [`color`](color).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `currentcolor` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | computed color |
| Animation type | discrete |
Formal syntax
-------------
```
border-inline-color =
<'border-top-color'>[{1,2}](value_definition_syntax#curly_braces)
```
Examples
--------
### Border color with vertical text
#### HTML
```
<div>
<p class="exampleText">Example text</p>
</div>
```
#### CSS
```
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-lr;
border: 10px solid blue;
border-inline-color: red;
}
```
#### Results
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # propdef-border-inline-color](https://w3c.github.io/csswg-drafts/css-logical/#propdef-border-inline-color) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-inline-color` | 87 | 87 | 66 | No | 73 | 14.1 | 87 | 87 | 66 | 62 | 14.5 | 14.0 |
See also
--------
* [CSS Logical Properties and Values](css_logical_properties)
* This property maps to the physical border properties: [`border-top-color`](border-top-color), [`border-right-color`](border-right-color), [`border-bottom-color`](border-bottom-color), or [`border-left-color`](border-left-color).
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)+ bug 1297097
| programming_docs |
css border-end-start-radius border-end-start-radius
=======================
The `border-end-start-radius` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines a logical border radius on an element, which maps to a physical border radius depending on the element's [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation). This is useful when building styles to work regardless of the [text orientation](text-orientation) and [writing mode](css_writing_modes).
Try it
------
This property affects the corner between the block-end and the inline-start sides of the element. For instance, in a `horizontal-tb` writing mode with `ltr` direction, it corresponds to the [`border-bottom-left-radius`](border-bottom-left-radius) property.
Syntax
------
```
/\* <length> values \*/
/\* With one value the corner will be a circle \*/
border-end-start-radius: 10px;
border-end-start-radius: 1em;
/\* With two values the corner will be an ellipse \*/
border-end-start-radius: 1em 2em;
/\* Global values \*/
border-end-start-radius: inherit;
border-end-start-radius: initial;
border-end-start-radius: revert;
border-end-start-radius: revert-layer;
border-end-start-radius: unset;
```
### Values
`<length-percentage>` Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS [`<length>`](length) data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements; but User Agents are not required to apply to `table` and `inline-table` elements when [`border-collapse`](border-collapse) is `collapse`. The behavior on internal table elements is undefined for the moment.. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| Percentages | refer to the corresponding dimension of the border box |
| [Computed value](computed_value) | two absolute [`<length>`](length)s or [`<percentage>`](percentage)s |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
border-end-start-radius =
<'border-top-left-radius'>
```
Examples
--------
### Border radius with vertical text
#### HTML
```
<div>
<p class="exampleText">Example</p>
</div>
```
#### CSS
```
div {
background-color: rebeccapurple;
width: 120px;
height: 120px;
border-end-start-radius: 10px;
}
.exampleText {
writing-mode: vertical-rl;
padding: 10px;
background-color: #fff;
border-end-start-radius: 10px;
}
```
#### Results
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # border-radius-properties](https://w3c.github.io/csswg-drafts/css-logical/#border-radius-properties) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-end-start-radius` | 89 | 89 | 66 | No | 75 | 15 | 89 | 89 | 66 | No | 15 | 15.0 |
See also
--------
* [CSS Logical Properties and Values](css_logical_properties)
* The mapped physical property: [`border-top-right-radius`](border-top-right-radius)
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)
css image-rendering image-rendering
===============
The `image-rendering` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets an image scaling algorithm. The property applies to an element itself, to any images set in its other properties, and to its descendants.
Try it
------
The [user agent](https://developer.mozilla.org/en-US/docs/Glossary/User_agent) will scale an image when the page author specifies dimensions other than its natural size. Scaling may also occur due to user interaction (zooming). For example, if the natural size of an image is `100×100px`*,* but its actual dimensions are `200×200px` (or `50×50px`), then the image will be upscaled (or downscaled) using the algorithm specified by `image-rendering`. This property has no effect on non-scaled images.
Syntax
------
```
/\* Keyword values \*/
image-rendering: auto;
image-rendering: crisp-edges;
image-rendering: pixelated;
/\* Global values \*/
image-rendering: inherit;
image-rendering: initial;
image-rendering: revert;
image-rendering: revert-layer;
image-rendering: unset;
```
### Values
`auto` The scaling algorithm is UA dependent. Since version 1.9 (Firefox 3.0), Gecko uses *bilinear* resampling (high quality).
`smooth` Experimental
The image should be scaled with an algorithm that maximizes the appearance of the image. In particular, scaling algorithms that "smooth" colors are acceptable, such as bilinear interpolation. This is intended for images such as photos.
`high-quality` Experimental
Identical to `smooth`, but with a preference for higher-quality scaling. If system resources are constrained, images with `high-quality` should be prioritized over those with any other value, when considering which images to degrade the quality of and to what degree.
`crisp-edges` The image is scaled with the nearest-neighbor algorithm.
`pixelated` Using the nearest-neighbor algorithm, the image is scaled up to the next integer multiple that is greater than or equal to its original size, then scaled down to the target size, as for `smooth`. When scaling up to integer multiples of the original size, this will have the same effect as `crisp-edges`.
**Note:** The values `optimizeQuality` and `optimizeSpeed` present in an early draft (and coming from its SVG counterpart `[image-rendering](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/image-rendering)`) are defined as synonyms for the `smooth` and `pixelated` values respectively.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | all elements |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
image-rendering =
auto [|](value_definition_syntax#single_bar)
smooth [|](value_definition_syntax#single_bar)
high-quality [|](value_definition_syntax#single_bar)
pixelated [|](value_definition_syntax#single_bar)
crisp-edges
```
Examples
--------
### Setting image scaling algorithms
In practical use, the `pixelated` and `crisp-edges` rules can be combined to provide some fallback for each other. (Just prepend the actual rules with the fallback.) The [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) can provide a [fallback solution for `pixelated`](http://phrogz.net/tmp/canvas_image_zoom.html) through manual image data manipulation or with [`imageSmoothingEnabled`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled).
#### CSS
```
.auto {
image-rendering: auto;
}
.pixelated {
image-rendering: pixelated;
}
.crisp-edges {
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Images Module Level 3 # the-image-rendering](https://w3c.github.io/csswg-drafts/css-images/#the-image-rendering) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `image-rendering` | 13 | 79 | 3.6 | No | 15 | 6 | 3 | 18 | 4 | 14 | 6 | 1.0 |
| `crisp-edges` | 13 | 79 | 65
3.6 | No | 15 | 7
6 | ≤37 | 18 | 65
4 | 14 | 7
6 | 1.0 |
| `optimizeQuality` | 28 | 79 | 3.6 | No | 15 | 7 | 4.4 | 28 | 4 | 14 | 7 | 1.5 |
| `optimizeSpeed` | 28 | 79 | 3.6 | No | 15 | 7 | 4.4 | 28 | 4 | 14 | 7 | 1.5 |
| `pixelated` | 41 | 79 | 93 | No | 26 | 10 | 41 | 41 | 93 | 26 | 10 | 4.0 |
**Note:** Although `crisp-edges` is supposed to use a pixel-art scaler like in the specification example, in practice no browsers (as of January 2020) do so. [In Firefox](https://searchfox.org/mozilla-central/rev/1061fae5e225a99ef5e43dbdf560a91a0c0d00d1/gfx/wr/webrender/src/resource_cache.rs#1356), `crisp-edges` is interpreted as nearest-neighbor, `pixelated` is not supported, and `auto` is interpolated as trilinear or linear.
For behavior on Chromium and Safari (WebKit), see the [`GetInterpolationQuality`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/style/computed_style.cc;l=1160) function and [`CSSPrimitiveValue::operator ImageRendering()`](https://github.com/WebKit/WebKit/blob/9b26fc6081e0db8a1304cf4b4f8f1c67efb9bc0c/Source/WebCore/css/CSSPrimitiveValueMappings.h#L4045) respectively.
See also
--------
* Other image-related CSS properties: [`object-fit`](object-fit), [`object-position`](object-position), [`image-orientation`](image-orientation), [`image-rendering`](image-rendering), [`image-resolution`](image-resolution).
css Specificity Specificity
===========
**Specificity** is the algorithm used by browsers to determine the [CSS declaration](https://developer.mozilla.org/en-US/docs/Learn/CSS/First_steps/What_is_CSS#css_syntax) that is the most relevant to an element, which in turn, determines the property value to apply to the element. The specificity algorithm calculates the weight of a [CSS selector](reference#selectors) to determine which rule from competing CSS declarations gets applied to an element.
**Note:** Browsers consider specificity **after** determining [cascade origin and importance](cascade). In other words, for competing property declarations, specificity is relevant and compared only between selectors from the one [cascade origin and layer](@layer) that has precedence for the property. Order of appearance becomes relevant when the selector specificities of the competing declarations in the cascade layer with precedence are equal.
How is specificity calculated?
------------------------------
Specificity is an algorithm that calculates the weight that is applied to a given CSS declaration. The weight is determined by the number of [selectors of each weight category](#selector-weight-categories) in the selector matching the element (or pseudo-element). If there are two or more declarations providing different property values for the same element, the declaration value in the style block having the matching selector with the greatest algorithmic weight gets applied.
The specificity algorithm is basically a three-column value of three categories or weights - ID, CLASS, and TYPE - corresponding to the three types of selectors. The value represents the count of selector components in each weight category and is written as *ID - CLASS - TYPE*. The three columns are created by counting the number of selector components for each selector weight category in the selectors that match the element.
### Selector weight categories
The selector weight categories are listed here in the order of decreasing specificity:
ID column Includes only [ID selectors](id_selectors), such as `#example`. For each ID in a matching selector, add 1-0-0 to the weight value.
CLASS column Includes [class selectors](class_selectors), such as `.myClass`, attribute selectors like `[type="radio"]` and `[lang|="fr"]`, and pseudo-classes, such as `:hover`, `:nth-of-type(3n)`, and `:required`. For each class, attribute selector, or pseudo-class in a matching selector, add 0-1-0 to the weight value.
TYPE column Includes [type selectors](type_selectors), such as `p`, `h1`, and `td`, and pseudo-elements like `::before`, `::placeholder`, and all other selectors with double-colon notation. For each type or pseudo-element in a matching selector, add 0-0-1 to the weight value.
No value The universal selector ([`*`](universal_selectors)) and the pseudo-class [`:where()`](:where) and its parameters aren't counted when calculating the weight so their value is 0-0-0, but they do match elements. These selectors do not impact the specificity weight value.
Combinators, such as [`+`](adjacent_sibling_combinator), [`>`](child_combinator), [`~`](general_sibling_combinator), [" "](descendant_combinator), and [`||`](column_combinator), may make a selector more specific in what is selected but they don't add any value to the specificity weight.
The negation pseudo-class, [`:not()`](:not), itself has no weight. Neither do the [`:is()`](:is) or the [`:has()`](:has) pseudo-classes. The parameters in these selectors, however, do. The values of both come from the parameter in the list of parameters that has the highest specificity. The [`:not()`, `:is()` and `:has()` exceptions](#the-is-not-and-has-exceptions) are discussed below.
#### Matching selector
The specificity weight comes from the matching selector. Take this CSS selector with three comma-separated selectors as an example:
```
[type="password"],
input:focus,
:root #myApp input:required {
color: blue;
}
```
The `[type="password"]` selector in the above selector list, with a specificity weight of `0-1-0`, applies the `color: blue` declaration to all password input types.
All inputs, no matter the type, when receiving focus, match the second selector in the list, `input:focus`, with a specificity weight of `0-1-1`; this weight is made up of the `:focus` pseudo-class (0-1-0) and the `input` type (0-0-1). If the password input has focus, it will match `input:focus`, and the specificity weight for the `color: blue` style declaration will be `0-1-1`. When that password doesn't have focus, the specificity weight remains at `0-1-0`.
The specificity for a required input nested in an element with attribute `id="myApp"` is `1-2-1`, based on one ID, two pseudo-classes, and one element type.
If the password input type is nested in an element with `id="myApp"` set, the specificity weight will be `1-2-1`, whether or not it has focus. Why is the specificity weight `1-2-1` rather than `0-1-1` or `0-1-0` in this case? Because the specificity weight comes from the matching selector with the greatest specificity weight. The weight is determined by comparing the values in the three columns, from left to right.
```
[type="password"] /\* 0-1-0 \*/
input:focus /\* 0-1-1 \*/
:root #myApp input:required /\* 1-2-1 \*/
```
### Three-column comparison
Once the specificity values of the relevant selectors are determined, the number of selector components in each column are compared, from left to right.
```
#myElement {
color: green; /\* 1-0-0 - WINS!! \*/
}
.bodyClass .sectionClass .parentClass [id="myElement"] {
color: yellow; /\* 0-4-0 \*/
}
```
The first column is the value of the *ID* component, which is the number of IDs in each selector. The numbers in the *ID* columns of competing selectors are compared. The selector with the greater value in the *ID* column wins no matter what the values are in the other columns. In the above example, even though the yellow selector has more components in total, only the value of the first column matters.
If the number in the *ID* columns of competing selectors is the same, then the next column, *CLASS*, is compared, as shown below.
```
#myElement {
color: yellow; /\* 1-0-0 \*/
}
#myApp [id="myElement"] {
color: green; /\* 1-1-0 - WINS!! \*/
}
```
The *CLASS* column is the count of class names, attribute selectors, and pseudo-classes in the selector. When the *ID* column value is the same, the selector with the greater value in the *CLASS* column wins, no matter the value in the *TYPE* column. This is shown in the example below.
```
:root input {
color: green; /\* 0-1-1 - WINS because CLASS column is greater \*/
}
html body main input {
color: yellow; /\* 0-0-4 \*/
}
```
If the numbers in the *CLASS* and *ID* columns in competing selectors are the same, the *TYPE* column becomes relevant. The *TYPE* column is the number of element types and pseudo-elements in the selector. When the first two columns have the same value, the selector with the greater number in the *TYPE* column wins.
If the competing selectors have the same values in all the three columns, the proximity rule comes into play, wherein the last declared style gets precedence.
```
input.myClass {
color: yellow; /\* 0-1-1 \*/
}
:root input {
color: green; /\* 0-1-1 WINS because it comes later \*/
}
```
### The `:is()`, `:not()` and `:has()` exceptions
The matches-any pseudo-class [`:is()`](:is), the relational pseudo-class [`:has()`](:has), and the negation pseudo-class [`:not()`](:not) are *not* considered as pseudo-classes in the specificity weight calculation. They themselves don't add any weight to the specificity equation. However, the selector parameters passed into the pseudo-class parenthesis are part of the specificity algorithm; the weight of the matches-any and negation pseudo-class in the specificity value calculation is the weight of the parameter's [weight](#selector_weight_categories).
```
p {
/\* 0-0-1 \*/
}
:is(p) {
/\* 0-0-1 \*/
}
h2:nth-last-of-type(n + 2) {
/\* 0-1-1 \*/
}
h2:has(~ h2) {
/\* 0-0-2 \*/
}
div.outer p {
/\* 0-1-2 \*/
}
div:not(.inner) p {
/\* 0-1-2 \*/
}
```
Note that in the above CSS pairing, the specificity weight provided by the `:is()`, `:has()` and `:not()` pseudo-classes is the value of the selector parameter, not of the pseudo-class.
All three of these pseudo-classes accept complex selector lists, a list of comma-separated selectors, as a parameter. This feature can be used to increase a selector's specificity:
```
:is(p, #fakeId) {
/\* 1-0-0 \*/
}
h1:has(+ h2, > #fakeId) {
/\* 1-0-1 \*/
}
p:not(#fakeId) {
/\* 1-0-1 \*/
}
div:not(.inner, #fakeId) p {
/\* 1-0-2 \*/
}
```
In the above CSS code block, we have included `#fakeId` in the selectors. This `#fakeId` adds `1-0-0` to the specificity weight of each paragraph.
Generally, you want to keep specificity down to a minimum, but if you need to increase an element's specificity for a particular reason, these three pseudo-classes can help.
```
a:not(#fakeId#fakeId#fakeID) {
color: blue; /\* 3-0-1 \*/
}
```
In this example, all links will be blue, unless overridden by a link declaration with 3 or more IDs, a color value matching an `a` includes the [`!important` flag](#the-important-exception), or if the link has an [inline style](#inline-styles) color declaration. If you use such a technique, add a comment to explain why the hack was needed.
### Inline styles
Inline styles added to an element (e.g., `style="font-weight: bold;"`) always overwrite any normal styles in author stylesheets, and therefore, can be thought of as having the highest specificity. Think of inline styles as having a specificity weight of `1-0-0-0`.
The only way to override inline styles is by using `!important`.
Many JavaScript frameworks and libraries add inline styles. Using `!important` with a very targeted selector, such as an attribute selector using the inline style, is one way to override these inline styles.
```
<p style="color: purple">…</p>
```
```
p[style\*="purple"] {
color: rebeccapurple !important;
}
```
Make sure to include a comment with every inclusion of the important flag so code maintainers understand why a CSS anti-pattern was used.
### The `!important` exception
CSS declarations marked as important override any other declarations within the same cascade layer and origin. Although technically, [`!important`](important) has nothing to do with specificity, it interacts directly with specificity and the cascade. It reverses the <cascade> order of stylesheets.
If declarations from the same origin and cascade layer conflict and one property value has the `!important` flag set, the important declaration is applied no matter the specificity. When conflicting declarations from the same origin and cascade layer with the `!important` flag are applied to the same element, the declaration with a greater specificity is applied.
Using `!important` to override specificity is considered a **bad practice** and should be avoided for this purpose. Understanding and effectively using specificity and the cascade can remove any need for the `!important` flag.
Instead of using `!important` to override foreign CSS (from external libraries, like Bootstrap or normalize.css), import the third-party scripts directly into [cascade layers](@layer). If you must use `!important` in your CSS, comment your usage so future code maintainers know why the declaration was marked important and know not to override it. But definitely, don't use `!important` when writing plugins or frameworks that other developers will need to incorporate without being able to control.
### The `:where()` exception
The specificity-adjustment pseudo-class [`:where()`](:where) always has its specificity replaced with zero, `0-0-0`. It enables making CSS selectors very specific in what element is targeted without any increase to specificity.
In creating third-party CSS to be used by developers who don't have access to edit your CSS, it's considered a good practice to create CSS with the lowest possible specificity. For example, if your theme includes the following CSS:
```
:where(#defaultTheme) a {
/\* 0-0-1 \*/
color: red;
}
```
Then the developer implementing the widget can easily override the link color using only type selectors.
```
footer a {
/\* 0-0-2 \*/
color: blue;
}
```
Tips for handling specificity headaches
---------------------------------------
Instead of using `!important`, consider using cascade layers and using low weight specificity throughout your CSS so that styles are easily overridden with slightly more specific rules. Using semantic HTML helps provide anchors from which to apply styling.
### Making selectors specific with and without adding specificity
By indicating the section of the document you're styling before the element you're selecting, the rule becomes more specific. Depending on how you add it, you can add some, a lot, or no specificity, as shown below:
```
<main id="myContent">
<h1>Text</h1>
</main>
```
```
#myContent h1 {
color: green; /\* 1-0-1 \*/
}
[id="myContent"] h1 {
color: yellow; /\* 0-1-1 \*/
}
:where(#myContent) h1 {
color: blue; /\* 0-0-1 \*/
}
```
No matter the order, the heading will be green because that rule is the most specific.
#### Reducing ID specificity
Specificity is based on the form of a selector. Including the `id` of an element as an attribute selector rather than an id selector is a good way to make an element more specific without adding an overabundance of specificity. In the previous example, the selector `[id="myContent"]` counts as an attribute selector for the purpose of determining the selector's specificity, even though it selects an ID.
You can also include the `id` or any part of a selector as a parameter in the `:where()` specificity-adjustment pseudo class if you need to make a selector more specific but don't want to add any specificity at all.
### Increasing specificity by duplicating selector
As a special case for increasing specificity, you can duplicate weights from the *CLASS* or *ID* columns. Duplicating id, class, pseudo-class or attribute selectors within a compound selector will increase specificity when overriding very specific selectors over which you have no control.
```
#myId#myId#myId span {
/\* 3-0-1 \*/
}
.myClass.myClass.myClass span {
/\* 0-3-1 \*/
}
```
Use this sparingly, if at all. If using selector duplication, always comment your CSS.
By using `:is()` and `:not()` (and also `:has()`), you can increase specificity even if you can't add an `id` to a parent element:
```
:not(#fakeID#fakeId#fakeID) span {
/\* 3-0-1 \*/
}
:is(#fakeID#fakeId#fakeID, span) {
/\* 3-0-0 \*/
}
```
### Precedence over third-party CSS
Leveraging cascade layers is the standard way of enabling one set of styles to take precedence over another set of styles; cascade layers enable this without using specificity! Normal (not important) author styles imported into cascade layers have lower precedence than unlayered author styles.
If styles are coming from a stylesheet you can't edit or don't understand and you need to override styles, a strategy is to import the styles you don't control into a cascade layer. Styles in subsequently declared layers take precedence, with unlayered styles having precedence over all layered styles from the same origin.
When two selectors from different layers match the same element, origin and importance take precedence; the specificity of the selector in the losing stylesheet is irrelevant.
```
<style>
@import TW.css layer();
p,
p \* {
font-size: 1rem;
}
</style>
```
In the above example, all paragraph text, including the nested content, will be `1rem` no matter how many class names the paragraphs have that match the TW stylesheet.
### Avoiding and overriding `!important`
The best approach is to not use `!important`. The above explanations on specificity should be helpful in avoiding using the flag and removing it altogether when encountered.
To remove the perceived need for `!important`, you can do one of the following:
* Increase the specificity of the selector of the formerly `!important` declaration so that it is greater than other declarations
* Give it the same specificity and put it after the declaration it is meant to override
* Reduce the specificity of the selector you are trying to override.
All these methods are covered in preceding sections.
If you're unable to remove `!important` flags from an authors style sheet, the only solution to overriding the important styles is by using `!important`. Creating a [cascade layer](@layer) of important declaration overrides is an excellent solution. Two ways of doing this include:
#### Method 1
1. Create a separate, short style sheet containing only important declarations specifically overriding any important declarations you were unable to remove.
2. Import this stylesheet as the first import in your CSS using `layer()`, including the `@import` statement, before linking to other stylesheets. This is to ensure that the important overrides is imported as the first layer.
```
<style>
@import importantOverrides.css layer();
</style>
```
#### Method 2
1. At the beginning of your stylesheet declarations, create a named cascade layer, like so:
```
@layer importantOverrides;
```
2. Each time you need to override an important declaration, declare it within the named layer. Only declare important rules within the layer.
```
[id="myElement"] p {
/\* normal styles here \*/
}
@layer importantOverrides {
[id="myElement"] p {
/\* important style here \*/
}
}
```
The specificity of the selector of the important style within the layer can be low, as long as it matches the element you are trying to override. Normal layers should be declared outside the layer because layered styles have lower precedence than unlayered styles.
### Tree proximity ignorance
The proximity of an element to other elements that are referenced in a given selector has no impact on specificity.
```
body h1 {
color: green;
}
html h1 {
color: purple;
}
```
The `<h1>` elements will be purple because when declarations have the same specificity, the last declared selector has precedence.
### Directly targeted elements vs. inherited styles
Styles for a directly targeted element will always take precedence over inherited styles, regardless of the specificity of the inherited rule. Given the following CSS and HTML:
```
#parent {
color: green;
}
h1 {
color: purple;
}
```
```
<html lang="en">
<body id="parent">
<h1>Here is a title!</h1>
</body>
</html>
```
The `h1` will be purple because the `h1` selector targets the element specifically, while the green is inherited from the `#parent` declarations.
Examples
--------
In the following CSS, we have three selectors targeting [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) elements to set a color. For a given input, the specificity weight of the color declaration having precedence is the matching selector with the greatest weight:
```
#myElement input.myClass {
color: red;
} /\* 1-1-1 \*/
input[type="password"]:required {
color: blue;
} /\* 0-2-1 \*/
html body main input {
color: green;
} /\* 0-0-4 \*/
```
If the above selectors all target the same input, the input will be red, as the first declaration has the highest value in the *ID* column.
The last selector has four *TYPE* components. While it has the highest integer value, no matter how many elements and pseudo-elements are included, even if there were 150, TYPE components never have precedence over *CLASS* components. The column values are compared starting from left to right when column values are equal.
Had we converted the id selector in the example code above to an attribute selector, the first two selectors would have the same specificity, as shown below:
```
[id="myElement"] input.myClass {
color: red;
} /\* 0-2-1 \*/
input[type="password"]:required {
color: blue;
} /\* 0-2-1 \*/
```
When multiple declarations have equal specificity, the last declaration found in the CSS is applied to the element. If both selectors match the same [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input), the color will be blue.
Additional notes
----------------
A few things to remember about specificity:
1. Specificity only applies when the same element is targeted by multiple declarations in the same cascade layer or origin. Specificity only matters for declarations of the same importance and same origin and [cascade layer](@layer). If matching selectors are in different origins, the <cascade> determines which declaration takes precedence.
2. When two selectors in the same cascade layer and origin have the same specificity, proximity is important; the last selector wins.
3. As per CSS rules, [directly targeted elements](#directly_targeted_elements_vs._inherited_styles) will always take precedence over rules which an element inherits from its ancestor.
4. [Proximity of elements](#tree_proximity_ignorance) in the document tree has no effect on the specificity.
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # specificity-rules](https://drafts.csswg.org/selectors/#specificity-rules) |
See also
--------
* ["Specificity" in "Cascade and inheritance"](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance#specificity_2)
* [SpeciFISHity](https://specifishity.com)
* [Specificity Calculator](https://specificity.keegan.st/): An interactive website to test and understand your own CSS rules
* [*ID-CLASS-TYPE* exercise](https://estelle.github.io/CSS/selectors/exercises/specificity.html) a specificity quiz
* CSS key concepts:
+ [CSS syntax](syntax)
+ [At-rules](at-rule)
+ [Comments](comments)
+ [Inheritance](inheritance)
+ [Box model](css_box_model/introduction_to_the_css_box_model)
+ [Layout modes](layout_mode)
+ [Visual formatting models](visual_formatting_model)
+ [Margin collapsing](css_box_model/mastering_margin_collapsing)
+ Values
- [Initial values](initial_value)
- [Computed values](computed_value)
- [Used values](used_value)
- [Actual values](actual_value)
+ [Value definition syntax](value_definition_syntax)
+ [Shorthand properties](shorthand_properties)
+ [Replaced elements](replaced_element)
| programming_docs |
css CSS Text Decoration CSS Text Decoration
===================
**CSS Text Decoration** is a module of CSS that defines features relating to text decoration, such as underlines, text shadows, and emphasis marks.
Reference
---------
### Properties
* [`text-decoration`](text-decoration)
* [`text-decoration-color`](text-decoration-color)
* [`text-decoration-line`](text-decoration-line)
* [`text-decoration-skip-ink`](text-decoration-skip-ink)
* [`text-decoration-style`](text-decoration-style)
* [`text-decoration-thickness`](text-decoration-thickness)
* [`text-emphasis`](text-emphasis)
* [`text-emphasis-color`](text-emphasis-color)
* [`text-emphasis-position`](text-emphasis-position)
* [`text-emphasis-style`](text-emphasis-style)
* [`text-shadow`](text-shadow)
* [`text-underline-offset`](text-underline-offset)
* [`text-underline-position`](text-underline-position)
Examples
--------
```
.under {
text-decoration: underline red;
}
.over {
text-decoration: wavy overline lime;
}
.line {
text-decoration: line-through;
}
.plain {
text-decoration: none;
}
.underover {
text-decoration: dashed underline overline;
}
.thick {
text-decoration: solid underline purple 4px;
}
.blink {
text-decoration: blink;
}
```
```
<p class="under">This text has a line underneath it.</p>
<p class="over">This text has a line over it.</p>
<p class="line">This text has a line going through it.</p>
<p>
This <a class="plain" href="#">link will not be underlined</a>, as links
generally are by default. Be careful when removing the text decoration on
anchors since users often depend on the underline to denote hyperlinks.
</p>
<p class="underover">This text has lines above <em>and</em> below it.</p>
<p class="thick">
This text has a really thick purple underline in supporting browsers.
</p>
<p class="blink">
This text might blink for you, depending on the browser you use.
</p>
```
Specifications
--------------
| Specification |
| --- |
| [CSS Text Decoration Module Level 3](https://drafts.csswg.org/css-text-decor/) |
css ::first-letter ::first-letter
==============
The `::first-letter` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-element](pseudo-elements) applies styles to the first letter of the first line of a [block-level element](visual_formatting_model#block-level_elements_and_block_boxes), but only when not preceded by other content (such as images or inline tables).
Try it
------
The first letter of an element is not always trivial to identify:
* Punctuation that precedes or immediately follows the first letter is included in the match. Punctuation includes any Unicode character defined in the *open* (Ps), *close* (Pe), *initial quote* (Pi), *final quote* (Pf), and *other punctuation* (Po) classes.
* Some languages have digraphs that are always capitalized together, like the `IJ` in Dutch. In these cases, both letters of the digraph should be matched by the `::first-letter` pseudo-element.
* A combination of the [`::before`](::before) pseudo-element and the [`content`](content) property may inject some text at the beginning of the element. In that case, `::first-letter` will match the first letter of this generated content.
**Note:** CSS introduced the `::first-letter` notation (with two colons) to distinguish <pseudo-classes> from <pseudo-elements>. For backward compatibility, browsers also accept `:first-letter`, introduced earlier.
Browser support for digraphs such as `IJ` in Dutch is poor. Check the compatibility table below to see the current state of support.
Allowable properties
--------------------
Only a small subset of CSS properties can be used with the `::first-letter` pseudo-element:
* All font properties: [`font`](font), [`font-style`](font-style), [`font-feature-settings`](font-feature-settings), [`font-kerning`](font-kerning), [`font-language-override`](font-language-override), [`font-stretch`](font-stretch), [`font-synthesis`](font-synthesis), [`font-variant`](font-variant), [`font-variant-alternates`](font-variant-alternates), [`font-variant-caps`](font-variant-caps), [`font-variant-east-asian`](font-variant-east-asian), [`font-variant-ligatures`](font-variant-ligatures), [`font-variant-numeric`](font-variant-numeric), [`font-variant-position`](font-variant-position), [`font-weight`](font-weight), [`font-size`](font-size), [`font-size-adjust`](font-size-adjust), [`line-height`](line-height) and [`font-family`](font-family)
* All background properties: [`background`](background), [`background-color`](background-color), [`background-image`](background-image), [`background-clip`](background-clip), [`background-origin`](background-origin), [`background-position`](background-position), [`background-repeat`](background-repeat), [`background-size`](background-size), [`background-attachment`](background-attachment), and [`background-blend-mode`](background-blend-mode)
* All margin properties: [`margin`](margin), [`margin-top`](margin-top), [`margin-right`](margin-right), [`margin-bottom`](margin-bottom), [`margin-left`](margin-left)
* All padding properties: [`padding`](padding), [`padding-top`](padding-top), [`padding-right`](padding-right), [`padding-bottom`](padding-bottom), [`padding-left`](padding-left)
* All border properties: the shorthands [`border`](border), [`border-style`](border-style), [`border-color`](border-color), [`border-width`](border-width), [`border-radius`](border-radius), [`border-image`](border-image), and the longhands properties
* The [`color`](color) property
* The [`text-decoration`](text-decoration), [`text-shadow`](text-shadow), [`text-transform`](text-transform), [`letter-spacing`](letter-spacing), [`word-spacing`](word-spacing) (when appropriate), [`line-height`](line-height), [`text-decoration-color`](text-decoration-color), [`text-decoration-line`](text-decoration-line), [`text-decoration-style`](text-decoration-style), [`box-shadow`](box-shadow), [`float`](float), [`vertical-align`](vertical-align) (only if `float` is `none`) CSS properties
Syntax
------
```
::first-letter
```
Examples
--------
### Simple drop cap
In this example we will use the `::first-letter` pseudo-element to create a simple drop cap effect on the first letter of the paragraph coming right after the `<h2>`.
#### HTML
```
<h2>My heading</h2>
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
kasd gubergren, no sea takimata sanctus est.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
consequat.
</p>
```
#### CSS
```
p {
width: 500px;
line-height: 1.5;
}
h2 + p::first-letter {
color: white;
background-color: black;
border-radius: 2px;
box-shadow: 3px 3px 0 red;
font-size: 250%;
padding: 6px 3px;
margin-right: 6px;
float: left;
}
```
#### Result
### Effect on special punctuation and non-Latin characters
This example illustrates the effect of `::first-letter` on special punctuation and non-Latin characters.
#### HTML
```
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
consequat.
</p>
<p>-The beginning of a special punctuation mark.</p>
<p>_The beginning of a special punctuation mark.</p>
<p>"The beginning of a special punctuation mark.</p>
<p>'The beginning of a special punctuation mark.</p>
<p>*The beginning of a special punctuation mark.</p>
<p>#The beginning of a special punctuation mark.</p>
<p>「特殊的汉字标点符号开头。</p>
<p>《特殊的汉字标点符号开头。</p>
<p>"特殊的汉字标点符号开头。</p>
```
#### CSS
```
p::first-letter {
color: red;
font-size: 150%;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Pseudo-Elements Module Level 4 # first-letter-pseudo](https://w3c.github.io/csswg-drafts/css-pseudo/#first-letter-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `::first-letter` | 1
1 | 12
12 | 1
1 | 9
5.5 | 7
3.5 | 1
1 | 37
37 | 18
18 | 4
4 | 10.1
10.1 | 1
1 | 1.0
1.0 |
| `dutch_ij_digraph` | No | No | 87 | No | No | No | No | No | 87 | No | No | No |
See also
--------
* [`::first-line`](::first-line)
css :user-invalid (:-moz-ui-invalid) :user-invalid (:-moz-ui-invalid)
================================
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `:user-invalid` CSS [pseudo-class](pseudo-classes) represents any validated form element whose value isn't valid based on their [validation constraints](https://developer.mozilla.org/en-US/docs/Learn/Forms#constraint_validation), after the user has interacted with it.
The `:user-invalid` pseudo-class must match an [`:invalid`](:invalid), [`:out-of-range`](:out-of-range), or blank-but [`:required`](:required) element between the time the user has attempted to submit the form and before the user has interacted again with the form element.
**Note:** The pseudo-class behaves in the same way as the non-standard `:-moz-ui-invalid` pseudo-class.
Syntax
------
```
:user-invalid
```
Examples
--------
### Setting a color and symbol on :user-invalid
In the following example, the red border and ❌ only display once the user has interacted with the field. Try typing something other than an email address to see it in action.
```
<form>
<label for="email">Email *: </label>
<input id="email" name="email" type="email" required />
<span></span>
</form>
```
```
input:user-invalid {
border: 2px solid red;
}
input:user-invalid + span::before {
content: "✖";
color: red;
}
```
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # user-invalid-pseudo](https://w3c.github.io/csswg-drafts/selectors/#user-invalid-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:user-invalid` | No
See [bug 1156069](https://crbug.com/1156069). | No
See [bug 1156069](https://crbug.com/1156069). | 88
4 | No | No
See [bug 1156069](https://crbug.com/1156069). | No
See [bug 222267](https://webkit.org/b/222267). | No
See [bug 1156069](https://crbug.com/1156069). | No
See [bug 1156069](https://crbug.com/1156069). | 88
4 | No
See [bug 1156069](https://crbug.com/1156069). | No
See [bug 222267](https://webkit.org/b/222267). | No
See [bug 1156069](https://crbug.com/1156069). |
See also
--------
* [`:valid`](:valid)
* [`:invalid`](:invalid)
* [`:required`](:required)
* [`:optional`](:optional)
* [`:user-valid`](:user-valid)
css CSS values and units CSS values and units
====================
Every CSS declaration includes a property / value pair. Depending on the property, the value can include a single integer or keyword, to a series of keywords and values with or without units. There are a common set of data types — values and units — that CSS properties accept. Below is an overview of most of these data types. Refer to the page for each value type for more detailed information.
Textual data types
------------------
* [`<custom-ident>`](custom-ident)
* Pre-defined keywords as an `<ident>`
* [`<string>`](string)
* [`url()`](url)
Text data types are either `<string>`, a quoted series of characters, or an `<ident>`, a "CSS Identifier" which is an unquoted string. A `<string>` must be quoted with either single or double quotes. CSS Identifiers, listed in the specifications as `<ident>` or `<custom-ident>`, must be unquoted.
In the CSS specifications, values that can be defined by the web developer, like keyframe animations, font-family names, or grid areas are listed as a [`<custom-ident>`](custom-ident), [`<string>`](string), or both.
When both quoted and unquoted user defined text values are permitted, the specification will list `<custom-ident> | <string>`, meaning quotes are optional, such as is the case with animation names:
```
@keyframe validIdent {
/\* keyframes go here \*/
}
@keyframe 'validString' {
/\* keyframes go here \*/
}
```
Some text values are not valid if encompassed in quotes. For example, the value of [`grid-area`](grid-area) can be a `<custom-ident>`, so if we had a grid area named `content` we would use it without quotes:
```
.item {
grid-area: content;
}
```
In comparison, a data type that is a [`<string>`](string), such as a string value of the [`content`](content) property, must be quoted:
```
.item::after {
content: "This is my content.";
}
```
While you can generally create any name you want, including using emojis, the identifier can't be `none`, `unset`, `initial`, or `inherit`, start with a digit or two dashes, and generally you don't want it to be any other pre-defined CSS keyword. See the [`<custom-ident>`](custom-ident) and [`<string>`](string) reference pages for more details.
### Pre-defined keyword values
Pre-defined keywords are text values defined by the specification for that property. These keywords are also CSS Identifiers and are therefore used without quotes.
When viewing CSS property value syntax in a CSS specification or the MDN property page, allowable keywords will be listed in the following form. The following values are the pre-defined keyword values allowed for [`float`](float).
```
left | right | none | inline-start | inline-end
```
Such values are used without quotes:
```
.box {
float: left;
}
```
### CSS-wide values
In addition to the pre-defined keywords that are part of the specification for a property, all CSS properties accept the CSS-wide property values [`initial`](initial), [`inherit`](inherit), and [`unset`](unset), which explicitly specify defaulting behaviors.
The `initial` keyword represents the value specified as the property's initial value. The `inherit` keyword represents the computed value of the property on the element's parent, provided it is inherited.
The `unset` keyword acts as either `inherit` or `initial`, depending on whether the property is inherited or not.
A fourth value of [`revert`](revert) was added in the Cascade Level 4 specification, but it does not currently have good browser support.
### URLs
A [`url()`](url) type uses functional notation, which accepts a `<string>` that is a URL. This may be an absolute URL or a relative URL. For example, if you wanted to include a background image, you might use either of the following.
```
.box {
background-image: url("images/my-background.png");
}
.box {
background-image: url("https://www.exammple.com/images/my-background.png");
}
```
The parameter for `url()` can be either quoted or unquoted. If unquoted, it is parsed as a `<url-token>`, which has extra requirements including the escaping of certain characters. See [`url()`](url) for more information.
Numeric data types
------------------
* [`<integer>`](integer)
* [`<number>`](number)
* [`<dimension>`](dimension)
* [`<percentage>`](percentage)
### Integers
An integer is one or more decimal digits, `0` through `9`, such as `1024` or `-55`. An integer may be preceded by a `+` or `-` symbol, with no space between the symbol and the integer.
### Numbers
A [`<number>`](number) represents a real number, which may or may not have a decimal point with a fractional component, for example `0.255`, `128` or `-1.2`. Numbers may also be preceded by a `+` or `-` symbol.
### Dimensions
A [`<dimension>`](dimension) is a `<number>` with a unit attached to it, for example `45deg`, `100ms`, or `10px`. The attached unit identifier is case insensitive. There is never a space or any other characters between a the number and the unit identifier: i.e. `1 cm` is not valid.
CSS uses dimensions to specify:
* [`<length>`](length) (Distance units)
* [`<angle>`](angle)
* [`<time>`](time)
* [`<frequency>`](frequency)
* [`<flex>`](flex_value)
* [`<resolution>`](resolution)
These are all covered in subsections below.
#### Distance units
Where a distance unit, also known as a length, is allowed as a value for a property, this is described as the [`<length>`](length) type. There are two types of lengths in CSS: relative and absolute.
Relative length units specify a length in relation to something else. For example, `em` is relative to the font size on the element and `vh` is relative to the viewport height.
| Unit | Relative to |
| --- | --- |
| `em` | Font size of the element. |
| `ex` | x-height of the element's font. |
| `cap` | Cap height (the nominal height of capital letters) of the element's font. |
| `ch` | Average character advance of a narrow glyph in the element's font, as represented by the "0" (ZERO, U+0030) glyph. |
| `ic` | Average character advance of a full width glyph in the element's font, as represented by the "水" (CJK water ideograph, U+6C34) glyph. |
| `rem` | Font size of the root element. |
| `lh` | Line height of the element. |
| `rlh` | Line height of the root element. |
| `vw` | 1% of viewport's width. |
| `vh` | 1% of viewport's height. |
| `vi` | 1% of viewport's size in the root element's inline axis. |
| `vb` | 1% of viewport's size in the root element's block axis. |
| `vmin` | 1% of viewport's smaller dimension. |
| `vmax` | 1% of viewport's larger dimension. |
Container query length units specify a length relative to the dimensions of a [query container](css_container_queries). For example, `cqw` is relative to the width of the query container and `cqh` is relative to the height of the query container.
| Unit | Relative to |
| --- | --- |
| `cqw` | 1% of a query container's width |
| `cqh` | 1% of a query container's height |
| `cqi` | 1% of a query container's inline size |
| `cqb` | 1% of a query container's block size |
| `cqmin` | The smaller value of `cqi` or `cqb` |
| `cqmax` | The larger value of `cqi` or `cqb` |
Absolute length units are fixed to a physical length: either an inch or a centimeter. Many of these units are therefore more useful when the output is a fixed size media, such as print. For example, `mm` is a physical millimeter, 1/10th of a centimeter.
| Unit | Name | Equivalent to |
| --- | --- | --- |
| `cm` | Centimeters | 1cm = 96px/2.54 |
| `mm` | Millimeters | 1mm = 1/10th of 1cm |
| `Q` | Quarter-millimeters | 1Q = 1/40th of 1cm |
| `in` | Inches | 1in = 2.54cm = 96px |
| `pc` | Picas | 1pc = 1/6th of 1in |
| `pt` | Points | 1pt = 1/72th of 1in |
| `px` | Pixels | 1px = 1/96th of 1in |
When including a length value, if the length is `0`, the unit identifier is not required. Otherwise, the unit identifier is required, is case insensitive, and must come immediately after the numeric part of the value, with no space in-between.
#### Angle units
Angle values are represented by the type [`<angle>`](angle) and accept the following values:
| Unit | Name | Description |
| --- | --- | --- |
| `deg` | Degrees | There are 360 degrees in a full circle. |
| `grad` | Gradians | There are 400 gradians in a full circle. |
| `rad` | Radians | There are 2π radians in a full circle. |
| `turn` | Turns | There is 1 turn in a full circle. |
#### Time units
Time values are represented by the type [`<time>`](time). When including a time value, the unit identifier — the `s` or `ms` — is required. It accepts the following values.
| Unit | Name | Description |
| --- | --- | --- |
| `s` | Seconds | |
| `ms` | Milliseconds | There are 1,000 milliseconds in a second. |
#### Frequency units
Frequency values are represented by the type [`<frequency>`](frequency). It accepts the following values.
| Unit | Name | Description |
| --- | --- | --- |
| `Hz` | Hertz | Represents the number of occurrences per second. |
| `kHz` | KiloHertz | A kiloHertz is 1000 Hertz. |
`1Hz`, which can also be written as `1hz` or `1HZ`, is one cycle per second.
#### Flex units
Flex units are represented by the type [`<flex>`](flex_value). It accepts the following value.
| Unit | Name | Description |
| --- | --- | --- |
| `fr` | Flex | Represents a flexible length within a grid container |
#### Resolution units
Resolution units are represented by the type [`<resolution>`](resolution). They represent the size of a single dot in a graphical representation, such as a screen, by indicating how many of these dots fit in a CSS inch, centimeter, or pixel. It accepts the following values:
| Unit | Description |
| --- | --- |
| `dpi` | Dots per inch. |
| `dpcm` | Dots per centimeter. |
| `dppx`, `x` | Dots per px unit. |
### Percentages
A [`<percentage>`](percentage) is a type that represents a fraction of some other value.
Percentage values are always relative to another quantity, for example a length. Each property that allows percentages also defines the quantity to which the percentage refers. This quantity can be a value of another property of the same element, the value of a property of an ancestor element, a measurement of a containing block, or something else.
As an example, if you specify the [`width`](width) of a box as a percentage, it refers to the percentage of the box's parent's computed width:
```
.box {
width: 50%;
}
```
### Mixing percentages and dimensions
Some properties accept a dimension that could be either one of two types, for example a `<length>` **or** a `<percentage>`. In this case the allowed value is detailed in the specification as a combination unit, e.g. [`<length-percentage>`](length-percentage). Other possible combinations are as follows:
* [`<frequency-percentage>`](frequency-percentage)
* [`<angle-percentage>`](angle-percentage)
* [`<time-percentage>`](time-percentage)
### Special data types (defined in other specs)
* [`<color>`](color_value)
* [`<image>`](image)
* [`<position>`](position_value)
#### Color
The [`<color>`](color_value) value specifies the color of an element feature (e.g. it's background color), and is defined in the [CSS Color Module](https://drafts.csswg.org/css-color-3/).
#### Image
The [`<image>`](image) value specifies all the different types of image that can be used in CSS, and is defined in the [CSS Image Values and Replaced Content Module](https://www.w3.org/TR/css-images-4/).
#### Position
The [`<position>`](position_value) type defines 2D positioning of an object inside a positioning area, for example a background image inside a container. This type is interpreted as a [`background-position`](background-position) and therefore specified in the [CSS Backgrounds and Borders specification](https://www.w3.org/TR/css-backgrounds-3/).
### Functional notation
* [`calc()`](calc)
* [`min()`](min)
* [`max()`](max)
* [`minmax()`](minmax)
* [`clamp()`](clamp)
* `toggle()`
* [`attr()`](attr)
[Functional notation](css_functions) is a type of value that can represent more complex types or invoke special processing by CSS. The syntax starts with the name of the function immediately followed by a left parenthesis `(` followed by the argument(s) to the notation followed by a right parenthesis `)`. Functions can take multiple arguments, which are formatted similarly to a CSS property value.
White space is allowed, but optional inside the parentheses. (But see notes regarding whitespace within pages for `min()`, `max()`, `minmax()`, and `clamp()` functions.)
Some legacy functional notations such as `rgba()` use commas, but generally commas are only used to separate items in a list. If a comma is used to separate arguments, white space is optional before and after the comma.
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 4](https://drafts.csswg.org/css-values/) |
| [CSS Color Module Level 4](https://drafts.csswg.org/css-color/) |
| [CSS Images Module Level 3](https://drafts.csswg.org/css-images/) |
See also
--------
* [CSS Basic Data Types](css_types)
* [Introduction to CSS: Values and Units](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units)
| programming_docs |
css grid-template grid-template
=============
The `grid-template` CSS property is a [shorthand property](shorthand_properties) for defining [grid columns](https://developer.mozilla.org/en-US/docs/Glossary/Grid_Column), [grid rows](https://developer.mozilla.org/en-US/docs/Glossary/Grid_Row), and [grid areas](https://developer.mozilla.org/en-US/docs/Glossary/Grid_Areas).
Try it
------
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`grid-template-areas`](grid-template-areas)
* [`grid-template-columns`](grid-template-columns)
* [`grid-template-rows`](grid-template-rows)
Syntax
------
```
/\* Keyword value \*/
grid-template: none;
/\* grid-template-rows / grid-template-columns values \*/
grid-template: 100px 1fr / 50px 1fr;
grid-template: auto 1fr / auto 1fr auto;
grid-template: [linename] 100px / [columnname1] 30% [columnname2] 70%;
grid-template: fit-content(100px) / fit-content(40%);
/\* grid-template-areas grid-template-rows / grid-template-column values \*/
grid-template:
"a a a"
"b b b";
grid-template:
"a a a" 20%
"b b b" auto;
grid-template:
[header-top] "a a a" [header-bottom]
[main-top] "b b b" 1fr [main-bottom]
/ auto 1fr auto;
/\* Global values \*/
grid-template: inherit;
grid-template: initial;
grid-template: revert;
grid-template: revert-layer;
grid-template: unset;
```
### Values
`none` Is a keyword that sets all three longhand properties to `none`, meaning there is no explicit grid. There are no named grid areas. Rows and columns will be implicitly generated; their size will be determined by the [`grid-auto-rows`](grid-auto-rows) and [`grid-auto-columns`](grid-auto-columns) properties.
`<'grid-template-rows'> / <'grid-template-columns'>` Sets [`grid-template-rows`](grid-template-rows) and [`grid-template-columns`](grid-template-columns) to the specified values, and sets [`grid-template-areas`](grid-template-areas) to `none`.
`[ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?` Sets [`grid-template-areas`](grid-template-areas) to the strings listed, [`grid-template-rows`](grid-template-rows) to the track sizes following each string (filling in `auto` for any missing sizes), and splicing in the named lines defined before/after each size, and [`grid-template-columns`](grid-template-columns) to the track listing specified after the slash (or `none`, if not specified).
**Note:** The [`repeat()`](repeat) function isn't allowed in these track listings, as the tracks are intended to visually line up one-to-one with the rows/columns in the "ASCII art".
**Note:** The [`grid`](grid) shorthand accepts the same syntax, but also resets the implicit grid properties to their initial values. Use `grid` (as opposed to `grid-template`) to prevent these values from cascading in separately.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`grid-template-columns`](grid-template-columns): `none`
* [`grid-template-rows`](grid-template-rows): `none`
* [`grid-template-areas`](grid-template-areas): `none`
|
| Applies to | grid containers |
| [Inherited](inheritance) | no |
| Percentages | as each of the properties of the shorthand:* [`grid-template-columns`](grid-template-columns): refer to corresponding dimension of the content area
* [`grid-template-rows`](grid-template-rows): refer to corresponding dimension of the content area
|
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`grid-template-columns`](grid-template-columns): as specified, but with relative lengths converted into absolute lengths
* [`grid-template-rows`](grid-template-rows): as specified, but with relative lengths converted into absolute lengths
* [`grid-template-areas`](grid-template-areas): as specified
|
| Animation type | discrete |
Formal syntax
-------------
```
grid-template =
none [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) <'grid-template-rows'> / <'grid-template-columns'> []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) [<string>](string) <track-size>[?](value_definition_syntax#question_mark) <line-names>[?](value_definition_syntax#question_mark) []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) [[](value_definition_syntax#brackets) / <explicit-track-list> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark)
<line-names> =
'[' [<custom-ident>](custom-ident)[\*](value_definition_syntax#asterisk) ']'
<track-size> =
<track-breadth> [|](value_definition_syntax#single_bar)
minmax( <inflexible-breadth> , <track-breadth> ) [|](value_definition_syntax#single_bar)
fit-content( <length-percentage> )
<explicit-track-list> =
[[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) <track-size> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) <line-names>[?](value_definition_syntax#question_mark)
<track-breadth> =
<length-percentage> [|](value_definition_syntax#single_bar)
[<flex>](flex) [|](value_definition_syntax#single_bar)
min-content [|](value_definition_syntax#single_bar)
max-content [|](value_definition_syntax#single_bar)
auto
<inflexible-breadth> =
<length-percentage> [|](value_definition_syntax#single_bar)
min-content [|](value_definition_syntax#single_bar)
max-content [|](value_definition_syntax#single_bar)
auto
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Defining a grid template
#### CSS
```
#page {
display: grid;
width: 100%;
height: 200px;
grid-template:
[header-left] "head head" 30px [header-right]
[main-left] "nav main" 1fr [main-right]
[footer-left] "nav foot" 30px [footer-right]
/ 120px 1fr;
}
header {
background-color: lime;
grid-area: head;
}
nav {
background-color: lightblue;
grid-area: nav;
}
main {
background-color: yellow;
grid-area: main;
}
footer {
background-color: red;
grid-area: foot;
}
```
#### HTML
```
<section id="page">
<header>Header</header>
<nav>Navigation</nav>
<main>Main area</main>
<footer>Footer</footer>
</section>
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Grid Layout Module Level 2 # explicit-grid-shorthand](https://w3c.github.io/csswg-drafts/css-grid/#explicit-grid-shorthand) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `grid-template` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
See also
--------
* Related CSS properties: [`grid-template-rows`](grid-template-rows), [`grid-template-columns`](grid-template-columns), [`grid-template-areas`](grid-template-areas)
* Grid Layout Guide: *[Line-based placement with CSS Grid](css_grid_layout/line-based_placement_with_css_grid)*
* Grid Layout Guide: *[Grid template areas - Grid definition shorthands](css_grid_layout/grid_template_areas#grid_definition_shorthands)*
* Video tutorial: *[Grid Template shorthand](https://gridbyexample.com/video/grid-template-shorthand/)*
css CSS reference CSS reference
=============
Use this **CSS reference** to browse an [alphabetical index](#index) of all of the standard [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) properties, <pseudo-classes>, <pseudo-elements>, [data types](css_types), [functional notations](css_functions) and [at-rules](at-rule). You can also browse [key CSS concepts](#concepts) and a list of [selectors organized by type](#selectors). Also included is a brief [DOM-CSS / CSSOM reference](#dom-css_cssom).
Basic rule syntax
-----------------
### Style rule syntax
```
style-rule ::=
selectors-list {
properties-list
}
```
Where:
```
selectors-list ::=
selector[:pseudo-class] [::pseudo-element]
[, selectors-list]
properties-list ::=
[property : value] [; properties-list]
```
See the index of [*selectors*](#selectors), [*pseudo-classes*](#pseudo), and *[pseudo-elements](#pseudo)* below. The syntax for each specified *value* depends on the data type defined for each specified *property*.
#### Style rule examples
```
strong {
color: red;
}
div.menu-bar li:hover > ul {
display: block;
}
```
For a beginner-level introduction to the syntax of selectors, see our [guide on CSS Selectors](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors). Be aware that any <syntax> error in a rule definition invalidates the entire rule. Invalid rules are ignored by the browser. Note that CSS rule definitions are entirely (ASCII) [text-based](https://www.w3.org/TR/css-syntax-3/#intro), whereas DOM-CSS / CSSOM (the rule management system) is [object-based](https://www.w3.org/TR/cssom/#introduction).
### At-rule syntax
As the structure of at-rules varies widely, please see [At-rule](at-rule) to find the syntax of the specific one you want.
Index
-----
**Note:** The property names in this index do **not** include the [JavaScript names](reference#index) where they differ from the CSS standard names.
### -
* [`--*`](--*)
* [`-webkit-line-clamp`](-webkit-line-clamp)
### A
* [`abs()`](abs)
* [`accent-color`](accent-color)
* [`acos()`](acos)
* [`:active`](:active)
* [`additive-symbols (@counter-style)`](@counter-style/additive-symbols)
* [`::after (:after)`](::after)
* [`align-content`](align-content)
* [`align-items`](align-items)
* [`align-self`](align-self)
* [`align-tracks`](align-tracks)
* [`all`](all)
* `<an-plus-b>`
* [`<angle>`](angle)
* [`<angle-percentage>`](angle-percentage)
* [`animation`](animation)
* [`animation-composition`](animation-composition)
* [`animation-delay`](animation-delay)
* [`animation-direction`](animation-direction)
* [`animation-duration`](animation-duration)
* [`animation-fill-mode`](animation-fill-mode)
* [`animation-iteration-count`](animation-iteration-count)
* [`animation-name`](animation-name)
* [`animation-play-state`](animation-play-state)
* [`animation-timeline`](animation-timeline)
* [`animation-timing-function`](animation-timing-function)
* [`@annotation`](@font-feature-values#@annotation)
* [`annotation()`](font-variant-alternates#annotation())
* [`:any-link`](:any-link)
* [`appearance`](appearance)
* [`ascent-override (@font-face)`](@font-face/ascent-override)
* [`asin()`](asin)
* [`aspect-ratio`](aspect-ratio)
* [`atan()`](atan)
* [`atan2()`](atan2)
* [`attr()`](attr)
### B
* [`::backdrop`](::backdrop)
* [`backdrop-filter`](backdrop-filter)
* [`backface-visibility`](backface-visibility)
* [`background`](background)
* [`background-attachment`](background-attachment)
* [`background-blend-mode`](background-blend-mode)
* [`background-clip`](background-clip)
* [`background-color`](background-color)
* [`background-image`](background-image)
* [`background-origin`](background-origin)
* [`background-position`](background-position)
* [`background-position-x`](background-position-x)
* [`background-position-y`](background-position-y)
* [`background-repeat`](background-repeat)
* [`background-size`](background-size)
* [`<basic-shape>`](basic-shape)
* [`::before (:before)`](::before)
* [`:blank`](:blank)
* `bleed (@page)`
* [`<blend-mode>`](blend-mode)
* `block-overflow`
* [`block-size`](block-size)
* [`blur()`](filter-function/blur)
* [`border`](border)
* [`border-block`](border-block)
* [`border-block-color`](border-block-color)
* [`border-block-end`](border-block-end)
* [`border-block-end-color`](border-block-end-color)
* [`border-block-end-style`](border-block-end-style)
* [`border-block-end-width`](border-block-end-width)
* [`border-block-start`](border-block-start)
* [`border-block-start-color`](border-block-start-color)
* [`border-block-start-style`](border-block-start-style)
* [`border-block-start-width`](border-block-start-width)
* [`border-block-style`](border-block-style)
* [`border-block-width`](border-block-width)
* [`border-bottom`](border-bottom)
* [`border-bottom-color`](border-bottom-color)
* [`border-bottom-left-radius`](border-bottom-left-radius)
* [`border-bottom-right-radius`](border-bottom-right-radius)
* [`border-bottom-style`](border-bottom-style)
* [`border-bottom-width`](border-bottom-width)
* [`border-collapse`](border-collapse)
* [`border-color`](border-color)
* [`border-end-end-radius`](border-end-end-radius)
* [`border-end-start-radius`](border-end-start-radius)
* [`border-image`](border-image)
* [`border-image-outset`](border-image-outset)
* [`border-image-repeat`](border-image-repeat)
* [`border-image-slice`](border-image-slice)
* [`border-image-source`](border-image-source)
* [`border-image-width`](border-image-width)
* [`border-inline`](border-inline)
* [`border-inline-color`](border-inline-color)
* [`border-inline-end`](border-inline-end)
* [`border-inline-end-color`](border-inline-end-color)
* [`border-inline-end-style`](border-inline-end-style)
* [`border-inline-end-width`](border-inline-end-width)
* [`border-inline-start`](border-inline-start)
* [`border-inline-start-color`](border-inline-start-color)
* [`border-inline-start-style`](border-inline-start-style)
* [`border-inline-start-width`](border-inline-start-width)
* [`border-inline-style`](border-inline-style)
* [`border-inline-width`](border-inline-width)
* [`border-left`](border-left)
* [`border-left-color`](border-left-color)
* [`border-left-style`](border-left-style)
* [`border-left-width`](border-left-width)
* [`border-radius`](border-radius)
* [`border-right`](border-right)
* [`border-right-color`](border-right-color)
* [`border-right-style`](border-right-style)
* [`border-right-width`](border-right-width)
* [`border-spacing`](border-spacing)
* [`border-start-end-radius`](border-start-end-radius)
* [`border-start-start-radius`](border-start-start-radius)
* [`border-style`](border-style)
* [`border-top`](border-top)
* [`border-top-color`](border-top-color)
* [`border-top-left-radius`](border-top-left-radius)
* [`border-top-right-radius`](border-top-right-radius)
* [`border-top-style`](border-top-style)
* [`border-top-width`](border-top-width)
* [`border-width`](border-width)
* [`bottom`](bottom)
* [`@bottom-center`](@page#page-margin-box-type)
* [`box-decoration-break`](box-decoration-break)
* [`box-shadow`](box-shadow)
* [`box-sizing`](box-sizing)
* [`break-after`](break-after)
* [`break-before`](break-before)
* [`break-inside`](break-inside)
* [`brightness()`](filter-function/brightness)
### C
* [`calc()`](calc)
* [`caption-side`](caption-side)
* `caret`
* [`caret-color`](caret-color)
* `caret-shape`
* [`@character-variant`](@font-feature-values#@character-variant)
* [`character-variant()`](font-variant-alternates#character-variant())
* [`@charset`](@charset)
* [`:checked`](:checked)
* [`circle()`](basic-shape#circle())
* [`clamp()`](clamp)
* [`clear`](clear)
* [`clip`](clip)
* [`clip-path`](clip-path)
* [`<color>`](color_value)
* [`color`](color)
* [`color-scheme`](color-scheme)
* [`column-count`](column-count)
* [`column-fill`](column-fill)
* [`column-gap`](column-gap)
* [`column-rule`](column-rule)
* [`column-rule-color`](column-rule-color)
* [`column-rule-style`](column-rule-style)
* [`column-rule-width`](column-rule-width)
* [`column-span`](column-span)
* [`column-width`](column-width)
* [`columns`](columns)
* [`conic-gradient()`](gradient/conic-gradient)
* [`contain`](contain)
* [`contain-intrinsic-block-size`](contain-intrinsic-block-size)
* [`contain-intrinsic-height`](contain-intrinsic-height)
* [`contain-intrinsic-inline-size`](contain-intrinsic-inline-size)
* [`contain-intrinsic-size`](contain-intrinsic-size)
* [`contain-intrinsic-width`](contain-intrinsic-width)
* [`content`](content)
* [`content-visibility`](content-visibility)
* [`contrast()`](filter-function/contrast)
* [`cos()`](cos)
* [`<counter>`](counter)
* [`counter-increment`](counter-increment)
* [`counter-reset`](counter-reset)
* [`counter-set`](counter-set)
* [`@counter-style`](@counter-style)
* [`counters()`](counters)
* [`cross-fade()`](cross-fade)
* [`cubic-bezier()`](easing-function#cubic-bezier())
* [`::cue`](::cue)
* [`::cue-region`](::cue-region)
* [`:current`](:current)
* [`cursor`](cursor)
* [`<custom-ident>`](custom-ident)
* [`length#cap`](length#cap)
* [`length#ch`](length#ch)
* [`length#cm`](length#cm)
### D
* [`angle#deg`](angle#deg)
* [`:default`](:default)
* [`:defined`](:defined)
* [`descent-override (@font-face)`](@font-face/descent-override)
* [`<dimension>`](dimension)
* [`:dir`](:dir)
* [`direction`](direction)
* [`:disabled`](:disabled)
* [`display`](display)
* [`<display-box>`](display-box)
* [`<display-inside>`](display-inside)
* [`<display-internal>`](display-internal)
* [`<display-legacy>`](display-legacy)
* [`<display-listitem>`](display-listitem)
* [`<display-outside>`](display-outside)
* [`drop-shadow()`](filter-function/drop-shadow)
* [`resolution#dpcm`](resolution#dpcm)
* [`resolution#dpi`](resolution#dpi)
* [`resolution#dppx`](resolution#dppx)
### E
* [`element()`](element())
* [`ellipse()`](basic-shape#ellipse())
* [`:empty`](:empty)
* [`empty-cells`](empty-cells)
* [`:enabled`](:enabled)
* [`env()`](env)
* [`exp()`](exp)
* [`length#em`](length#em)
* [`length#ex`](length#ex)
### F
* [`fallback (@counter-style)`](@counter-style/fallback)
* [`filter`](filter)
* [`<filter-function>`](filter-function)
* [`:first`](:first)
* [`:first-child`](:first-child)
* [`::first-letter (:first-letter)`](::first-letter)
* [`::first-line (:first-line)`](::first-line)
* [`:first-of-type`](:first-of-type)
* [`fit-content()`](fit-content)
* [`<flex>`](flex_value)
* [`flex`](flex)
* [`flex-basis`](flex-basis)
* [`flex-direction`](flex-direction)
* [`flex-flow`](flex-flow)
* [`flex-grow`](flex-grow)
* [`flex-shrink`](flex-shrink)
* [`flex-wrap`](flex-wrap)
* [`flex_value#fr`](flex_value#fr)
* [`float`](float)
* [`:focus`](:focus)
* [`:focus-visible`](:focus-visible)
* [`:focus-within`](:focus-within)
* [`font`](font)
* [`font-display (@font-face)`](@font-face/font-display)
* [`@font-face`](@font-face)
* [`font-family`](font-family)
* [`font-family (@font-face)`](@font-face/font-family)
* [`font-feature-settings`](font-feature-settings)
* `font-feature-settings (@font-face)`
* [`@font-feature-values`](@font-feature-values)
* [`font-kerning`](font-kerning)
* [`font-language-override`](font-language-override)
* [`font-optical-sizing`](font-optical-sizing)
* [`font-size`](font-size)
* [`font-size-adjust`](font-size-adjust)
* [`font-stretch`](font-stretch)
* [`font-stretch (@font-face)`](@font-face/font-stretch)
* [`font-style`](font-style)
* [`font-style (@font-face)`](@font-face/font-style)
* [`font-synthesis`](font-synthesis)
* [`font-variant`](font-variant)
* [`font-variant (@font-face)`](@font-face)
* [`font-variant-alternates`](font-variant-alternates)
* [`font-variant-caps`](font-variant-caps)
* [`font-variant-east-asian`](font-variant-east-asian)
* [`font-variant-ligatures`](font-variant-ligatures)
* [`font-variant-numeric`](font-variant-numeric)
* [`font-variant-position`](font-variant-position)
* [`font-variation-settings`](font-variation-settings)
* [`font-variation-settings (@font-face)`](@font-face/font-variation-settings)
* [`font-weight`](font-weight)
* [`font-weight (@font-face)`](@font-face/font-weight)
* [`forced-color-adjust`](forced-color-adjust)
* [`format()`](@font-face/src#format())
* [`<frequency>`](frequency)
* [`<frequency-percentage>`](frequency-percentage)
* [`:fullscreen`](:fullscreen)
* [`:future`](:future)
### G
* [`angle#grad`](angle#grad)
* [`gap`](gap)
* [`<gradient>`](gradient)
* [`::grammar-error`](::grammar-error)
* [`grayscale()`](filter-function/grayscale)
* [`grid`](grid)
* [`grid-area`](grid-area)
* [`grid-auto-columns`](grid-auto-columns)
* [`grid-auto-flow`](grid-auto-flow)
* [`grid-auto-rows`](grid-auto-rows)
* [`grid-column`](grid-column)
* [`grid-column-end`](grid-column-end)
* [`grid-column-start`](grid-column-start)
* [`grid-row`](grid-row)
* [`grid-row-end`](grid-row-end)
* [`grid-row-start`](grid-row-start)
* [`grid-template`](grid-template)
* [`grid-template-areas`](grid-template-areas)
* [`grid-template-columns`](grid-template-columns)
* [`grid-template-rows`](grid-template-rows)
### H
* [`frequency#Hz`](frequency#hz)
* [`hanging-punctuation`](hanging-punctuation)
* [`:has`](:has)
* [`height`](height)
* [`height (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* `@historical-forms`
* [`:host()`](:host_function)
* `:host-context()`
* [`:hover`](:hover)
* [`hsl()`](color_value#hsl())
* [`hsla()`](color_value#hsla())
* [`hue-rotate()`](filter-function/hue-rotate)
* `hwb()`
* [`hyphenate-character`](hyphenate-character)
* [`hyphens`](hyphens)
* [`hypot()`](hypot)
### I
* [`<ident>`](ident)
* [`<image>`](image)
* [`image()`](image#the_image()_functional_notation)
* [`image-orientation`](image-orientation)
* [`image-rendering`](image-rendering)
* [`image-resolution`](image-resolution)
* [`image-set()`](image/image-set)
* [`@import`](@import)
* [`:in-range`](:in-range)
* [`:indeterminate`](:indeterminate)
* [`inherit`](inherit)
* [`inherits (@property)`](@property/inherits)
* [`initial`](initial)
* [`initial-letter`](initial-letter)
* [`initial-letter-align`](initial-letter-align)
* [`initial-value (@property)`](@property/initial-value)
* [`inline-size`](inline-size)
* `input-security`
* [`inset`](inset)
* [`inset()`](basic-shape#inset())
* [`inset-block`](inset-block)
* [`inset-block-end`](inset-block-end)
* [`inset-block-start`](inset-block-start)
* [`inset-inline`](inset-inline)
* [`inset-inline-end`](inset-inline-end)
* [`inset-inline-start`](inset-inline-start)
* [`<integer>`](integer)
* [`:invalid`](:invalid)
* [`invert()`](filter-function/invert)
* [`:is`](:is)
* [`isolation`](isolation)
* [`length#ic`](length#ic)
* [`length#in`](length#in)
### J
* [`justify-content`](justify-content)
* [`justify-items`](justify-items)
* [`justify-self`](justify-self)
* [`justify-tracks`](justify-tracks)
### K
* [`frequency#kHz`](frequency#khz)
* [`@keyframes`](@keyframes)
### L
* `lab()`
* [`:lang`](:lang)
* [`:last-child`](:last-child)
* [`:last-of-type`](:last-of-type)
* [`@layer`](@layer)
* `layer()`
* `layer() (@import)`
* `lch()`
* `leader()`
* [`:left`](:left)
* [`left`](left)
* [`@left-bottom`](@page#page-margin-box-type)
* [`<length>`](length)
* [`<length-percentage>`](length-percentage)
* [`letter-spacing`](letter-spacing)
* [`line-break`](line-break)
* `line-clamp`
* [`line-gap-override (@font-face)`](@font-face/line-gap-override)
* [`line-height`](line-height)
* [`line-height-step`](line-height-step)
* [`linear-gradient()`](gradient/linear-gradient)
* [`:link`](:link)
* [`list-style`](list-style)
* [`list-style-image`](list-style-image)
* [`list-style-position`](list-style-position)
* [`list-style-type`](list-style-type)
* [`local()`](@font-face/src#local())
* [`:local-link`](:local-link)
* [`log()`](log)
### M
* [`length#mm`](length#mm)
* [`margin`](margin)
* [`margin-block`](margin-block)
* [`margin-block-end`](margin-block-end)
* [`margin-block-start`](margin-block-start)
* [`margin-bottom`](margin-bottom)
* [`margin-inline`](margin-inline)
* [`margin-inline-end`](margin-inline-end)
* [`margin-inline-start`](margin-inline-start)
* [`margin-left`](margin-left)
* [`margin-right`](margin-right)
* [`margin-top`](margin-top)
* [`margin-trim`](margin-trim)
* [`::marker`](::marker)
* `marks (@page)`
* [`mask`](mask)
* [`mask-border`](mask-border)
* [`mask-border-mode`](mask-border-mode)
* [`mask-border-outset`](mask-border-outset)
* [`mask-border-repeat`](mask-border-repeat)
* [`mask-border-slice`](mask-border-slice)
* [`mask-border-source`](mask-border-source)
* [`mask-border-width`](mask-border-width)
* [`mask-clip`](mask-clip)
* [`mask-composite`](mask-composite)
* [`mask-image`](mask-image)
* [`mask-mode`](mask-mode)
* [`mask-origin`](mask-origin)
* [`mask-position`](mask-position)
* [`mask-repeat`](mask-repeat)
* [`mask-size`](mask-size)
* [`mask-type`](mask-type)
* [`masonry-auto-flow`](masonry-auto-flow)
* [`math-depth`](math-depth)
* [`math-shift`](math-shift)
* [`math-style`](math-style)
* [`matrix()`](transform-function/matrix)
* [`matrix3d()`](transform-function/matrix3d)
* [`max()`](max)
* [`max-block-size`](max-block-size)
* [`max-height`](max-height)
* [`max-height (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [`max-inline-size`](max-inline-size)
* `max-lines`
* [`max-width`](max-width)
* [`max-width (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [`max-zoom (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [`@media`](@media)
* [`min()`](min)
* [`min-block-size`](min-block-size)
* [`min-height`](min-height)
* [`min-height (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [`min-inline-size`](min-inline-size)
* [`min-width`](min-width)
* [`min-width (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [`min-zoom (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [`minmax()`](minmax)
* [`mix-blend-mode`](mix-blend-mode)
* `mod()`
* [`time#ms`](time#ms)
### N
* [`@namespace`](@namespace)
* [`negative (@counter-style)`](@counter-style/negative)
* [`:not`](:not)
* [`:nth-child`](:nth-child)
* [`:nth-col`](:nth-col)
* [`:nth-last-child`](:nth-last-child)
* [`:nth-last-col`](:nth-last-col)
* [`:nth-last-of-type`](:nth-last-of-type)
* [`:nth-of-type`](:nth-of-type)
* [`<number>`](number)
### O
* [`object-fit`](object-fit)
* [`object-position`](object-position)
* [`offset`](offset)
* [`offset-anchor`](offset-anchor)
* [`offset-distance`](offset-distance)
* [`offset-path`](offset-path)
* [`offset-position`](offset-position)
* [`offset-rotate`](offset-rotate)
* [`:only-child`](:only-child)
* [`:only-of-type`](:only-of-type)
* [`opacity`](opacity)
* [`opacity()`](filter-function/opacity)
* [`:optional`](:optional)
* [`order`](order)
* [`orientation (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [`@ornaments`](@font-feature-values#@ornaments)
* [`ornaments()`](font-variant-alternates#ornaments())
* [`orphans`](orphans)
* [`:out-of-range`](:out-of-range)
* [`outline`](outline)
* [`outline-color`](outline-color)
* [`outline-offset`](outline-offset)
* [`outline-style`](outline-style)
* [`outline-width`](outline-width)
* [`overflow`](overflow)
* [`overflow-anchor`](overflow-anchor)
* [`overflow-block`](overflow-block)
* [`overflow-clip-margin`](overflow-clip-margin)
* [`overflow-inline`](overflow-inline)
* [`overflow-wrap`](overflow-wrap)
* [`overflow-x`](overflow-x)
* [`overflow-y`](overflow-y)
* [`overscroll-behavior`](overscroll-behavior)
* [`overscroll-behavior-block`](overscroll-behavior-block)
* [`overscroll-behavior-inline`](overscroll-behavior-inline)
* [`overscroll-behavior-x`](overscroll-behavior-x)
* [`overscroll-behavior-y`](overscroll-behavior-y)
### P
* [`Pseudo-classes`](pseudo-classes)
* [`Pseudo-elements`](pseudo-elements)
* [`length#pc`](length#pc)
* [`length#pt`](length#pt)
* [`length#px`](length#px)
* [`pad (@counter-style)`](@counter-style/pad)
* [`padding`](padding)
* [`padding-block`](padding-block)
* [`padding-block-end`](padding-block-end)
* [`padding-block-start`](padding-block-start)
* [`padding-bottom`](padding-bottom)
* [`padding-inline`](padding-inline)
* [`padding-inline-end`](padding-inline-end)
* [`padding-inline-start`](padding-inline-start)
* [`padding-left`](padding-left)
* [`padding-right`](padding-right)
* [`padding-top`](padding-top)
* [`@page`](@page)
* [`page-break-after`](page-break-after)
* [`page-break-before`](page-break-before)
* [`page-break-inside`](page-break-inside)
* [`paint()`](image/paint)
* [`paint-order`](paint-order)
* [`::part`](::part)
* [`:past`](:past)
* [`path()`](path)
* [`:paused`](:paused)
* [`<percentage>`](percentage)
* [`perspective`](perspective)
* [`perspective()`](transform-function/perspective)
* [`perspective-origin`](perspective-origin)
* [`:picture-in-picture`](:picture-in-picture)
* [`place-content`](place-content)
* [`place-items`](place-items)
* [`place-self`](place-self)
* [`::placeholder`](::placeholder)
* [`:placeholder-shown`](:placeholder-shown)
* [`:playing`](:playing)
* [`pointer-events`](pointer-events)
* [`polygon()`](basic-shape#polygon())
* [`<position>`](position_value)
* [`position`](position)
* [`pow()`](pow)
* [`prefix (@counter-style)`](@counter-style/prefix)
* [`print-color-adjust`](print-color-adjust)
* [`@property`](@property)
### Q
* [`length#Q`](length#q)
* [`quotes`](quotes)
### R
* [`angle#rad`](angle#rad)
* [`length#rem`](length#rem)
* [`radial-gradient()`](gradient/radial-gradient)
* [`range (@counter-style)`](@counter-style/range)
* [`<ratio>`](ratio)
* [`:read-only`](:read-only)
* [`:read-write`](:read-write)
* [`rect()`](shape#rect())
* [`rem()`](rem)
* [`repeat()`](repeat)
* [`repeating-conic-gradient()`](gradient/repeating-conic-gradient)
* [`repeating-linear-gradient()`](gradient/repeating-linear-gradient)
* [`repeating-radial-gradient()`](gradient/repeating-radial-gradient)
* [`:required`](:required)
* [`resize`](resize)
* [`<resolution>`](resolution)
* `reversed()`
* [`revert`](revert)
* [`rgb()`](color_value#rgb())
* [`rgba()`](color_value#rgba())
* [`:right`](:right)
* [`right`](right)
* [`@right-bottom`](@page#page-margin-box-type)
* [`:root`](:root)
* [`rotate`](rotate)
* [`rotate()`](transform-function/rotate)
* [`rotate3d()`](transform-function/rotate3d)
* [`rotateX()`](transform-function/rotatex)
* [`rotateY()`](transform-function/rotatey)
* [`rotateZ()`](transform-function/rotatez)
* [`round()`](round)
* [`row-gap`](row-gap)
* [`ruby-align`](ruby-align)
* `ruby-merge`
* [`ruby-position`](ruby-position)
### S
* [`saturate()`](filter-function/saturate)
* [`scale`](scale)
* [`scale()`](transform-function/scale)
* [`scale3d()`](transform-function/scale3d)
* [`scaleX()`](transform-function/scalex)
* [`scaleY()`](transform-function/scaley)
* [`scaleZ()`](transform-function/scalez)
* [`:scope`](:scope)
* [`scroll()`](overflow)
* [`scroll-behavior`](scroll-behavior)
* [`scroll-margin`](scroll-margin)
* [`scroll-margin-block`](scroll-margin-block)
* [`scroll-margin-block-end`](scroll-margin-block-end)
* [`scroll-margin-block-start`](scroll-margin-block-start)
* [`scroll-margin-bottom`](scroll-margin-bottom)
* [`scroll-margin-inline`](scroll-margin-inline)
* [`scroll-margin-inline-end`](scroll-margin-inline-end)
* [`scroll-margin-inline-start`](scroll-margin-inline-start)
* [`scroll-margin-left`](scroll-margin-left)
* [`scroll-margin-right`](scroll-margin-right)
* [`scroll-margin-top`](scroll-margin-top)
* [`scroll-padding`](scroll-padding)
* [`scroll-padding-block`](scroll-padding-block)
* [`scroll-padding-block-end`](scroll-padding-block-end)
* [`scroll-padding-block-start`](scroll-padding-block-start)
* [`scroll-padding-bottom`](scroll-padding-bottom)
* [`scroll-padding-inline`](scroll-padding-inline)
* [`scroll-padding-inline-end`](scroll-padding-inline-end)
* [`scroll-padding-inline-start`](scroll-padding-inline-start)
* [`scroll-padding-left`](scroll-padding-left)
* [`scroll-padding-right`](scroll-padding-right)
* [`scroll-padding-top`](scroll-padding-top)
* [`scroll-snap-align`](scroll-snap-align)
* [`scroll-snap-stop`](scroll-snap-stop)
* [`scroll-snap-type`](scroll-snap-type)
* [`@scroll-timeline`](scroll-timeline)
* [`scroll-timeline`](scroll-timeline)
* [`scroll-timeline-axis`](scroll-timeline-axis)
* [`scroll-timeline-name`](scroll-timeline-name)
* [`scrollbar-color`](scrollbar-color)
* [`scrollbar-gutter`](scrollbar-gutter)
* [`scrollbar-width`](scrollbar-width)
* [`::selection`](::selection)
* `selector()`
* [`sepia()`](filter-function/sepia)
* [`<shape>`](shape)
* [`shape-image-threshold`](shape-image-threshold)
* [`shape-margin`](shape-margin)
* [`shape-outside`](shape-outside)
* [`sign()`](sign)
* [`sin()`](sin)
* [`size (@page)`](@page/size)
* [`size-adjust (@font-face)`](@font-face/size-adjust)
* [`skew()`](transform-function/skew)
* [`skewX()`](transform-function/skewx)
* [`skewY()`](transform-function/skewy)
* [`::slotted`](::slotted)
* [`speak-as (@counter-style)`](@counter-style/speak-as)
* [`::spelling-error`](::spelling-error)
* [`sqrt()`](sqrt)
* [`src (@font-face)`](@font-face/src)
* [`steps()`](easing-function#steps())
* [`<string>`](string)
* [`@styleset`](@font-feature-values#@styleset)
* [`styleset()`](font-variant-alternates#styleset())
* [`@stylistic`](@font-feature-values#@stylistic)
* [`stylistic()`](font-variant-alternates#stylistic())
* [`suffix (@counter-style)`](@counter-style/suffix)
* [`@supports`](@supports)
* `supports() (@import)`
* [`@swash`](@font-feature-values#@swash)
* [`swash()`](font-variant-alternates#swash())
* [`symbols (@counter-style)`](@counter-style/symbols)
* [`symbols()`](@counter-style/symbols)
* [`syntax (@property)`](@property/syntax)
* [`system (@counter-style)`](@counter-style/system)
* [`time#s`](time#s)
### T
* [`angle#turn`](angle#turn)
* [`tab-size`](tab-size)
* [`table-layout`](table-layout)
* [`tan()`](tan)
* [`:target`](:target)
* `target-counter()`
* `target-counters()`
* [`::target-text`](::target-text)
* `target-text()`
* [`:target-within`](:target-within)
* [`text-align`](text-align)
* [`text-align-last`](text-align-last)
* [`text-combine-upright`](text-combine-upright)
* [`text-decoration`](text-decoration)
* [`text-decoration-color`](text-decoration-color)
* [`text-decoration-line`](text-decoration-line)
* [`text-decoration-skip`](text-decoration-skip)
* [`text-decoration-skip-ink`](text-decoration-skip-ink)
* [`text-decoration-style`](text-decoration-style)
* [`text-decoration-thickness`](text-decoration-thickness)
* [`text-emphasis`](text-emphasis)
* [`text-emphasis-color`](text-emphasis-color)
* [`text-emphasis-position`](text-emphasis-position)
* [`text-emphasis-style`](text-emphasis-style)
* [`text-indent`](text-indent)
* [`text-justify`](text-justify)
* [`text-orientation`](text-orientation)
* [`text-overflow`](text-overflow)
* [`text-rendering`](text-rendering)
* [`text-shadow`](text-shadow)
* [`text-size-adjust`](text-size-adjust)
* [`text-transform`](text-transform)
* [`text-underline-offset`](text-underline-offset)
* [`text-underline-position`](text-underline-position)
* [`<time>`](time)
* [`<time-percentage>`](time-percentage)
* [`<timing-function>`](easing-function)
* [`top`](top)
* [`@top-center`](@page#page-margin-box-type)
* [`touch-action`](touch-action)
* [`transform`](transform)
* [`transform-box`](transform-box)
* [`<transform-function>`](transform-function)
* [`transform-origin`](transform-origin)
* [`transform-style`](transform-style)
* [`transition`](transition)
* [`transition-delay`](transition-delay)
* [`transition-duration`](transition-duration)
* [`transition-property`](transition-property)
* [`transition-timing-function`](transition-timing-function)
* [`translate`](translate)
* [`translate()`](transform-function/translate)
* [`translate3d()`](transform-function/translate3d)
* [`translateX()`](transform-function/translatex)
* [`translateY()`](transform-function/translatey)
* [`translateZ()`](transform-function/translatez)
* `type()`
### U
* [`unicode-bidi`](unicode-bidi)
* [`unicode-range (@font-face)`](@font-face/unicode-range)
* [`unset`](unset)
* [`<url>`](url)
* [`url()`](url#the_url()_functional_notation)
* [`:user-invalid`](:user-invalid)
* [`user-select`](user-select)
* [`:user-valid`](:user-valid)
* [`user-zoom (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
### V
* [`length#vh`](length#vh)
* [`length#vmax`](length#vmax)
* [`length#vmin`](length#vmin)
* [`length#vw`](length#vw)
* [`:valid`](:valid)
* [`var()`](var())
* [`vertical-align`](vertical-align)
* [`@viewport`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [`viewport-fit (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [`visibility`](visibility)
* [`:visited`](:visited)
### W
* [`:where`](:where)
* [`white-space`](white-space)
* [`widows`](widows)
* [`width`](width)
* [`width (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [`will-change`](will-change)
* [`word-break`](word-break)
* [`word-spacing`](word-spacing)
* [`word-wrap`](overflow-wrap)
* [`writing-mode`](writing-mode)
### X
* [`resolution#x`](resolution#x)
### Z
* [`z-index`](z-index)
* [`zoom (@viewport)`](https://developer.mozilla.org/en-US/docs/Web/CSS)
### Others
* [`--*`](--*)
Selectors
---------
The following are the various [selectors](css_selectors), which allow styles to be conditional based on various features of elements within the DOM.
### Basic selectors
**Basic selectors** are fundamental selectors; these are the most basic selectors that are frequently combined to create other, more complex selectors.
* [Universal selector](universal_selectors) `*`
* [Type selector](type_selectors) `elementname`
* [Class selector](class_selectors) `.classname`
* [ID selector](id_selectors) `#idname`
* [Attribute selector](attribute_selectors) `[attr=value]`
### Grouping selectors
[Selector list](selector_list) `A, B`
Specifies that both `A` and `B` elements are selected. This is a grouping method to select several matching elements.
### Combinators
Combinators are selectors that establish a relationship between two or more simple selectors, such as "`A` is a child of `B`" or "`A` is adjacent to `B`", creating a complex selector.
[Adjacent sibling combinator](adjacent_sibling_combinator) `A + B`
Specifies that the elements selected by both `A` and `B` have the same parent and that the element selected by `B` immediately follows the element selected by `A` horizontally.
[General sibling combinator](general_sibling_combinator) `A ~ B`
Specifies that the elements selected by both `A` and `B` share the same parent and that the element selected by `A` comes before—but not necessarily immediately before—the element selected by `B`.
[Child combinator](child_combinator) `A > B`
Specifies that the element selected by `B` is the direct child of the element selected by `A`.
[Descendant combinator](descendant_combinator) `A B`
Specifies that the element selected by `B` is a descendant of the element selected by `A`, but is not necessarily a direct child.
[Column combinator](column_combinator) `A || B` Experimental
Specifies that the element selected by `B` is located within the table column specified by `A`. Elements which span multiple columns are considered to be a member of all of those columns.
### Pseudo
[Pseudo classes](pseudo-classes) `:`
Specifies a special state of the selected element(s).
[Pseudo elements](pseudo-elements) `::`
Represents entities that are not included in HTML.
See also [Selectors in the Selectors Level 4 specification](https://www.w3.org/TR/selectors/#overview).
Concepts
--------
### Syntax and semantics
* [CSS syntax](syntax)
* [At-rules](at-rule)
* [Cascade](cascade)
* [Comments](comments)
* [Descriptor](https://developer.mozilla.org/en-US/docs/Glossary/Descriptor_(CSS))
* [Inheritance](inheritance)
* [Shorthand properties](shorthand_properties)
* [Specificity](specificity)
* [Value definition syntax](value_definition_syntax)
* [CSS unit and value types](css_values_and_units)
* [CSS functional notations](css_functions)
### Values
* [Actual value](actual_value)
* [Computed value](computed_value)
* [Initial value](initial_value)
* [Resolved value](resolved_value)
* [Specified value](specified_value)
* [Used value](used_value)
### Layout
* [Block formatting context](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context)
* [Box model](css_box_model/introduction_to_the_css_box_model)
* [Containing block](containing_block)
* [Layout mode](layout_mode)
* [Margin collapsing](css_box_model/mastering_margin_collapsing)
* [Replaced elements](replaced_element)
* [Stacking context](css_positioning/understanding_z_index/the_stacking_context)
* [Visual formatting model](visual_formatting_model)
DOM-CSS / CSSOM
---------------
### Major object types
* [`Document.styleSheets`](https://developer.mozilla.org/en-US/docs/Web/API/Document/styleSheets)
* `[styleSheets](https://developer.mozilla.org/en-US/docs/Web/API/StyleSheetList)[i].[cssRules](https://developer.mozilla.org/en-US/docs/Web/API/CSSRuleList)`
* `cssRules[i].[cssText](https://developer.mozilla.org/en-US/docs/Web/API/CSSRule/cssText)` (selector & style)
* `cssRules[i].[selectorText](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleRule/selectorText)`
* [`HTMLElement.style`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style)
* `HTMLElement.style.[cssText](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/cssText)` (just style)
* [`Element.className`](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)
* [`Element.classList`](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList)
### Important methods
* [`CSSStyleSheet.insertRule()`](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule)
* [`CSSStyleSheet.deleteRule()`](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/deleteRule)
See also
--------
* [Mozilla CSS extensions](https://developer.mozilla.org/en-US/docs/Web/CSS/Mozilla_Extensions) (prefixed with `-moz-`)
* [WebKit CSS extensions](https://developer.mozilla.org/en-US/docs/Web/CSS/WebKit_Extensions) (mostly prefixed with `-webkit-`)
* [Microsoft CSS extensions](https://developer.mozilla.org/en-US/docs/Web/CSS/Microsoft_Extensions) (prefixed with `-ms-`)
External Links
--------------
* [CSS Indices (w3.org)](https://www.w3.org/TR/CSS/#indices)
| programming_docs |
css revert revert
======
The `revert` CSS keyword reverts the cascaded value of the property from its current value to the value the property would have had if no changes had been made by the current **[style origin](https://developer.mozilla.org/en-US/docs/Glossary/Style_origin)** to the current element. Thus, it resets the property to its inherited value if it inherits from its parent or to the default value established by the user agent's stylesheet (or by user styles, if any exist). It can be applied to any CSS property, including the CSS shorthand property [`all`](all).
This keyword removes from the cascade all of the styles that have been overridden until the style being rolled back to is reached.
* If used by a site's own styles (the author origin), `revert` rolls back the property's cascaded value to the user's custom style, if one exists; otherwise, it rolls the style back to the user agent's default style.
* If used in a user's custom stylesheet, or if the style was applied by the user (the user origin), `revert` rolls back the cascaded value to the user agent's default style.
* If used within the user agent's default styles, this keyword is functionally equivalent to [`unset`](unset).
The `revert` keyword works exactly the same as [`unset`](unset) in many cases. The only difference is for properties that have values set by the browser or by custom stylesheets created by users (set on the browser side).
Revert will not affect rules applied to children of an element you reset (but will remove effects of a parent rule on a child). So if you have a `color: green` for all sections and `all: revert` on a specific section, the color of the section will be black. But if you have a rule to make all paragraphs red, then all paragraphs will still be red in all sections.
**Note:** Revert is just a value. It is still possible to override the `revert` value using <specificity>.
**Note:** The `revert` keyword is different from and should not be confused with the [`initial`](initial) keyword, which uses the [initial value](initial_value) defined on a per-property basis by the CSS specifications. In contrast, user-agent stylesheets set default values on the basis of CSS selectors.
For example, the [initial value](initial_value) for the [`display`](display#formal_definition) property is `inline`, whereas a normal user-agent stylesheet sets the default [`display`](display) value of [`<div>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div)s to `block`, of [`<table>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table)s to `table`, etc.
Examples
--------
### Revert vs unset
Although `revert` and `unset` are similar, they differ for some properties for some elements.
So in the below example, we set custom [`font-weight`](font-weight#formal_definition), but then try to `revert` and `unset` it inline in the HTML document. The `revert` keyword will revert the text to bold because that is the default value for headers in most browsers. The `unset` keyword will keep the text normal because, as an inherited property, the `font-weight` would then inherit its value from the body.
#### HTML
```
<h3 style="font-weight: revert; color: revert;">
This should have its original font-weight (bold) and color: black
</h3>
<p>Just some text</p>
<h3 style="font-weight: unset; color: unset;">
This will still have font-weight: normal, but color: black
</h3>
<p>Just some text</p>
```
#### CSS
```
h3 {
font-weight: normal;
color: blue;
}
```
#### Result
### Revert all
Reverting all values is useful in a situation where you've made several style changes and then you want to revert to the browser default values. So in the above example, instead of reverting `font-weight` and `color` separately, you could just revert all of them at once - by applying the `revert` keyword on `all`.
#### HTML
```
<h3>This will have custom styles</h3>
<p>Just some text</p>
<h3 style="all: revert">This should be reverted to browser/user defaults.</h3>
<p>Just some text</p>
```
#### CSS
```
h3 {
font-weight: normal;
color: blue;
border-bottom: 1px solid grey;
}
```
#### Result
### Revert on a parent
Reverting effectively removes the value for the element you select with some rule and this happens only for that element. To illustrate this, we will set a green color on a section and red color on a paragraph.
#### HTML
```
<section>
<h3>This will be dark green</h3>
<p>Text in paragraph will be red.</p>
This will also be dark green.
</section>
<section class="with-revert">
<h3>This will be black</h3>
<p>Text in paragraph will be red.</p>
This will also be black.
</section>
```
#### CSS
```
section {
color: darkgreen;
}
p {
color: red;
}
section.with-revert {
color: revert;
}
```
Notice how paragraph still has a red color even though a color property for the section was reverted. Also note that both the header and plain text node are black. This is exactly the same as if `section { color: darkgreen }` would not exist for the second section.
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Cascading and Inheritance Level 4 # default](https://w3c.github.io/csswg-drafts/css-cascade/#default) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `revert` | 84 | 84 | 67 | No | 70 | 9.1 | 84 | 84 | 67 | 60 | 9.3 | 14.0 |
See also
--------
* Use the [`initial`](initial) keyword to set a property to its initial value.
* Use the [`inherit`](inherit) keyword to make an element's property the same as its parent.
* Use the [`revert-layer`](revert-layer) keyword to reset a property to the value established in a previous cascade layer.
* Use the [`unset`](unset) keyword to set a property to its inherited value if it inherits or to its initial value if not.
* The [`all`](all) property lets you reset all properties to their initial, inherited, reverted, or unset state at once.
css text-emphasis-color text-emphasis-color
===================
The `text-emphasis-color` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the color of emphasis marks. This value can also be set using the [`text-emphasis`](text-emphasis) shorthand.
Try it
------
Syntax
------
```
/\* Initial value \*/
text-emphasis-color: currentcolor;
/\* <color> \*/
text-emphasis-color: #555;
text-emphasis-color: blue;
text-emphasis-color: rgba(90, 200, 160, 0.8);
text-emphasis-color: transparent;
/\* Global values \*/
text-emphasis-color: inherit;
text-emphasis-color: initial;
text-emphasis-color: revert;
text-emphasis-color: revert-layer;
text-emphasis-color: unset;
```
### Values
`<color>` Defines the color of the emphasis marks. If no color is present, it defaults to `currentcolor`.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `currentcolor` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | computed color |
| Animation type | a [color](color_value#interpolation) |
Formal syntax
-------------
```
text-emphasis-color =
[<color>](color_value)
```
Examples
--------
### Emphasis with a color and custom character
#### CSS
```
em {
text-emphasis-color: green;
text-emphasis-style: "\*";
}
```
#### HTML
```
<p>Here's an example:</p>
<em>This has emphasis marks!</em>
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Text Decoration Module Level 3 # text-emphasis-color-property](https://w3c.github.io/csswg-drafts/css-text-decor/#text-emphasis-color-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `text-emphasis-color` | 99
25 | 99
79 | 46 | No | 15 | 7
7 | 4.4 | 99
25 | 46 | 14 | 7
7 | 18.0
1.5 |
See also
--------
* The [`<color>`](color_value) data type
* The other emphasis mark related properties: [`text-emphasis-style`](text-emphasis-style), [`text-emphasis`](text-emphasis), and [`text-emphasis-position`](text-emphasis-position).
* Other color-related properties: [`color`](color), [`background-color`](background-color), [`border-color`](border-color), [`outline-color`](outline-color), [`text-emphasis-color`](text-emphasis-color), [`text-shadow`](text-shadow), [`caret-color`](caret-color), and [`column-rule-color`](column-rule-color)
* [Applying color to HTML elements using CSS](css_colors/applying_color)
css outline-style outline-style
=============
The `outline-style` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the style of an element's outline. An outline is a line that is drawn around an element, outside the [`border`](border).
Try it
------
It is often more convenient to use the shorthand property [`outline`](outline) when defining the appearance of an outline.
Syntax
------
```
/\* Keyword values \*/
outline-style: auto;
outline-style: none;
outline-style: dotted;
outline-style: dashed;
outline-style: solid;
outline-style: double;
outline-style: groove;
outline-style: ridge;
outline-style: inset;
outline-style: outset;
/\* Global values \*/
outline-style: inherit;
outline-style: initial;
outline-style: revert;
outline-style: revert-layer;
outline-style: unset;
```
The `outline-style` property is specified as any one of the values listed below.
### Values
`auto` Permits the user agent to render a custom outline style.
`none` No outline is used. The [`outline-width`](outline-width) is `0`.
`dotted` The outline is a series of dots.
`dashed` The outline is a series of short line segments.
`solid` The outline is a single line.
`double` The outline is two single lines. The [`outline-width`](outline-width) is the sum of the two lines and the space between them.
`groove` The outline looks as though it were carved into the page.
`ridge` The opposite of `groove`: the outline looks as though it were extruded from the page.
`inset` The outline makes the box look as though it were embedded in the page.
`outset` The opposite of `inset`: the outline makes the box look as though it were coming out of the page.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
outline-style =
auto [|](value_definition_syntax#single_bar)
[<outline-line-style>](outline-line-style)
```
Examples
--------
### Setting outline style to auto
The `auto` value indicates a custom outline style, described in [the specification](https://www.w3.org/TR/css-ui-3/#outline-style) as "typically a style [that] is either a user interface default for the platform, or perhaps a style that is richer than can be described in detail in CSS, e.g. a rounded edge outline with semi-translucent outer pixels that appears to glow".
#### HTML
```
<div>
<p class="auto">Outline Demo</p>
</div>
```
#### CSS
```
.auto {
outline-style: auto; /\* same result as "outline: auto" \*/
}
/\* To make the Demo clearer \*/
\* {
outline-width: 10px;
padding: 15px;
}
```
#### Result
### Setting outline style to dashed and dotted
#### HTML
```
<div>
<div class="dotted">
<p class="dashed">Outline Demo</p>
</div>
</div>
```
#### CSS
```
.dotted {
outline-style: dotted; /\* same result as "outline: dotted" \*/
}
.dashed {
outline-style: dashed;
}
/\* To make the Demo clearer \*/
\* {
outline-width: 10px;
padding: 15px;
}
```
#### Result
### Setting outline style to solid and double
#### HTML
```
<div>
<div class="solid">
<p class="double">Outline Demo</p>
</div>
</div>
```
#### CSS
```
.solid {
outline-style: solid;
}
.double {
outline-style: double;
}
/\* To make the Demo clearer \*/
\* {
outline-width: 10px;
padding: 15px;
}
```
#### Result
### Setting outline style to groove and ridge
#### HTML
```
<div>
<div class="groove">
<p class="ridge">Outline Demo</p>
</div>
</div>
```
#### CSS
```
.groove {
outline-style: groove;
}
.ridge {
outline-style: ridge;
}
/\* To make the Demo clearer \*/
\* {
outline-width: 10px;
padding: 15px;
}
```
#### Result
### Setting outline style to inset and outset
#### HTML
```
<div>
<div class="inset">
<p class="outset">Outline Demo</p>
</div>
</div>
```
#### CSS
```
.inset {
outline-style: inset;
}
.outset {
outline-style: outset;
}
/\* To make the Demo clearer \*/
\* {
outline-width: 10px;
padding: 15px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Basic User Interface Module Level 4 # outline-style](https://w3c.github.io/csswg-drafts/css-ui/#outline-style) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `outline-style` | 1 | 12 | 1.5
Before Firefox 88, an outline does not follow the shape of `border-radius`.
1-3.6 | 8 | 7 | 1.2 | 2 | 18 | 4
Before Firefox 88, an outline does not follow the shape of `border-radius`. | 10.1 | 1 | 1.0 |
| `auto` | 1 | 79 | 1.5 | No | 15 | 1.2 | ≤37 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [`outline`](outline)
* [`outline-color`](outline-color)
* [`outline-width`](outline-width)
css contain-intrinsic-block-size contain-intrinsic-block-size
============================
The `contain-intrinsic-block-size` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [logical property](css_logical_properties) defines the block size of an element that a browser can use for layout when the element is subject to [size containment](css_containment#size_containment).
Block size is the size of an element in the dimension perpendicular to the flow of text within a line. In a horizontal [writing mode](writing-mode) like standard English, block size is the vertical dimension (height); in a vertical writing mode, block size is the horizontal dimension.
Syntax
------
```
/\* Keyword values \*/
contain-intrinsic-block-size: none;
/\* <length> values \*/
contain-intrinsic-block-size: 1000px;
contain-intrinsic-block-size: 10rem;
/\* auto <length> \*/
contain-intrinsic-block-size: auto 300px;
/\* Global values \*/
contain-intrinsic-block-size: inherit;
contain-intrinsic-block-size: initial;
contain-intrinsic-block-size: revert;
contain-intrinsic-block-size: revert-layer;
contain-intrinsic-block-size: unset;
```
### Values
The following values can be specified for the intrinsic block size of an element:
`none` The element has no intrinsic block size.
`<length>` The element has the specified block size, expressed using the ([`<length>`](length)) data type.
`auto <length>` When the element is in size containment and skipping its contents (for example, when it is offscreen and `content-visibility: auto` is set) the block size is remembered from the actual size of the element when it was last able to render its child elements. If the element has never rendered its child elements and hence has no remembered value for the normally rendered element size, or if it is not skipping its contents, the block size is the specified `<length>`.
Description
-----------
The property is commonly applied alongside elements that can trigger size containment, such as [`contain: size`](contain) and [`content-visibility`](content-visibility).
Size containment allows a user agent to lay out an element as though it had a fixed size. This prevents unnecessary reflows by avoiding the re-rendering of child elements to determine the actual size (thereby improving user experience). By default, size containment treats elements as though they had no contents and may collapse the layout in the same way as if the contents had no width or height. The `contain-intrinsic-block-size` property allows authors to specify an appropriate value to be used as the block-size for layout.
The `auto <length>` value allows the block-size of an element to be stored if the element is ever "normally rendered" (with its child elements) and then used instead of the specified value when the element does not have any content. This allows offscreen elements with [`content-visibility: auto`](content-visibility) to benefit from size containment without developers having to be precise in their estimates of element size. The remembered value is not used if the child elements are being rendered; if size containment is enabled, the `<length>` value will be used.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | elements for which size containment can apply |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified, with <length>s values computed |
| Animation type | by computed value type |
Formal syntax
-------------
```
contain-intrinsic-block-size =
none [|](value_definition_syntax#single_bar)
[<length>](length) [|](value_definition_syntax#single_bar)
auto [<length>](length)
```
Examples
--------
### Setting the intrinsic block size
The HTML below defines an element "contained\_element" that will be subject to size constraint, and which contains a child element.
```
<div id="contained\_element">
<div class="child\_element"></div>
</div>
```
The CSS below sets the [`content-visibility`](content-visibility) of `contained_element` to `auto`, so if the element is hidden it will be size constrained. The intrinsic block size and inline size that are used when it is size constrained are set at the same time using `contain-intrinsic-block-size` and `contain-intrinsic-inline-size`, respectively.
```
#contained\_element {
border: 2px solid green;
inline-size: 151px;
content-visibility: auto;
contain-intrinsic-inline-size: 152px;
contain-intrinsic-block-size: 52px;
}
.child\_element {
border: 1px solid red;
background: blue;
block-size: 50px;
inline-size: 150px;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Box Sizing Module Level 4 # propdef-contain-intrinsic-block-size](https://w3c.github.io/csswg-drafts/css-sizing-4/#propdef-contain-intrinsic-block-size) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `contain-intrinsic-block-size` | 95 | 95 | 107 | No | 81 | No | 95 | 95 | 107 | 67 | No | 17.0 |
See also
--------
* [content-visibility: the new CSS property that boosts your rendering performance](https://web.dev/content-visibility/) (web.dev)
* [`contain-intrinsic-inline-size`](contain-intrinsic-inline-size)
* [`contain-intrinsic-size`](contain-intrinsic-size)
* [`contain-intrinsic-width`](contain-intrinsic-width)
* [`contain-intrinsic-height`](contain-intrinsic-height)
css CSS Fonts CSS Fonts
=========
**CSS Fonts** is a module of CSS that defines font-related properties and how font resources are loaded. It lets you define the style of a font, such as its family, size and weight, line height, and the glyph variants to use when multiple are available for a single character.
Basic example
-------------
The following example shows a simple use of basic font properties to style a paragraph of text.
```
p {
width: 600px;
margin: 0 auto;
font-family: "Helvetica Neue", "Arial", sans-serif;
font-style: italic;
font-weight: 100;
font-variant-ligatures: normal;
font-size: 2rem;
letter-spacing: 1px;
}
```
```
<p>
Three hundred years ago<br />
I thought I might get some sleep<br />
I stretched myself out on an antique bed<br />
An' my spirit did a midnite creep
</p>
```
The result is as follows:
Variable fonts examples
-----------------------
You can find a number of variable fonts examples at [v-fonts.com](https://v-fonts.com/) and [axis-praxis.org](https://www.axis-praxis.org/); see also our [Variable fonts guide](css_fonts/variable_fonts_guide) for more information and usage information.
Reference
---------
### Properties
* [`font`](font)
* [`font-family`](font-family)
* [`font-feature-settings`](font-feature-settings)
* [`font-kerning`](font-kerning)
* [`font-language-override`](font-language-override)
* [`font-optical-sizing`](font-optical-sizing)
* [`font-size`](font-size)
* [`font-size-adjust`](font-size-adjust)
* [`font-stretch`](font-stretch)
* [`font-style`](font-style)
* [`font-synthesis`](font-synthesis)
* [`font-variant`](font-variant)
* [`font-variant-alternates`](font-variant-alternates)
* [`font-variant-caps`](font-variant-caps)
* [`font-variant-east-asian`](font-variant-east-asian)
* [`font-variant-ligatures`](font-variant-ligatures)
* [`font-variant-numeric`](font-variant-numeric)
* [`font-variant-position`](font-variant-position)
* [`font-variation-settings`](font-variation-settings)
* [`font-weight`](font-weight)
* [`line-height`](line-height)
### At-rules
* [`@font-face`](@font-face)
* [`@font-feature-values`](@font-feature-values)
Guides
------
[Fundamental text and font styling](https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_text/Fundamentals) In this beginner's learning article we go through all the basic fundamentals of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing.
[OpenType font features guide](css_fonts/opentype_fonts_guide) Font features or variants refer to different glyphs or character styles contained within an OpenType font. These include things like ligatures (special glyphs that combine characters like 'fi' or 'ffl'), kerning (adjustments to the spacing between specific letterform pairings), fractions, numeral styles, and a number of others. These are all referred to as OpenType Features, and are made available to use on the web via specific properties and a low-level control property — [`font-feature-settings`](font-feature-settings). This article provides you with all you need to know about using OpenType font features in CSS.
[Variable fonts guide](css_fonts/variable_fonts_guide) **Variable fonts** are an evolution of the OpenType font specification that enables many different variations of a typeface to be incorporated into a single file, rather than having a separate font file for every width, weight, or style. This article will give you all you need to know to get you started using variable fonts.
Specifications
--------------
| Specification |
| --- |
| [CSS Fonts Module Level 4](https://drafts.csswg.org/css-fonts/) |
| programming_docs |
css border-inline-width border-inline-width
===================
The `border-inline-width` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the width of the logical inline borders of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. It corresponds to the [`border-top-width`](border-top-width) and [`border-bottom-width`](border-bottom-width), or [`border-left-width`](border-left-width), and [`border-right-width`](border-right-width) property depending on the values defined for [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation).
Try it
------
The border width in the other dimension can be set with [`border-block-width`](border-block-width), which sets [`border-block-start-width`](border-block-start-width), and [`border-block-end-width`](border-block-end-width).
Syntax
------
```
/\* <'border-width'> values \*/
border-inline-width: 5px 10px;
border-inline-width: 5px;
border-inline-width: thick;
/\* Global values \*/
border-inline-width: inherit;
border-inline-width: initial;
border-inline-width: revert;
border-inline-width: revert-layer;
border-inline-width: unset;
```
### Values
`<'border-width'>` The width of the border. See [`border-width`](border-width).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `medium` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| Percentages | logical-width of containing block |
| [Computed value](computed_value) | absolute length; `0` if the border style is `none` or `hidden` |
| Animation type | discrete |
Formal syntax
-------------
```
border-inline-width =
<'border-top-width'>[{1,2}](value_definition_syntax#curly_braces)
```
Examples
--------
### HTML
```
<div>
<p class="exampleText">Example text</p>
</div>
```
### CSS
```
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-lr;
border: 1px solid blue;
border-inline-width: 5px 10px;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # propdef-border-inline-width](https://w3c.github.io/csswg-drafts/css-logical/#propdef-border-inline-width) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-inline-width` | 87 | 87 | 66 | No | 73 | 14.1 | 87 | 87 | 66 | 62 | 14.5 | 14.0 |
See also
--------
* [CSS Logical Properties and Values](css_logical_properties)
* This property maps to one of the physical border properties: [`border-top-width`](border-top-width), [`border-right-width`](border-right-width), [`border-bottom-width`](border-bottom-width), and [`border-left-width`](border-left-width)
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)
css CSS Text CSS Text
========
**CSS Text** is a module of CSS that defines how to perform text manipulation, like line breaking, justification and alignment, white space handling, and text transformation.
Reference
---------
### Properties
* [`hanging-punctuation`](hanging-punctuation)
* [`hyphenate-limit-chars`](hyphenate-limit-chars)
* [`hyphens`](hyphens)
* [`letter-spacing`](letter-spacing)
* [`line-break`](line-break)
* [`overflow-wrap`](overflow-wrap)
* [`tab-size`](tab-size)
* [`text-align`](text-align)
* [`text-align-last`](text-align-last)
* [`text-indent`](text-indent)
* [`text-justify`](text-justify)
* [`text-size-adjust`](text-size-adjust)
* [`text-transform`](text-transform)
* [`white-space`](white-space)
* [`word-break`](word-break)
* [`word-spacing`](word-spacing)
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1](https://drafts.csswg.org/css-logical/) |
| [CSS Text Module Level 3](https://drafts.csswg.org/css-text/) |
| [CSS Text Module Level 4](https://drafts.csswg.org/css-text-4/) |
css border-top border-top
==========
The `border-top` [shorthand](shorthand_properties) [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets all the properties of an element's top <border>.
Try it
------
As with all shorthand properties, `border-top` always sets the values of all of the properties that it can set, even if they are not specified. It sets those that are not specified to their default values. Consider the following code:
```
border-top-style: dotted;
border-top: thick green;
```
It is actually the same as this one:
```
border-top-style: dotted;
border-top: none thick green;
```
The value of [`border-top-style`](border-top-style) given before `border-top` is ignored. Since the default value of [`border-top-style`](border-top-style) is `none`, not specifying the `border-style` part results in no border.
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`border-top-color`](border-top-color)
* [`border-top-style`](border-top-style)
* [`border-top-width`](border-top-width)
Syntax
------
```
border-top: 1px;
border-top: 2px dotted;
border-top: medium dashed green;
/\* Global values \*/
border-top: inherit;
border-top: initial;
border-top: revert;
border-top: revert-layer;
border-top: unset;
```
The three values of the shorthand property can be specified in any order, and one or two of them may be omitted.
### Values
`<br-width>` See [`border-top-width`](border-top-width).
`<br-style>` See [`border-top-style`](border-top-style).
[`<color>`](color_value) See [`border-top-color`](border-top-color).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`border-top-width`](border-top-width): `medium`
* [`border-top-style`](border-top-style): `none`
* [`border-top-color`](border-top-color): `currentcolor`
|
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`border-top-width`](border-top-width): the absolute length or `0` if [`border-top-style`](border-top-style) is `none` or `hidden`
* [`border-top-style`](border-top-style): as specified
* [`border-top-color`](border-top-color): computed color
|
| Animation type | as each of the properties of the shorthand:* [`border-top-color`](border-top-color): a [color](color_value#interpolation)
* [`border-top-style`](border-top-style): discrete
* [`border-top-width`](border-top-width): a [length](length#interpolation)
|
Formal syntax
-------------
```
border-top =
<line-width> [||](value_definition_syntax#double_bar)
<line-style> [||](value_definition_syntax#double_bar)
[<color>](color_value)
<line-width> =
[<length [0,∞]>](length) [|](value_definition_syntax#single_bar)
thin [|](value_definition_syntax#single_bar)
medium [|](value_definition_syntax#single_bar)
thick
<line-style> =
none [|](value_definition_syntax#single_bar)
hidden [|](value_definition_syntax#single_bar)
dotted [|](value_definition_syntax#single_bar)
dashed [|](value_definition_syntax#single_bar)
solid [|](value_definition_syntax#single_bar)
double [|](value_definition_syntax#single_bar)
groove [|](value_definition_syntax#single_bar)
ridge [|](value_definition_syntax#single_bar)
inset [|](value_definition_syntax#single_bar)
outset
```
Examples
--------
### Applying a top border
#### HTML
```
<div>This box has a border on the top side.</div>
```
#### CSS
```
div {
border-top: 4px dashed blue;
background-color: gold;
height: 100px;
width: 100px;
font-weight: bold;
text-align: center;
}
```
#### Results
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # border-shorthands](https://w3c.github.io/csswg-drafts/css-backgrounds/#border-shorthands) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-top` | 1 | 12 | 1 | 4 | 3.5 | 1 | 4.4 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [`border`](border)
* [`border-block`](border-block)
* [`outline`](outline)
css animation-duration animation-duration
==================
The `animation-duration` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the length of time that an animation takes to complete one cycle.
Try it
------
It is often convenient to use the shorthand property [`animation`](animation) to set all animation properties at once.
Syntax
------
```
/\* Single animation \*/
animation-duration: 6s;
animation-duration: 120ms;
/\* Multiple animations \*/
animation-duration: 1.64s, 15.22s;
animation-duration: 10s, 35s, 230ms;
/\* Global values \*/
animation-duration: inherit;
animation-duration: initial;
animation-duration: revert;
animation-duration: revert-layer;
animation-duration: unset;
```
### Values
`[`<time>`](time)` The time that an animation takes to complete one cycle. This may be specified in either seconds (`s`) or milliseconds (`ms`). The value must be positive or zero and the unit is required.
If no value is provided, the default value of `0s` is used, in which case the animation still executes (the [`animationStart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationstart_event) and [`animationEnd`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationend_event) events are fired). Whether or not the animation will be visible when the duration is `0s` will depend on the value of [`animation-fill-mode`](animation-fill-mode), as explained below:
* If `animation-fill-mode` is set to `backwards` or `both`, the first frame of the animation as defined by `animation-direction` will be displayed during [`animation-delay`](animation-delay) countdown.
* If `animation-fill-mode` is set to `forwards` or `both`, the last frame of the animation will be displayed, as defined by `animation-direction`, after the `animation-delay` expires.
* If `animation-fill-mode` is set to `none`, the animation will have no visible effect.
**Note:** Negative values are invalid, causing the declaration to be ignored. Some early, prefixed, implementations may consider them as identical to `0s`.
**Note:** When you specify multiple comma-separated values on an `animation-*` property, they are applied to the animations in the order in which the [`animation-name`](animation-name)s appear. For situations where the number of animations and `animation-*` property values do not match, see [Setting multiple animation property values](css_animations/using_css_animations#setting_multiple_animation_property_values).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0s` |
| Applies to | all elements, [`::before`](::before) and [`::after`](::after) <pseudo-elements> |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | Not animatable |
Formal syntax
-------------
```
animation-duration =
[<time [0s,∞]>](time)[#](value_definition_syntax#hash_mark)
```
Examples
--------
### Setting animation duration
This animation has an animation-duration of 0.7 seconds.
#### HTML
```
<div class="box"></div>
```
#### CSS
```
.box {
background-color: rebeccapurple;
border-radius: 10px;
width: 100px;
height: 100px;
}
.box:hover {
animation-name: rotate;
animation-duration: 0.7s;
}
@keyframes rotate {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}
```
#### Result
Hover over the rectangle to start the animation.
See [CSS animations](css_animations/using_css_animations) for more examples.
Specifications
--------------
| Specification |
| --- |
| [CSS Animations Level 1 # animation-duration](https://w3c.github.io/csswg-drafts/css-animations/#animation-duration) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `animation-duration` | 43
3 | 12
12 | 49
16
5 | 10
Once the element has loaded, changing the value of this property has no effect. | 30
15
12.1-15
12-15 | 9
4 | 43
2 | 43
18 | 49
16
5 | 30
14
12.1-14
12-14 | 9
4.2 | 4.0
1.0 |
See also
--------
* [Using CSS animations](css_animations/using_css_animations)
* JavaScript [`AnimationEvent`](https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent) API
* Other related animation properties: [`animation`](animation), [`animation-composition`](animation-composition), [`animation-delay`](animation-delay), [`animation-direction`](animation-direction), [`animation-fill-mode`](animation-fill-mode), [`animation-iteration-count`](animation-iteration-count), [`animation-name`](animation-name), [`animation-play-state`](animation-play-state), [`animation-timeline`](animation-timeline), [`animation-timing-function`](animation-timing-function)
css ::placeholder ::placeholder
=============
The `::placeholder` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-element](pseudo-elements) represents the [placeholder text](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-placeholder) in an [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) or [`<textarea>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) element.
Try it
------
Only the subset of CSS properties that apply to the [`::first-line`](::first-line) pseudo-element can be used in a rule using `::placeholder` in its selector.
**Note:** In most browsers, the appearance of placeholder text is a translucent or light gray color by default.
Syntax
------
```
::placeholder
```
Accessibility concerns
----------------------
### Color contrast
#### Contrast Ratio
Placeholder text typically has a lighter color treatment to indicate that it is a suggestion for what kind of input will be valid, and is not actual input of any kind.
It is important to ensure that the contrast ratio between the color of the placeholder text and the background of the input is high enough that people experiencing low vision conditions will be able to read it while also making sure there is enough of a difference between the placeholder text and input text color that users do not mistake the placeholder for inputted data.
Color contrast ratio is determined by comparing the luminosity of the placeholder text and the input background color values. In order to meet current [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/standards-guidelines/wcag/), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and bold or larger, or 24px or larger.
* [WebAIM: Color Contrast Checker](https://webaim.org/resources/contrastchecker/)
* [MDN Understanding WCAG, Guideline 1.4 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background)
* [Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html)
#### Usability
Placeholder text with sufficient color contrast may be interpreted as entered input. Placeholder text will also disappear when a person enters content into an [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) element. Both of these circumstances can interfere with successful form completion, especially for people with cognitive concerns.
An alternate approach to providing placeholder information is to include it outside of the input in close visual proximity, then use [`aria-describedby`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) to programmatically associate the [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) with its hint.
With this implementation, the hint content is available even if information is entered into the input field, and the input appears free of preexisting input when the page is loaded. Most screen reading technology will use `aria-describedby` to read the hint after the input's label text is announced, and the person using the screen reader can mute it if they find the extra information unnecessary.
```
<label for="user-email">Your email address</label>
<span id="user-email-hint" class="input-hint">Example: [email protected]</span>
<input
id="user-email"
aria-describedby="user-email-hint"
name="email"
type="email" />
```
* [Placeholders in Form Fields Are Harmful — Nielsen Norman Group](https://www.nngroup.com/articles/form-design-placeholders/)
### Windows High Contrast Mode
Placeholder text will appear with the same styling as user-entered text content when rendered in [Windows High Contrast Mode](@media/-ms-high-contrast). This will make it difficult for some people to determine which content has been entered, and which content is placeholder text.
* [Greg Whitworth — How to use -ms-high-contrast](https://www.gwhitworth.com/posts/2017/how-to-use-ms-high-contrast/)
### Labels
Placeholders are not a replacement for the [`<label>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label) element. Without a label that has been programmatically associated with an input using a combination of the [`for`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#attr-for) and [`id`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#id) attributes, assistive technology such as screen readers cannot parse [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) elements.
* [MDN Basic form hints](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA)
* [Placeholders in Form Fields Are Harmful — Nielsen Norman Group](https://www.nngroup.com/articles/form-design-placeholders/)
Examples
--------
### Change placeholder appearance
This example shows some of the adjustments that you can make to the styles of placeholder text.
#### HTML
```
<input placeholder="Type here" />
```
#### CSS
```
input::placeholder {
color: red;
font-size: 1.2em;
font-style: italic;
}
```
#### Result
### Opaque text
Some browsers (such as Firefox) set the default [`opacity`](opacity) of placeholders to something less than 100%. If you want fully opaque placeholder text, set `opacity` to `1`.
#### HTML
```
<input placeholder="Default opacity" />
<input placeholder="Full opacity" class="force-opaque" />
```
#### CSS
```
::placeholder {
color: green;
}
.force-opaque::placeholder {
opacity: 1;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Pseudo-Elements Module Level 4 # placeholder-pseudo](https://w3c.github.io/csswg-drafts/css-pseudo/#placeholder-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `::placeholder` | 57
6 | 79
12
12-79 | 51
19 | No | 44
15 | 10.1
5 | 57
2 | 57
18 | 51
19 | 43
14 | 10.3
4.2 | 7.0
1.0 |
See also
--------
* The [`:placeholder-shown`](:placeholder-shown) pseudo-class styles an element that *has* an active placeholder.
* Related HTML elements: [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input), [`<textarea>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea)
* [HTML forms](https://developer.mozilla.org/en-US/docs/Learn/Forms)
| programming_docs |
css max-block-size max-block-size
==============
The `max-block-size` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property specifies the maximum size of an element in the direction opposite that of the writing direction as specified by [`writing-mode`](writing-mode). That is, if the writing direction is horizontal, then `max-block-size` is equivalent to [`max-height`](max-height); if the writing direction is vertical, `max-block-size` is the same as [`max-width`](max-width).
The other dimension's maximum length is specified using the [`max-inline-size`](max-inline-size) property.
This is useful because the `max-width` is always used for horizontal sizes and `max-height` is always used for vertical sizes, and if you need to set lengths based on the size of your text content, you need to be able to do so with the writing direction in mind.
Any time you would normally use `max-height` or `max-width`, you should instead use `max-block-size` to set the maximum "height" of the content (even though this may not be a vertical value) and `max-inline-size` to set the maximum "width" of the content (although this may instead be vertical rather than horizontal). See the [Example](writing-mode#example) in <writing-mode>, which shows the different writing modes in action.
Try it
------
Syntax
------
```
/\* <length> values \*/
max-block-size: 300px;
max-block-size: 25em;
/\* <percentage> values \*/
max-block-size: 75%;
/\* Keyword values \*/
max-block-size: none;
max-block-size: max-content;
max-block-size: min-content;
max-block-size: fit-content(20em);
/\* Global values \*/
max-block-size: inherit;
max-block-size: initial;
max-block-size: revert;
max-block-size: revert-layer;
max-block-size: unset;
```
### Values
The `max-block-size` property's value can be any value that's legal for the [`max-width`](max-width) and [`max-height`](max-height) properties:
[`<length>`](length) Defines the `max-block-size` as an absolute value.
[`<percentage>`](percentage) Defines the `max-block-size` as a percentage of the containing block's size in block axis.
`none` No limit on the size of the box.
`max-content` The intrinsic preferred `max-block-size`.
`min-content` The intrinsic minimum `max-block-size`.
`fit-content([`<length-percentage>`](length-percentage))` Uses the `fit-content` formula with the available space replaced by the specified argument, i.e. `min(max-content, max(min-content, argument))`.
### How writing-mode affects directionality
The values of `writing-mode` affect the mapping of `max-block-size` to `max-width` or `max-height` as follows:
| Values of `writing-mode` | `max-block-size` is equivalent to |
| --- | --- |
| `horizontal-tb`, `lr` Deprecated , `lr-tb` Deprecated , `rl` Deprecated , `rb` Deprecated , `rb-rl` Deprecated | [`max-height`](max-height) |
| `vertical-rl`, `vertical-lr`, `sideways-rl` Experimental , `sideways-lr` Experimental , `tb` Deprecated , `tb-rl` Deprecated | [`max-width`](max-width) |
**Note:** The `writing-mode` values `sideways-lr` and `sideways-rl` were removed from the CSS Writing Modes Level 3 specification late in its design process. They may be restored in Level 4.
**Note:** The writing modes `lr`, `lr-tb`, `rl`, `rb`, and `rb-tl` are no longer allowed in [HTML](https://developer.mozilla.org/en-US/docs/Glossary/HTML) contexts; they may only be used in [SVG](https://developer.mozilla.org/en-US/docs/Glossary/SVG) 1.x contexts.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | same as [`width`](width) and [`height`](height) |
| [Inherited](inheritance) | no |
| Percentages | block-size of containing block |
| [Computed value](computed_value) | same as [`max-width`](max-width) and [`max-height`](max-height) |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
max-block-size =
<'max-width'>
```
Examples
--------
### Setting max-block-size with horizontal and vertical text
In this example, the same text (the opening sentences from [Herman Melville's](https://en.wikipedia.org/wiki/Herman_Melville) novel *[Moby-Dick](https://en.wikipedia.org/wiki/Moby-Dick)*) is presented in both the `horizontal-tb` and `vertical-rl` writing modes.
Everything else about the two boxes is identical, including the values used for [`max-block-size`](max-block-size).
#### HTML
The HTML establishes the two [`<div>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div) blocks that will be presented with their [`writing-mode`](writing-mode) set using the classes `horizontal` or `vertical`. Both boxes share the `standard-box` class, which establishes coloring, padding, and their respective values of `max-block-size`.
```
<p>Writing mode <code>horizontal-tb</code> (the default):</p>
<div class="standard-box horizontal">
Call me Ishmael. Some years ago—never mind how long precisely—having little or
no money in my purse, and nothing particular to interest me on shore, I
thought I would sail about a little and see the watery part of the world. It
is a way I have of driving off the spleen and regulating the circulation.
</div>
<p>Writing mode <code>vertical-rl</code>:</p>
<div class="standard-box vertical">
Call me Ishmael. Some years ago—never mind how long precisely—having little or
no money in my purse, and nothing particular to interest me on shore, I
thought I would sail about a little and see the watery part of the world. It
is a way I have of driving off the spleen and regulating the circulation.
</div>
```
#### CSS
The CSS defines three classes. The first, `standard-box`, is applied to both boxes, as seen above. It provides standard styling including the minimum and maximum block sizes, font size, and so forth.
After that come the classes `horizontal` and `vertical`, which add the [`writing-mode`](writing-mode) property to the box, with the value set to `horizontal-tb` or `vertical-rl` depending on which class is used.
```
.standard-box {
padding: 4px;
background-color: #abcdef;
color: #000;
font: 16px "Open Sans", "Helvetica", "Arial", sans-serif;
max-block-size: 160px;
min-block-size: 100px;
}
.horizontal {
writing-mode: horizontal-tb;
}
.vertical {
writing-mode: vertical-rl;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # propdef-max-block-size](https://w3c.github.io/csswg-drafts/css-logical/#propdef-max-block-size) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `max-block-size` | 57 | 79 | 41 | No | 44 | 12.1 | 57 | 57 | 41 | 43 | 12.2 | 5.0 |
| `fit-content` | 57 | 79 | No | No | 44 | 12.1 | 57 | 57 | No | 43 | 12.2 | 5.0 |
| `fit-content_function` | No | No | 91 | No | No | No | No | No | No | No | No | No |
| `max-content` | 57 | 79 | 66
41 | No | 44 | 12.1 | 57 | 57 | 66
41 | 43 | 12.2 | 5.0 |
| `min-content` | 57 | 79 | 66
41 | No | 44 | 12.1 | 57 | 57 | 66
41 | 43 | 12.2 | 5.0 |
See also
--------
* The mapped physical properties: [`max-width`](max-width) and [`max-height`](max-height)
* Setting the other direction's maximum size: [`max-inline-size`](max-inline-size)
* [`writing-mode`](writing-mode)
css <ratio> <ratio>
=======
The `<ratio>` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [data type](css_types), used for describing [aspect ratios](@media/aspect-ratio) in [media queries](media_queries), denotes the proportion between two unitless values.
Syntax
------
In Media Queries Level 3, the `<ratio>` data type consisted of a strictly positive [`<integer>`](integer) followed by a forward slash ('/', Unicode `U+002F SOLIDUS`) and a second strictly positive [`<integer>`](integer). Spaces before and after the slash are optional. The first number represents the width, while the second represents the height.
In Media Queries Level 4, the `<ratio>` date type is updated to consist of a strictly positive [`<number>`](number) followed by a forward slash ('/', Unicode `U+002F SOLIDUS`) and a second strictly positive [`<number>`](number). In addition a single [`<number>`](number) as a value is allowable.
Formal syntax
-------------
```
<ratio> =
[<number [0,∞]>](number) [[](value_definition_syntax#brackets) / [<number [0,∞]>](number) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark)
```
Examples
--------
### Use in a media query
```
@media screen and (min-aspect-ratio: 16/9) {
/\* … \*/
}
```
### Common aspect ratios
| | Ratio | Usage |
| --- | --- | --- |
| | `4/3` | Traditional TV format in the twentieth century. |
| | `16/9` | Modern "widescreen" TV format. |
| | `185/100` = `91/50` | The most common movie format since the 1960s. |
| | `239/100` | "Widescreen," anamorphic movie format. |
Specifications
--------------
| Specification |
| --- |
| [Media Queries Level 4 # values](https://w3c.github.io/csswg-drafts/mediaqueries/#values) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `ratio` | 3 | 12 | 3.5 | 9 | 9.5 | 5 | ≤37 | 18 | 4 | 14 | 4.2 | 1.0 |
| `number_value` | No | No | 70 | No | No | No | No | No | No | No | No | No |
See also
--------
* [`aspect-ratio`](@media/aspect-ratio) media feature
css initial-letter initial-letter
==============
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `initial-letter` CSS property sets styling for dropped, raised, and sunken initial letters.
```
/\* Keyword values \*/
initial-letter: normal;
/\* Numeric values \*/
initial-letter: 1.5; /\* Initial letter occupies 1.5 lines \*/
initial-letter: 3; /\* Initial letter occupies 3 lines \*/
initial-letter: 3 2; /\* Initial letter occupies 3 lines and
sinks 2 lines \*/
/\* Global values \*/
initial-letter: inherit;
initial-letter: initial;
initial-letter: revert;
initial-letter: revert-layer;
initial-letter: unset;
```
Syntax
------
The keyword value `normal`, or a `<number>` optionally followed by an `<integer>`.
### Values
`normal` No special initial-letter effect. Text behaves as normal.
`<number>` Defines the size of the initial letter, in terms of how many lines it occupies. Negative values are not allowed.
`<integer>` Defines the number of lines the initial letter should sink when the size of it is given. Values must be greater than zero. If omitted, it duplicates the size value, floored to the nearest positive whole number.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | [`::first-letter`](::first-letter) pseudo-elements and inline-level first child of a block container |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
initial-letter =
normal [|](value_definition_syntax#single_bar)
[<number [1,∞]>](number) [<integer [1,∞]>](integer) [|](value_definition_syntax#single_bar)
[<number [1,∞]>](number) [&&](value_definition_syntax#double_ampersand) [[](value_definition_syntax#brackets) drop [|](value_definition_syntax#single_bar) raise []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark)
```
Examples
--------
### Setting initial letter size
#### HTML
```
<p class="normal">Initial letter is normal</p>
<p class="onefive">Initial letter occupies 1.5 lines</p>
<p class="three">Initial letter occupies 3 lines</p>
```
#### CSS
```
.normal::first-letter {
-webkit-initial-letter: normal;
initial-letter: normal;
}
.onefive::first-letter {
-webkit-initial-letter: 1.5;
initial-letter: 1.5;
}
.three::first-letter {
-webkit-initial-letter: 3;
initial-letter: 3;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Inline Layout Module Level 3 # sizing-drop-initials](https://w3c.github.io/csswg-drafts/css-inline/#sizing-drop-initials) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `initial-letter` | No
See [bug 1276900](https://crbug.com/1276900). | No
See [bug 1276900](https://crbug.com/1276900). | No
See [bug 1223880](https://bugzil.la/1223880). | No | No
See [bug 1276900](https://crbug.com/1276900). | 9
See [bug 229090](https://webkit.org/b/229090) for the unprefixed property. | No
See [bug 1276900](https://crbug.com/1276900). | No
See [bug 1276900](https://crbug.com/1276900). | No
See [bug 1223880](https://bugzil.la/1223880). | No
See [bug 1276900](https://crbug.com/1276900). | 9
See [bug 229090](https://webkit.org/b/229090) for the unprefixed property. | No
See [bug 1276900](https://crbug.com/1276900). |
* [`initial-letter-align`](initial-letter-align)
* [Drop caps in CSS](https://www.oddbird.net/2017/01/03/initial-letter/)
css hanging-punctuation hanging-punctuation
===================
The `hanging-punctuation` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property specifies whether a punctuation mark should hang at the start or end of a line of text. Hanging punctuation may be placed outside the line box.
```
/\* Keyword values \*/
hanging-punctuation: none;
hanging-punctuation: first;
hanging-punctuation: last;
hanging-punctuation: force-end;
hanging-punctuation: allow-end;
/\* Two keywords \*/
hanging-punctuation: first force-end;
hanging-punctuation: first allow-end;
hanging-punctuation: first last;
hanging-punctuation: last force-end;
hanging-punctuation: last allow-end;
/\* Three keywords \*/
hanging-punctuation: first force-end last;
hanging-punctuation: first allow-end last;
/\* Global values \*/
hanging-punctuation: inherit;
hanging-punctuation: initial;
hanging-punctuation: revert;
hanging-punctuation: revert-layer;
hanging-punctuation: unset;
```
Syntax
------
The `hanging-punctuation` property may be specified with one, two, or three space-separated values.
* **One-value** syntax uses any one of the keyword values in the list below.
* **Two-value** syntax uses one of the following:
+ `first` together with any one of `last`, `allow-end`, or `force-end`
+ `last` together with any one of `first`, `allow-end`, or `force-end`
* **Three-value** syntax uses one of the following:
+ `first`, `allow-end`, and `last`
+ `first`, `force-end`, and `last`
### Values
`none` No character hangs.
`first` An opening bracket or quote at the start of the first formatted line of an element hangs. This applies to:
* all characters in the Unicode categories [Ps](https://unicodeplus.com/category/Ps), [Pf](https://unicodeplus.com/category/Pf), [Pi](https://unicodeplus.com/category/Pi)
* the quote marks `U+0027` APOSTROPHE (`'`) and `U+0022` QUOTATION MARK (`"`).
`last` A closing bracket or quote at the end of the last formatted line of an element hangs. This applies to:
* all characters in the Unicode categories [Pe](https://unicodeplus.com/category/Pe), [Pf](https://unicodeplus.com/category/Pf), [Pi](https://unicodeplus.com/category/Pi)
* the quote marks `U+0027` APOSTROPHE (`'`) and `U+0022` QUOTATION MARK (`"`).
`force-end` A stop or comma at the end of a line hangs.
`allow-end` A stop or comma at the end of a line hangs if it does not otherwise fit prior to justification.
Stops and commas that are allowed to hang include:
* `U+002C`, COMMA
* `U+002E`, FULL STOP
* `U+060C`, ARABIC COMMA
* `U+06D4`, ARABIC FULL STOP
* `U+3001`, IDEOGRAPHIC COMMA
* `U+3002`, IDEOGRAPHIC FULL STOP
* `U+FF0C`, FULLWIDTH COMMA
* `U+FF0E`, FULLWIDTH FULL STOP
* `U+FE50`, SMALL COMMA
* `U+FE51`, SMALL IDEOGRAPHIC COMMA
* `U+FE52`, SMALL FULL STOP
* `U+FF61`, HALFWIDTH IDEOGRAPHIC FULL STOP
* `U+FF64`, HALFWIDTH IDEOGRAPHIC COMMA
User agents may include additional characters.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
hanging-punctuation =
none [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) first [||](value_definition_syntax#double_bar) [[](value_definition_syntax#brackets) force-end [|](value_definition_syntax#single_bar) allow-end []](value_definition_syntax#brackets) [||](value_definition_syntax#double_bar) last []](value_definition_syntax#brackets)
```
Examples
--------
### Setting opening and closing quotes to hang
#### HTML
```
<p>
«For a moment, nothing happened. Then, after a second or so, nothing continued
to happen.»
</p>
<p class="hanging">
«For a moment, nothing happened. Then, after a second or so, nothing continued
to happen.»
</p>
<p class="hanging right">
«For a moment, nothing happened. Then, after a second or so, nothing continued
to happen.»
</p>
```
#### CSS
```
p {
width: 15em;
border: 1px solid #cccccc;
font-size: 2rem;
font-style: italic;
margin: 1em;
}
p.hanging {
hanging-punctuation: first last;
}
p.right {
text-align: right;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Text Module Level 3 # hanging-punctuation-property](https://w3c.github.io/csswg-drafts/css-text/#hanging-punctuation-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `hanging-punctuation` | No | No | No | No | No | 10
["The `force-end` keyword is recognized but has no effect.", "The characters `U+0027` and `U+0022` are not supported by the `first` and `last` keywords."] | No | No | No | No | 10
["The `force-end` keyword is recognized but has no effect.", "The characters `U+0027` and `U+0022` are not supported by the `first` and `last` keywords."] | No |
See also
--------
* [`text-indent`](text-indent)
* [CSS Tricks: Hanging punctuation](https://css-tricks.com/almanac/properties/h/hanging-punctuation/)
css <length-percentage> <length-percentage>
===================
The `<length-percentage>` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [data type](css_types) represents a value that can be either a [`<length>`](length) or a [`<percentage>`](percentage).
Syntax
------
Refer to the documentation for [`<length>`](length) and [`<percentage>`](percentage) for details of the individual syntaxes allowed by this type.
Formal syntax
-------------
```
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### length-percentage examples
The following simple example demonstrates several properties that use `<length-percentage>` values.
#### HTML
```
<p>You can use percentages and lengths in so many places.</p>
```
#### CSS
```
p {
/\* length-percentage examples \*/
width: 75%;
height: 200px;
margin: 3rem;
padding: 1%;
border-radius: 10px 10%;
font-size: 250%;
line-height: 1.5em;
/\* length examples \*/
text-shadow: 1px 1px 1px red;
border: 5px solid red;
letter-spacing: 3px;
/\* percentage example \*/
text-size-adjust: 20%;
}
```
#### Result
### Use in calc()
Where a `<length-percentage>` is specified as an allowable type, this means that the percentage resolves to a length and therefore can be used in a [`calc()`](calc) expression. Therefore, all of the following values are acceptable for [`width`](width):
```
width: 200px;
width: 20%;
width: calc(100% - 200px);
```
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 4 # mixed-percentages](https://w3c.github.io/csswg-drafts/css-values/#mixed-percentages) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `Q` | 63 | 79 | 49 | No | 50 | No | 63 | 63 | 49 | 46 | No | 8.0 |
| `length-percentage` | 1 | 12 | 1 | 3 | 3.5 | 1 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `cap` | No | No | 97 | No | No | No | No | No | 97 | No | No | No |
| `ch` | 27 | 12 | 1
["From Firefox 1 to Firefox 3, `ch` was the width of the *M* character.", "From Firefox 1 to Firefox 3, `ch` did not work with [`border-width`](https://developer.mozilla.org/docs/Web/CSS/border-width) and [`outline-width`](https://developer.mozilla.org/docs/Web/CSS/outline-width) CSS properties."] | 9 | 15 | 7 | 4.4 | 27 | 4 | 15 | 7 | 1.5 |
| `ex` | 1 | 12 | 1 | 4 | 3.5 | 1 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
| `ic` | No
See [bug 937101](https://crbug.com/937101). | No
See [bug 937101](https://crbug.com/937101). | 97 | No | No
See [bug 937101](https://crbug.com/937101). | No
See [bug 195176](https://webkit.org/b/195176). | No
See [bug 937101](https://crbug.com/937101). | No
See [bug 937101](https://crbug.com/937101). | 97 | No
See [bug 937101](https://crbug.com/937101). | No
See [bug 195176](https://webkit.org/b/195176). | No
See [bug 937101](https://crbug.com/937101). |
| `lh` | No
See [bug 937104](https://crbug.com/937104). | No
See [bug 937104](https://crbug.com/937104). | No
See [bug 1310170](https://bugzil.la/1310170). | No | No
See [bug 937104](https://crbug.com/937104). | No | No
See [bug 937104](https://crbug.com/937104). | No
See [bug 937104](https://crbug.com/937104). | No
See [bug 1310170](https://bugzil.la/1310170). | No
See [bug 937104](https://crbug.com/937104). | No | No
See [bug 937104](https://crbug.com/937104). |
| `mozmm` | No | No | 4-59 | No | No | No | No | No | 4-59 | No | No | No |
| `rem` | 4 | 12 | 3.6 | 9 | 11.6 | 5 | 2 | 18 | 4 | 12 | 4 | 1.0 |
| `rlh` | No
See [bug 937104](https://crbug.com/937104). | No
See [bug 937104](https://crbug.com/937104). | No
See [bug 1310170](https://bugzil.la/1310170). | No | No
See [bug 937104](https://crbug.com/937104). | No | No
See [bug 937104](https://crbug.com/937104). | No
See [bug 937104](https://crbug.com/937104). | No
See [bug 1310170](https://bugzil.la/1310170). | No
See [bug 937104](https://crbug.com/937104). | No | No
See [bug 937104](https://crbug.com/937104). |
| `vb` | No | No | No
See [bug 1287034](https://bugzil.la/1287034). | No | No | No
See [bug 159801](https://webkit.org/b/159801). | No | No | No
See [bug 1287034](https://bugzil.la/1287034). | No | No
See [bug 159801](https://webkit.org/b/159801). | No |
| `vh` | 20 | 12 | 19 | 9 | 20 | 6 | 4.4 | 25 | 19 | 14 | 6 | 1.5 |
| `vi` | No | No | No
See [bug 1287034](https://bugzil.la/1287034). | No | No | No
See [bug 159801](https://webkit.org/b/159801). | No | No | No
See [bug 1287034](https://bugzil.la/1287034). | No | No
See [bug 159801](https://webkit.org/b/159801). | No |
| `vmax` | 26 | 16 | 19
Starting with version 21, viewport-percentage lengths are invalid in `@page`. | No | 15 | 7 | 1.5 | 26 | 19
Starting with version 21, viewport-percentage lengths are invalid in `@page`. | 14 | 7 | 1.5 |
| `vmin` | 26 | 12
12 | 19
Starting with version 21, viewport-percentage lengths are invalid in `@page`. | 10
9 | 15 | 7 | 4.4 | 26 | 19
Starting with version 21, viewport-percentage lengths are invalid in `@page`. | 14 | 7 | 1.5 |
| `vw` | 20 | 12 | 19
Starting with version 21, viewport-percentage lengths are invalid in `@page`. | 9 | 20 | 6 | 4.4 | 25 | 19
Starting with version 21, viewport-percentage lengths are invalid in `@page`. | 14 | 6 | 1.5 |
See also
--------
* [`<percentage>`](percentage)
* [`<length>`](length)
* [CSS Values and Units](css_values_and_units)
| programming_docs |
css Media queries Media queries
=============
**Media queries** are a key component of [responsive design](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Responsive_Design) that allow you to apply CSS styles depending on the presence or value of device characteristics.
It's common to apply a media query based on the [viewport](https://developer.mozilla.org/en-US/docs/Glossary/Viewport) size so that layout choices can be made for devices with different screen sizes. For example, you may have a smaller font size for devices with small screens, increase the padding between paragraphs when a page is viewed in portrait mode, or increase the size of buttons on touchscreens.
In [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS), use the [`@media`](@media) <at-rule> to conditionally apply part of a style sheet based on the result of a media query. To conditionally apply an entire style sheet, use [`@import`](@import).
When designing reusable HTML components, you may also use [container queries](css_container_queries), which allow you to apply styles based on the size of a containing element rather than the viewport or other device characteristics.
### Media queries in HTML
In [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML), media queries can be applied to various elements:
* In the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) element's [`media`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-media) attribute, they define the media to which a linked resource (typically CSS) should be applied.
* In the [`<source>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source) element's [`media`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source#attr-media) attribute, they define the media to which that source should be applied. (This is only valid inside [`<picture>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture) elements.)
* In the [`<style>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style) element's [`media`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style#attr-media) attribute, they define the media to which the style should be applied.
### Media queries in JavaScript
In [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript), you can use the [`Window.matchMedia()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia) method to test the window against a media query. You can also use [`MediaQueryList.addListener()`](https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener) to be notified whenever the state of a query changes. With this functionality, your site or app can respond to changes in the device configuration, orientation, or state.
You can learn more about programmatically using media queries in [Testing media queries](media_queries/testing_media_queries).
Reference
---------
### At-rules
* [`@import`](@import)
* [`@media`](@media)
Guides
------
[Using media queries](media_queries/using_media_queries) Introduces media queries, their syntax, and the operators and media features which are used to construct media query expressions.
[Testing media queries programmatically](media_queries/testing_media_queries) Describes how to use media queries in your JavaScript code to determine the state of a device, and to set up listeners that notify your code when the results of media queries change (such as when the user rotates the screen or resizes the browser).
[Using media queries for accessibility](media_queries/using_media_queries_for_accessibility) Learn how Media Queries can help users understand your website better.
Specifications
--------------
| Specification |
| --- |
| [Media Queries Level 4](https://drafts.csswg.org/mediaqueries/) |
| [CSS Conditional Rules Module Level 3](https://drafts.csswg.org/css-conditional/) |
See also
--------
* [Container queries](css_container_queries)
* Use [`@supports`](@supports) to apply styles that depend on browser support for various CSS technologies.
css :scope :scope
======
The `:scope` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) represents elements that are a reference point for selectors to match against.
```
/\* Selects a scoped element \*/
:scope {
background-color: lime;
}
```
Currently, when used in a stylesheet, `:scope` is the same as [`:root`](:root), since there is not at this time a way to explicitly establish a scoped element. When used from a DOM API such as [`querySelector()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector), [`querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll), [`matches()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches), or [`Element.closest()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest), `:scope` matches the element on which the method was called.
Syntax
------
```
:scope
```
Examples
--------
### Identity match
In this simple example, we demonstrate that using the `:scope` pseudo-class from the [`Element.matches()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches) method matches the element on which it's called.
#### JavaScript
```
const paragraph = document.getElementById("para");
const output = document.getElementById("output");
if (paragraph.matches(":scope")) {
output.textContent = "Yep, the element is its own scope as expected!";
}
```
#### HTML
```
<p id="para">
This is a paragraph. It is not an interesting paragraph. Sorry about that.
</p>
<p id="output"></p>
```
#### Result
### Direct children
A situation where the `:scope` pseudo-class prove to be useful is when you need to get direct descendant of an already retrieved [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element).
#### JavaScript
```
const context = document.getElementById("context");
const selected = context.querySelectorAll(":scope > div");
document.getElementById("results").innerHTML = Array.prototype.map
.call(selected, (element) => `#${element.getAttribute("id")}`)
.join(", ");
```
#### HTML
```
<div id="context">
<div id="element-1">
<div id="element-1.1"></div>
<div id="element-1.2"></div>
</div>
<div id="element-2">
<div id="element-2.1"></div>
</div>
</div>
<p>
Selected elements ids :
<span id="results"></span>
</p>
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # the-scope-pseudo](https://w3c.github.io/csswg-drafts/selectors/#the-scope-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:scope` | 27 | 79 | 32
Firefox 55 removes support for `<style scoped>` but not for the `:scope` pseudo-class, which is still supported. `<style scoped>` made it possible to explicitly set up element scopes, but ongoing discussions about the design of this feature as well as lack of other implementations resulted in the decision to remove it. | No | 15 | 7 | 4.4 | 27 | 32
Firefox 55 removes support for `<style scoped>` but not for the `:scope` pseudo-class, which is still supported. `<style scoped>` made it possible to explicitly set up element scopes, but ongoing discussions about the design of this feature as well as lack of other implementations resulted in the decision to remove it. | 15 | 7 | 1.5 |
| `dom_api` | 27 | 79 | 32 | No | 15 | 7 | 4.4 | 27 | 32 | 15 | 7 | 1.5 |
See also
--------
* The [`:root`](:root) [pseudo-class](pseudo-classes)
* [Locating DOM elements using selectors](https://developer.mozilla.org/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors)
* [`Element.querySelector()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector) and [`Element.querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll)
* [`Document.querySelector()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) and [`Document.querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll)
* [`DocumentFragment.querySelector()`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelector) and [`DocumentFragment.querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelectorAll)
css mask-mode mask-mode
=========
The `mask-mode` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets whether the mask reference defined by [`mask-image`](mask-image) is treated as a luminance or alpha mask.
```
/\* Keyword values \*/
mask-mode: alpha;
mask-mode: luminance;
mask-mode: match-source;
/\* Multiple values \*/
mask-mode: alpha, match-source;
/\* Global values \*/
mask-mode: inherit;
mask-mode: initial;
mask-mode: revert;
mask-mode: revert-layer;
mask-mode: unset;
```
Syntax
------
The `mask-mode` property is specified as one or more of the keyword values listed below, separated by commas.
### Values
`alpha` This keyword indicates that the transparency (alpha channel) values of the mask layer image should be used as the mask values.
`luminance` This keyword indicates that the luminance values of the mask layer image should be used as the mask values.
`match-source` If the [`mask-image`](mask-image) property is of type `<mask-source>`, the luminance values of the mask layer image should be used as the mask values.
If it is of type [`<image>`](image), the alpha values of the mask layer image should be used as the mask values.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `match-source` |
| Applies to | all elements; In SVG, it applies to container elements excluding the [`<defs>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs) element and all graphics elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
mask-mode =
<masking-mode>[#](value_definition_syntax#hash_mark)
<masking-mode> =
alpha [|](value_definition_syntax#single_bar)
luminance [|](value_definition_syntax#single_bar)
match-source
```
Examples
--------
### Using alpha mask mode
Specifications
--------------
| Specification |
| --- |
| [CSS Masking Module Level 1 # the-mask-mode](https://drafts.fxtf.org/css-masking/#the-mask-mode) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `mask-mode` | No | No | 53 | No | No | 15.4 | No | No | 53 | No | 15.4 | No |
See also
--------
* [Clipping and Masking in CSS](https://css-tricks.com/clipping-masking-css/)
css margin-right margin-right
============
The `margin-right` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the [margin area](css_box_model/introduction_to_the_css_box_model#margin_area) on the right side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
Try it
------
The vertical margins of two adjacent boxes may fuse. This is called [*margin collapsing*](css_box_model/mastering_margin_collapsing).
Syntax
------
```
/\* <length> values \*/
margin-right: 20px; /\* An absolute length \*/
margin-right: 1em; /\* relative to the text size \*/
margin-right: 5%; /\* relative to the nearest block container's width \*/
/\* Keyword values \*/
margin-right: auto;
/\* Global values \*/
margin-right: inherit;
margin-right: initial;
margin-right: revert;
margin-right: revert-layer;
margin-right: unset;
```
The `margin-right` property is specified as the keyword `auto`, or a `<length>`, or a `<percentage>`. Its value can be positive, zero, or negative.
### Values
[`<length>`](length) The size of the margin as a fixed value.
[`<percentage>`](percentage) The size of the margin as a percentage, relative to the inline size (*width* in a horizontal language, defined by [`writing-mode`](writing-mode)) of the [containing block](containing_block).
`auto` The right margin receives a share of the unused horizontal space, as determined mainly by the layout mode that is used. If the values of `margin-left` and `margin-right` are both `auto`, the calculated space is evenly distributed. This table summarizes the different cases:
| Value of [`display`](display) | Value of [`float`](float) | Value of [`position`](position) | Computed value of `auto` | Comment |
| --- | --- | --- | --- | --- |
| `inline`, `inline-block`, `inline-table` | *any* | `static` or `relative` | `0` | Inline layout mode |
| `block`, `inline`, `inline-block`, `block`, `table`, `inline-table`, `list-item`, `table-caption` | *any* | `static` or `relative` | `0`, except if both `margin-left` and `margin-right` are set to `auto`. In this case, it is set to the value centering the element inside its parent. | Block layout mode |
| `block`, `inline`, `inline-block`, `block`, `table`, `inline-table`, `list-item`, `table-caption` | `left` or `right` | `static` or `relative` | `0` | Block layout mode (floating element) |
| *any* `table-*`*, except* `table-caption` | *any* | *any* | `0` | Internal `table-*` elements don't have margins, use [`border-spacing`](border-spacing) instead |
| *any, except `flex`,* `inline-flex`*, or* `table-*` | *any* | *`fixed`* or `absolute` | `0`, except if both `margin-left` and `margin-right` are set to `auto`. In this case, it is set to the value centering the border area inside the available `width`, if fixed. | Absolutely positioned layout mode |
| `flex`, `inline-flex` | *any* | *any* | `0`, except if there is any positive horizontal free space. In this case, it is evenly distributed to all horizontal `auto` margins. | Flexbox layout mode |
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements, except elements with table [`display`](display) types other than `table-caption`, `table` and `inline-table`. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | no |
| Percentages | refer to the width of the containing block |
| [Computed value](computed_value) | the percentage as specified or the absolute length |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
margin-right =
<length-percentage> [|](value_definition_syntax#single_bar)
auto
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Setting right margin using pixels and percentages
```
.content {
margin-right: 5%;
}
.sidebox {
margin-right: 10px;
}
.logo {
margin-right: -5px;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Box Model Module Level 3 # margin-physical](https://w3c.github.io/csswg-drafts/css-box/#margin-physical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `margin-right` | 1 | 12 | 1 | 3 | 3.5 | 1 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
| `auto` | 1 | 12
The `auto` value is not supported in quirks mode. | 1 | 6
The `auto` value is not supported in quirks mode. | 3.5 | 1 | 37 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [`margin-top`](margin-top), [`margin-bottom`](margin-bottom), and [`margin-left`](margin-left) and the [`margin`](margin) shorthand
* The mapped logical properties: [`margin-block-start`](margin-block-start), [`margin-block-end`](margin-block-end), [`margin-inline-start`](margin-inline-start), and [`margin-inline-end`](margin-inline-end) and the shorthands [`margin-block`](margin-block) and [`margin-inline`](margin-inline)
css -webkit-text-stroke -webkit-text-stroke
===================
The `-webkit-text-stroke` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property specifies the [width](length) and [color](color_value) of strokes for text characters. This is a shorthand property for the longhand properties [`-webkit-text-stroke-width`](-webkit-text-stroke-width) and [`-webkit-text-stroke-color`](-webkit-text-stroke-color).
```
/\* Width and color values \*/
-webkit-text-stroke: 4px navy;
text-stroke: 4px navy;
/\* Global values \*/
-webkit-text-stroke: inherit;
-webkit-text-stroke: initial;
-webkit-text-stroke: unset;
text-stroke: inherit;
text-stroke: initial;
text-stroke: unset;
```
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`-webkit-text-stroke-color`](-webkit-text-stroke-color)
* [`-webkit-text-stroke-width`](-webkit-text-stroke-width)
Syntax
------
### Values
[`<length>`](length) The width of the stroke.
[`<color>`](color_value) The color of the stroke.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`-webkit-text-stroke-width`](-webkit-text-stroke-width): `0`
* [`-webkit-text-stroke-color`](-webkit-text-stroke-color): `currentcolor`
|
| Applies to | all elements |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`-webkit-text-stroke-width`](-webkit-text-stroke-width): absolute [`<length>`](length)
* [`-webkit-text-stroke-color`](-webkit-text-stroke-color): computed color
|
| Animation type | as each of the properties of the shorthand:* [`-webkit-text-stroke-width`](-webkit-text-stroke-width): discrete
* [`-webkit-text-stroke-color`](-webkit-text-stroke-color): a [color](color_value#interpolation)
|
Formal syntax
-------------
```
-webkit-text-stroke =
<line-width> [||](value_definition_syntax#double_bar)
[<color>](color_value)
<line-width> =
[<length [0,∞]>](length) [|](value_definition_syntax#single_bar)
thin [|](value_definition_syntax#single_bar)
medium [|](value_definition_syntax#single_bar)
thick
```
Examples
--------
### Adding a red text stroke
#### HTML
```
<p id="example">The stroke of this text is red.</p>
```
#### CSS
```
#example {
font-size: 3em;
margin: 0;
-webkit-text-stroke: 2px red;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Compatibility Standard # the-webkit-text-stroke](https://compat.spec.whatwg.org/#the-webkit-text-stroke) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `-webkit-text-stroke` | 4 | 15 | 49 | No | 15 | 3 | 4 | 18 | 49 | 14 | 2 | 1.0 |
See also
--------
* [Surfin' Safari blog post announcing this feature](https://webkit.org/blog/85/introducing-text-stroke/)
* [CSS-Tricks article explaining this feature](https://css-tricks.com/adding-stroke-to-web-text/)
* [`-webkit-text-stroke-width`](-webkit-text-stroke-width)
* [`-webkit-text-stroke-color`](-webkit-text-stroke-color)
* [`-webkit-text-fill-color`](-webkit-text-fill-color)
css transform transform
=========
The `transform` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS [visual formatting model](visual_formatting_model).
Try it
------
If the property has a value different than `none`, a [stacking context](css_positioning/understanding_z_index/the_stacking_context) will be created. In that case, the element will act as a [containing block](containing_block) for any `position: fixed;` or `position: absolute;` elements that it contains.
**Warning:** Only transformable elements can be `transform`ed. That is, all elements whose layout is governed by the CSS box model except for: [non-replaced inline boxes](visual_formatting_model#inline-level_elements_and_inline_boxes), [table-column boxes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col), and [table-column-group boxes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup).
Syntax
------
```
/\* Keyword values \*/
transform: none;
/\* Function values \*/
transform: matrix(1, 2, 3, 4, 5, 6);
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
transform: perspective(17px);
transform: rotate(0.5turn);
transform: rotate3d(1, 2, 3, 10deg);
transform: rotateX(10deg);
transform: rotateY(10deg);
transform: rotateZ(10deg);
transform: translate(12px, 50%);
transform: translate3d(12px, 50%, 3em);
transform: translateX(2em);
transform: translateY(3in);
transform: translateZ(2px);
transform: scale(2, 0.5);
transform: scale3d(2.5, 1.2, 0.3);
transform: scaleX(2);
transform: scaleY(0.5);
transform: scaleZ(0.3);
transform: skew(30deg, 20deg);
transform: skewX(30deg);
transform: skewY(1.07rad);
/\* Multiple function values \*/
transform: translateX(10px) rotate(10deg) translateY(5px);
transform: perspective(500px) translate(10px, 0, 20px) rotateY(3deg);
/\* Global values \*/
transform: inherit;
transform: initial;
transform: revert;
transform: revert-layer;
transform: unset;
```
The `transform` property may be specified as either the keyword value `none` or as one or more `<transform-function>` values.
If [`perspective()`](transform-function/perspective) is one of multiple function values, it must be listed first.
### Values
[`<transform-function>`](transform-function) One or more of the [CSS transform functions](transform-function) to be applied. The transform functions are multiplied in order from left to right, meaning that composite transforms are effectively applied in order from right to left.
`none` Specifies that no transform should be applied.
Accessibility concerns
----------------------
Scaling/zooming animations are problematic for accessibility, as they are a common trigger for certain types of migraine. If you need to include such animations on your website, you should provide a control to allow users to turn off animations, preferably site-wide.
Also, consider making use of the [`prefers-reduced-motion`](@media/prefers-reduced-motion) media feature — use it to write a [media query](media_queries) that will turn off animations if the user has reduced animation specified in their system preferences.
Find out more:
* [MDN Understanding WCAG, Guideline 2.3 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Operable#guideline_2.3_%E2%80%94_seizures_and_physical_reactions_do_not_design_content_in_a_way_that_is_known_to_cause_seizures_or_physical_reactions)
* [Understanding Success Criterion 2.3.3 | W3C Understanding WCAG 2.1](https://www.w3.org/WAI/WCAG21/Understanding/animation-from-interactions)
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | transformable elements |
| [Inherited](inheritance) | no |
| Percentages | refer to the size of bounding box |
| [Computed value](computed_value) | as specified, but with relative lengths converted into absolute lengths |
| Animation type | a transform |
| Creates [stacking context](css_positioning/understanding_z_index/the_stacking_context) | yes |
Formal syntax
-------------
```
transform =
none [|](value_definition_syntax#single_bar)
<transform-list>
<transform-list> =
[<transform-function>](transform-function)[+](value_definition_syntax#plus)
```
Examples
--------
### Translating and rotating an element
#### HTML
```
<div>Transformed element</div>
```
#### CSS
```
div {
border: solid red;
transform: translate(30px, 20px) rotate(20deg);
width: 140px;
height: 60px;
}
```
#### Result
### More examples
Please see [Using CSS transforms](css_transforms/using_css_transforms) and [`<transform-function>`](transform-function) for more examples.
Specifications
--------------
| Specification |
| --- |
| [CSS Transforms Module Level 2 # transform-functions](https://w3c.github.io/csswg-drafts/css-transforms-2/#transform-functions) |
| [CSS Transforms Module Level 1 # transform-property](https://w3c.github.io/csswg-drafts/css-transforms/#transform-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `3d` | 12 | 12 | 16 | 10 | 15 | 4 | 3 | 18 | 16 | 14 | 3.2 | 1.0 |
| `transform` | 36
1 | 12
12 | 49
16 | 11
10
Internet Explorer does not support the global values `initial` and `unset`.
9
Internet Explorer 5.5 or later supports a proprietary [Matrix Filter](https://msdn.microsoft.com/en-us/library/ms533014(VS.85,loband).aspx) which can be used to achieve a similar effect. | 23
15
12.1-15
10.5-15 | 9
3.1 | 4.4
2
Android 2.3 has a bug where input forms will "jump" when typing, if any container element has a `-webkit-transform`. | 36
18 | 49
16 | 24
14
12.1-14
11-14 | 9
3.2 | 3.0
1.0 |
See also
--------
* [Using CSS transforms](css_transforms/using_css_transforms)
* [`<transform-function>`](transform-function) data type with all the transform functions explained.
* Individual CSS properties: [`translate`](translate), [`rotate`](rotate)), and [`scale`](scale) (there is no `skew` property).
* Online tool to visualize CSS Transform functions: [CSS Transform Playground](https://css-transform.moro.es/)
| programming_docs |
css grid-template-columns grid-template-columns
=====================
The `grid-template-columns` CSS property defines the line names and track sizing functions of the [grid columns](https://developer.mozilla.org/en-US/docs/Glossary/Grid_Column).
Try it
------
Syntax
------
```
/\* Keyword value \*/
grid-template-columns: none;
/\* <track-list> values \*/
grid-template-columns: 100px 1fr;
grid-template-columns: [linename] 100px;
grid-template-columns: [linename1] 100px [linename2 linename3];
grid-template-columns: minmax(100px, 1fr);
grid-template-columns: fit-content(40%);
grid-template-columns: repeat(3, 200px);
grid-template-columns: subgrid;
grid-template-columns: masonry;
/\* <auto-track-list> values \*/
grid-template-columns: 200px repeat(auto-fill, 100px) 300px;
grid-template-columns:
minmax(100px, max-content)
repeat(auto-fill, 200px) 20%;
grid-template-columns:
[linename1] 100px [linename2]
repeat(auto-fit, [linename3 linename4] 300px)
100px;
grid-template-columns:
[linename1 linename2] 100px
repeat(auto-fit, [linename1] 300px) [linename3];
/\* Global values \*/
grid-template-columns: inherit;
grid-template-columns: initial;
grid-template-columns: revert;
grid-template-columns: revert-layer;
grid-template-columns: unset;
```
### Values
`none` Indicates that there is no explicit grid. Any columns will be implicitly generated and their size will be determined by the [`grid-auto-columns`](grid-auto-columns) property.
`[linename]` A [`<custom-ident>`](custom-ident) specifying a name for the line in that location. The ident may be any valid string other than the reserved words `span` and `auto`. Lines may have multiple names separated by a space inside the square brackets, for example `[line-name-a line-name-b]`.
[`<length>`](length) A non-negative length, giving the width of the column.
[`<percentage>`](percentage) Is a non-negative [`<percentage>`](percentage) value relative to the inline size of the grid container. If the size of the grid container depends on the size of its tracks, then the percentage must be treated as `auto`. The intrinsic size contributions of the track may be adjusted to the size of the grid container and increase the final size of the track by the minimum amount that would result in honoring the percentage.
[`<flex>`](flex_value) Is a non-negative dimension with the unit `fr` specifying the track's flex factor. Each `<flex>`-sized track takes a share of the remaining space in proportion to its flex factor.
When appearing outside a `minmax()` notation, it implies an automatic minimum (i.e. `minmax(auto, <flex>)`).
[`max-content`](max-content) Is a keyword representing the largest [maximal content contribution](https://www.w3.org/TR/css-sizing-3/#max-content) of the grid items occupying the grid track. For example, if the first element of the grid track contains the sentence *"Repetitio est mater studiorum"* and the second element contains the sentence *"Dum spiro, spero"*, maximal content contribution will be defined by the size of the largest sentence among all of the grid elements - *"Repetitio est mater studiorum"*.
[`min-content`](min-content) Is a keyword representing the largest [minimal content contribution](https://www.w3.org/TR/css-sizing-3/#min-content) of the grid items occupying the grid track. For example, if the first element of the grid track contains the sentence *"Repetitio est mater studiorum"* and the second element contains the sentence *"Dum spiro, spero"*, minimal content contribution will be defined by the size of the largest word among all of the sentences in the grid elements - *"studiorum"*.
[`minmax(min, max)`](minmax) Is a functional notation that defines a size range greater than or equal to *min* and less than or equal to *max*. If *max* is smaller than *min*, then *max* is ignored and the function is treated as *min*. As a maximum, a `<flex>` value sets the track's flex factor. It is invalid as a minimum.
`auto` As a maximum represents the largest [`max-content`](max-content) size of the items in that track.
As a minimum represents the largest minimum size of items in that track (specified by the [`min-width`](min-width)/[`min-height`](min-height) of the items). This is often, though not always, the [`min-content`](min-content) size.
If used outside of [`minmax()`](minmax) notation, `auto` represents the range between the minimum and maximum described above. This behaves similarly to `minmax(min-content,max-content)` in most cases.
**Note:** `auto` track sizes (and only `auto` track sizes) can be stretched by the [`align-content`](align-content) and [`justify-content`](justify-content) properties. Therefore by default, an `auto` sized track will take up any remaining space in the grid container.
`[`fit-content( [ <length> | <percentage> ] )`](fit-content_function)` Represents the formula `max(minimum, min(limit, max-content))`, where *minimum* represents an `auto` minimum (which is often, but not always, equal to a [`min-content`](min-content) minimum), and *limit* is the track sizing function passed as an argument to fit-content(). This is essentially calculated as the smaller of `minmax(auto, max-content)` and `minmax(auto, limit)`.
[`repeat( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> )`](repeat) Represents a repeated fragment of the track list, allowing a large number of columns that exhibit a recurring pattern to be written in a more compact form.
[`masonry`](css_grid_layout/masonry_layout) Experimental
The masonry value indicates that this axis should be laid out according to the masonry algorithm.
[`subgrid`](css_grid_layout/subgrid) The `subgrid` value indicates that the grid will adopt the spanned portion of its parent grid in that axis. Rather than being specified explicitly, the sizes of the grid rows/columns will be taken from the parent grid's definition.
**Warning:** The `masonry` value is from Level 3 of the Grid specification and currently only has an experimental implementation behind a flag in Firefox.
The `subgrid` value is from Level 2 of the Grid specification and currently only has implementation in Firefox 71 and onwards.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | grid containers |
| [Inherited](inheritance) | no |
| Percentages | refer to corresponding dimension of the content area |
| [Computed value](computed_value) | as specified, but with relative lengths converted into absolute lengths |
| Animation type | simple list of length, percentage, or calc, provided the only differences are in the values of the length, percentage, or calc components in the list |
Formal syntax
-------------
```
grid-template-columns =
none [|](value_definition_syntax#single_bar)
<track-list> [|](value_definition_syntax#single_bar)
<auto-track-list> [|](value_definition_syntax#single_bar)
subgrid <line-name-list>[?](value_definition_syntax#question_mark)
<track-list> =
[[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) <track-size> [|](value_definition_syntax#single_bar) <track-repeat> []](value_definition_syntax#brackets) []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) <line-names>[?](value_definition_syntax#question_mark)
<auto-track-list> =
[[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) <fixed-size> [|](value_definition_syntax#single_bar) <fixed-repeat> []](value_definition_syntax#brackets) []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk) <line-names>[?](value_definition_syntax#question_mark) <auto-repeat> [[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) <fixed-size> [|](value_definition_syntax#single_bar) <fixed-repeat> []](value_definition_syntax#brackets) []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk) <line-names>[?](value_definition_syntax#question_mark)
<line-name-list> =
[[](value_definition_syntax#brackets) <line-names> [|](value_definition_syntax#single_bar) <name-repeat> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus)
<line-names> =
'[' [<custom-ident>](custom-ident)[\*](value_definition_syntax#asterisk) ']'
<track-size> =
<track-breadth> [|](value_definition_syntax#single_bar)
minmax( <inflexible-breadth> , <track-breadth> ) [|](value_definition_syntax#single_bar)
fit-content( <length-percentage> )
<track-repeat> =
repeat( [[](value_definition_syntax#brackets) [<integer [1,∞]>](integer) []](value_definition_syntax#brackets) , [[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) <track-size> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) <line-names>[?](value_definition_syntax#question_mark) )
<fixed-size> =
<fixed-breadth> [|](value_definition_syntax#single_bar)
minmax( <fixed-breadth> , <track-breadth> ) [|](value_definition_syntax#single_bar)
minmax( <inflexible-breadth> , <fixed-breadth> )
<fixed-repeat> =
repeat( [[](value_definition_syntax#brackets) [<integer [1,∞]>](integer) []](value_definition_syntax#brackets) , [[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) <fixed-size> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) <line-names>[?](value_definition_syntax#question_mark) )
<auto-repeat> =
repeat( [[](value_definition_syntax#brackets) auto-fill [|](value_definition_syntax#single_bar) auto-fit []](value_definition_syntax#brackets) , [[](value_definition_syntax#brackets) <line-names>[?](value_definition_syntax#question_mark) <fixed-size> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) <line-names>[?](value_definition_syntax#question_mark) )
<name-repeat> =
repeat( [[](value_definition_syntax#brackets) [<integer [1,∞]>](integer) [|](value_definition_syntax#single_bar) auto-fill []](value_definition_syntax#brackets) , <line-names>[+](value_definition_syntax#plus) )
<track-breadth> =
<length-percentage> [|](value_definition_syntax#single_bar)
[<flex>](flex) [|](value_definition_syntax#single_bar)
min-content [|](value_definition_syntax#single_bar)
max-content [|](value_definition_syntax#single_bar)
auto
<inflexible-breadth> =
<length-percentage> [|](value_definition_syntax#single_bar)
min-content [|](value_definition_syntax#single_bar)
max-content [|](value_definition_syntax#single_bar)
auto
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
<fixed-breadth> =
<length-percentage>
```
Examples
--------
### Specifying grid column sizes
#### HTML
```
<div id="grid">
<div id="areaA">A</div>
<div id="areaB">B</div>
</div>
```
#### CSS
```
#grid {
display: grid;
width: 100%;
grid-template-columns: 50px 1fr;
}
#areaA {
background-color: lime;
}
#areaB {
background-color: yellow;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Grid Layout Module Level 2 # track-sizing](https://w3c.github.io/csswg-drafts/css-grid/#track-sizing) |
| [CSS Grid Layout Module Level 2 # subgrids](https://w3c.github.io/csswg-drafts/css-grid/#subgrids) |
| [CSS Grid Layout Module Level 3 # masonry-layout](https://w3c.github.io/csswg-drafts/css-grid-3/#masonry-layout) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `grid-template-columns` | 57 | 16
12-79 | 52 | 10 | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
| `animation` | 107 | 107 | 66 | No | 93 | 16 | 107 | 107 | 66 | No | 16 | No |
| `fit-content` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
| `masonry` | No | No | 77 | No | No | No | No | No | No | No | No | No |
| `minmax` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
| `repeat` | 57 | 16 | 76
57-76
`repeat(auto-fill, ...)` and `repeat(auto-fit, ...)` only support one repeated column (see [bug 1341507](https://bugzil.la/1341507)).
52-57
[`calc()`](https://developer.mozilla.org/docs/Web/CSS/calc) doesn't work in `repeat()` (see [bug 1350069](https://bugzil.la/1350069)). | No | 44 | 10.1 | 57 | 57 | 79
57-79
`repeat(auto-fill, ...)` and `repeat(auto-fit, ...)` only support one repeated column (see [bug 1341507](https://bugzil.la/1341507)).
52-57
[`calc()`](https://developer.mozilla.org/docs/Web/CSS/calc) doesn't work in `repeat()` (see [bug 1350069](https://bugzil.la/1350069)). | 43 | 10.3 | 6.0 |
| `subgrid` | No
See [bug 618969](https://crbug.com/618969). | No
See [bug 618969](https://crbug.com/618969). | 71 | No | No
See [bug 618969](https://crbug.com/618969). | 16 | No
See [bug 618969](https://crbug.com/618969). | No
See [bug 618969](https://crbug.com/618969). | No | No
See [bug 618969](https://crbug.com/618969). | 16 | No
See [bug 618969](https://crbug.com/618969). |
See also
--------
* Related CSS properties: [`grid-template-rows`](grid-template-rows), [`grid-template-areas`](grid-template-areas), [`grid-template`](grid-template)
* Grid Layout Guide: *[Basic concepts of grid layout - Grid Tracks](css_grid_layout/basic_concepts_of_grid_layout#grid_tracks)*
* Video tutorial: *[Defining a Grid](https://gridbyexample.com/video/series-define-a-grid/)*
* [Subgrid](css_grid_layout/subgrid)
css @supports @supports
=========
The `@supports` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) <at-rule> lets you specify CSS declarations that depend on a browser's support for CSS features. Using this at-rule is commonly called a *feature query*. The rule must be placed at the top level of your code or nested inside any other [conditional group at-rule](at-rule#conditional_group_rules).
Try it
------
In JavaScript, `@supports` can be accessed via the CSS object model interface [`CSSSupportsRule`](https://developer.mozilla.org/en-US/docs/Web/API/CSSSupportsRule).
Syntax
------
The `@supports` at-rule consists of a block of statements with a *supports condition.* The supports condition is a set of one or more name-value pairs (e.g., `<property>: <value>`).
```
@supports (<supports-condition>) {
/\* If the condition is true, use the CSS in this block. \*/
}
```
The conditions can be combined by conjunctions (`and`), disjunctions (`or`), and/or negations (`not`).
```
@supports (<supports-condition>) and (<supports-condition>) {
/\* If both conditions are true, use the CSS in this block. \*/
}
```
The precedence of operators can be defined with parentheses. Supports conditions can use either a `<property>: <value>` declaration syntax or a `<function()>` syntax. The following sections describe the use of each type of supports condition.
### Declaration syntax
The declaration syntax checks if a browser supports the specified `<property>: <value>` declaration. The declaration must be surrounded by parentheses. The following example returns true and applies the CSS style if the browser supports the expression `transform-origin: 5% 5%`:
```
@supports (transform-origin: 5% 5%) {
}
```
### Function syntax
The function syntax checks if a browser supports values or expressions within the function. The functions supported in the function syntax are described in the following sections.
####
`selector()` Experimental
This function evaluates if a browser supports the specified selector syntax. The following example returns true and applies the CSS style if the browser supports the [child combinator](child_combinator):
```
@supports selector(h2 > p) {
}
```
#### `font-tech()`
This function checks if a browser supports the specified font technology for layout and rendering. The following example returns true and applies the CSS style if the browser supports the `COLRv1` font technology:
```
@supports font-tech(color-COLRv1) {
}
```
The table below describes the available font technologies that can be queried using this function:
| Technology | Supports |
| --- | --- |
| `color-colrv0` | Multi-colored glyphs via COLR version 0 table |
| `color-colrv1` | Multi-colored glyphs via COLR version 1 table |
| `color-svg` | SVG multi-colored tables |
| `color-sbix` | Standard bitmap graphics tables |
| `color-cbdt` | Color bitmap data tables |
| `features-opentype` | OpenType `GSUB` and `GPOS` tables |
| `features-aat` | TrueType `morx` and `kerx` tables |
| `features-graphite` | Graphite features, namely `Silf`, `Glat` , `Gloc` , `Feat`, and `Sill` tables |
| `incremental` | Incremental font loading |
| `variations` | Font variations in TrueType and OpenType fonts to control the font axis, weight, glyphs, etc. |
| `palettes` | Font palettes by means of `font-palette` to select one of many color palettes in the font |
#### `font-format()`
This function checks if a browser supports the specified font format for layout and rendering. The following example returns true and applies the CSS style if the browser supports the `opentype` font format:
```
@supports font-format(opentype) {
}
```
The following table describes the available formats that can be queried with this function:
| Format | Description | File extensions |
| --- | --- | --- |
| `collection` | OpenType Collection | `.otc`, `.ttc` |
| `embedded-opentype` | Embedded OpenType | `.eot` |
| `opentype` | OpenType | `.ttf`, `.otf` |
| `svg` | SVG Font (deprecated) | `.svg`, `.svgz` |
| `truetype` | TrueType | `.ttf` |
| `woff` | WOFF 1.0 (Web Open Font Format) | `.woff` |
| `woff2` | WOFF 2.0 (Web Open Font Format) | `.woff2` |
### The not operator
The `not` operator precedes an expression resulting in the negation of the expression. The following returns true if the browser's [`transform-origin`](transform-origin) property considers `10em 10em 10em` **to be invalid:**
```
@supports not (transform-origin: 10em 10em 10em) {
}
```
As with any operator, the `not` operator can be applied to a declaration of any complexity. The following examples are both valid:
```
@supports not (not (transform-origin: 2px)) {
}
@supports (display: grid) and (not (display: inline-grid)) {
}
```
**Note:** There is no need to enclose the `not` operator between two parentheses at the top level. To combine it with other operators, like `and` and `or`, the parentheses are required.
### The and operator
The `and` operator creates a new expression from the conjunction of two shorter expressions. It returns true only if **both** of the shorter expressions are also true. The following example returns true if and only if the two shorter expressions are simultaneously true:
```
@supports (display: table-cell) and (display: list-item) {
}
```
Multiple conjunctions can be juxtaposed without the need of more parentheses. The following are both equivalent:
```
@supports (display: table-cell) and (display: list-item) and (display: contents) {
}
@supports (display: table-cell) and
((display: list-item) and (display: contents)) {
}
```
### The or operator
The `or` operator creates a new expression from the disjunction of two shorter expressions. It returns true if **one or both** of the shorter expressions is also true. The following example returns true if at least one of the two shorter expressions is true:
```
@supports (transform-style: preserve) or (-moz-transform-style: preserve) {
}
```
Multiple disjunctions can be juxtaposed without the need of more parentheses. The following are both equivalent:
```
@supports (transform-style: preserve) or (-moz-transform-style: preserve) or (-webkit-transform-style: preserve) {}
@supports (transform-style: preserve-3d) or ((-moz-transform-style: preserve-3d) or (-webkit-transform-style: preserve-3d))) {}
```
**Note:** When using both `and` and `or` operators, the parentheses must be used to define the order in which they apply. Otherwise, the condition is invalid and the whole rule is ignored.
Formal syntax
-------------
```
@supports =
@supports <supports-condition> { [<stylesheet>](stylesheet) }
<supports-condition> =
not <supports-in-parens> [|](value_definition_syntax#single_bar)
<supports-in-parens> [[](value_definition_syntax#brackets) and <supports-in-parens> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk) [|](value_definition_syntax#single_bar)
<supports-in-parens> [[](value_definition_syntax#brackets) or <supports-in-parens> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<supports-in-parens> =
( <supports-condition> ) [|](value_definition_syntax#single_bar)
<supports-feature> [|](value_definition_syntax#single_bar)
<general-enclosed>
<supports-feature> =
<supports-decl>
<general-enclosed> =
[[](value_definition_syntax#brackets) [<function-token>](function-token) [<any-value>](any-value)[?](value_definition_syntax#question_mark) ) []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) ( [<any-value>](any-value)[?](value_definition_syntax#question_mark) ) []](value_definition_syntax#brackets)
<supports-decl> =
( [<declaration>](declaration) )
```
Examples
--------
### Testing for the support of a CSS property
```
@supports (animation-name: test) {
/\* CSS applied when animations are supported without a prefix \*/
@keyframes {
/\* Other at-rules can be nested inside \*/
}
}
```
### Testing for the support of a given CSS property or a prefixed version
```
@supports (text-stroke: 10px) or (-webkit-text-stroke: 10px) {
/\* CSS applied when text-stroke, prefixed or not, is supported \*/
}
```
### Testing for the non-support of a specific CSS property
```
@supports not ((text-align-last: justify) or (-moz-text-align-last: justify)) {
/\* CSS to provide fallback alternative for text-align-last: justify \*/
}
```
### Testing for the support of a selector
CSS conditional rules provide the ability to test for the support of a selector such as [`:has()`](:has).
```
/\* This rule won't be applied in browsers that don't support :has() \*/
ul:has(> li li) {
/\* CSS is applied when the :has(…) pseudo-class is supported \*/
}
@supports not selector(:has(a, b)) {
/\* Fallback for when :has() is unsupported \*/
ul > li,
ol > li {
/\* The above expanded for browsers that don't support :has(…) \*/
}
}
/\* Note: So far, there's no browser that supports the `of` argument of :nth-child(…) \*/
@supports selector(:nth-child(1n of a, b)) {
/\* This rule needs to be inside the @supports block, otherwise
it will be partially applied in browsers which don't support
the `of` argument of :nth-child(…) \*/
:is(:nth-child(1n of ul, ol) a, details > summary) {
/\* CSS applied when the :is(…) selector and
the `of` argument of :nth-child(…) are both supported \*/
}
}
```
### Testing for the support of a font technology
The following example applies the CSS style if the browser supports the `COLRv1` font technology:
```
@import url("https://fonts.googleapis.com/css2?family=Bungee+Spice");
@supports font-tech(color-COLRv1) {
font-family: "Bungee Spice";
}
```
It's also possible to test for the support of a font technology by using the `tech` function inside the [`@font-face`](@font-face) at-rule. If a browser doesn't support the font technology, a fallback font (`Bungee-fallback.otf`) can be used instead.
```
@font-face {
font-family: "Bungee Spice";
src: url("https://fonts.googleapis.com/css2?family=Bungee+Spice") tech(color-COLRv1),
url("Bungee-fallback.otf") format("opentype");
}
```
### Testing for the support of a font format
The following example applies the CSS style if the browser supports the `woff2` font format:
```
@supports font-format(woff2) {
font-family: "Open Sans";
src: url("open-sans.woff2") format("woff2");
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Conditional Rules Module Level 4 # at-supports-ext](https://w3c.github.io/csswg-drafts/css-conditional-4/#at-supports-ext) |
| [CSS Conditional Rules Module Level 3 # at-supports](https://w3c.github.io/csswg-drafts/css-conditional-3/#at-supports) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `@supports` | 28 | 12 | 22 | No | 12.1 | 9 | 4.4 | 28 | 22 | 12.1 | 9 | 1.5 |
| `font-format` | No | No | 106 | No | No | No | No | No | 106 | No | No | No |
| `font-tech` | No | No | 106 | No | No | No | No | No | 106 | No | No | No |
| `selector` | 83 | 83 | 69 | No | 69 | 14.1 | 83 | 83 | 79 | No
See [bug 979041](https://crbug.com/979041). | 14.5 | 13.0 |
See also
--------
* [Using feature queries](css_conditional_rules/using_feature_queries)
* The CSSOM class [`CSSSupportsRule`](https://developer.mozilla.org/en-US/docs/Web/API/CSSSupportsRule), and the [`CSS.supports()`](https://developer.mozilla.org/en-US/docs/Web/API/CSS/supports) method that allows the same check to be performed via JavaScript.
| programming_docs |
css zoom zoom
====
**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The non-standard `zoom` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property can be used to control the magnification level of an element. [`transform: scale()`](transform-function/scale) should be used instead of this property, if possible. However, unlike CSS Transforms, `zoom` affects the layout size of the element.
Syntax
------
```
/\* Keyword values \*/
zoom: normal;
zoom: reset;
/\* <percentage> values \*/
zoom: 50%;
zoom: 200%;
/\* <number> values \*/
zoom: 1.1;
zoom: 0.7;
/\* Global values \*/
zoom: inherit;
zoom: initial;
zoom: revert;
zoom: revert-layer;
zoom: unset;
```
### Values
`normal` Render this element at its normal size.
`reset` Non-standard
Do not (de)magnify this element if the user applies non-pinch-based zooming (e.g. by pressing `Ctrl` - `-` or `Ctrl` + `+` keyboard shortcuts) to the document. **Do not use** this value, *use the standard `unset` value instead*.
[`<percentage>`](percentage) Zoom factor. `100%` is equivalent to `normal`. Values larger than `100%` zoom in. Values smaller than `100%` zoom out.
[`<number>`](number) Zoom factor. Equivalent to the corresponding percentage (`1.0` = `100%` = `normal`). Values larger than `1.0` zoom in. Values smaller than `1.0` zoom out.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | an [integer](integer#interpolation) |
Formal syntax
-------------
```
zoom =
normal | reset | <number> | <percentage>
```
Examples
--------
### First example
#### HTML
```
<p class="small">Small</p>
<p class="normal">Normal</p>
<p class="big">Big</p>
```
#### CSS
```
.small {
zoom: 75%;
}
.normal {
zoom: normal;
}
.big {
zoom: 2.5;
}
p:hover {
zoom: unset;
}
```
#### Result
### Second example
#### HTML
```
<div id="a" class="circle"></div>
<div id="b" class="circle"></div>
<div id="c" class="circle"></div>
```
#### CSS
```
div.circle {
width: 25px;
height: 25px;
border-radius: 100%;
text-align: center;
vertical-align: middle;
display: inline-block;
zoom: 1.5;
}
div#a {
background-color: gold;
zoom: normal;
}
div#b {
background-color: green;
zoom: 200%;
}
div#c {
background-color: blue;
zoom: 2.9;
}
```
#### Result
Specifications
--------------
Not part of any standard. This property originated in Internet Explorer. Apple has [a description in the Safari CSS Reference](https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-SW15). Rossen Atanassov of Microsoft has [an unofficial draft specification proposal on GitHub](https://cdn.jsdelivr.net/gh/atanassov/css-zoom@master/Overview.html).
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `zoom` | 1 | 12 | No
See [bug 390936](https://bugzil.la/390936). | 5.5 | 15 | 3.1 | ≤37 | 18 | No
See [bug 390936](https://bugzil.la/390936). | 14 | 3 | 1.0 |
| `reset` | 1-59 | No | No | No | 15-46 | 3.1 | ≤37-59 | 18-59 | No | 14-43 | 3 | 1.0-7.0 |
See also
--------
* [`zoom` entry in CSS-Tricks' CSS Almanac](https://css-tricks.com/almanac/properties/z/zoom/)
* [Bug 390936: Implement Internet Explorer `zoom` property for CSS](https://bugzilla.mozilla.org/show_bug.cgi?id=390936) on the Firefox issue tracker Bugzilla
css margin-inline-start margin-inline-start
===================
The `margin-inline-start` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the logical inline start margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. It corresponds to the [`margin-top`](margin-top), [`margin-right`](margin-right), [`margin-bottom`](margin-bottom), or [`margin-left`](margin-left) property depending on the values defined for [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation).
Try it
------
Syntax
------
```
/\* <length> values \*/
margin-inline-start: 10px; /\* An absolute length \*/
margin-inline-start: 1em; /\* relative to the text size \*/
margin-inline-start: 5%; /\* relative to the nearest block container's width \*/
/\* Keyword values \*/
margin-inline-start: auto;
/\* Global values \*/
margin-inline-start: inherit;
margin-inline-start: initial;
margin-inline-start: revert;
margin-inline-start: revert-layer;
margin-inline-start: unset;
```
It relates to [`margin-block-start`](margin-block-start), [`margin-block-end`](margin-block-end), and [`margin-inline-end`](margin-inline-end), which define the other margins of the element.
### Values
The `margin-inline-start` property takes the same values as the [`margin-left`](margin-left) property.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | same as [`margin`](margin) |
| [Inherited](inheritance) | no |
| Percentages | depends on layout model |
| [Computed value](computed_value) | if specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, `auto` |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
margin-inline-start =
<'margin-top'>
```
Examples
--------
### Setting inline start margin
#### HTML
```
<div>
<p class="exampleText">Example text</p>
</div>
```
#### CSS
```
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-lr;
margin-inline-start: 20px;
background-color: #c8c800;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # margin-properties](https://w3c.github.io/csswg-drafts/css-logical/#margin-properties) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `margin-inline-start` | 87
2 | 87
79 | 41
3 | No | 73
15 | 12.1
3 | 87
2 | 87
18 | 41
4 | 62
14 | 12.2
3 | 14.0
1.0 |
See also
--------
* [CSS Logical Properties and Values](css_logical_properties)
* [`margin-inline-end`](margin-inline-end)
* The mapped physical properties: [`margin-top`](margin-top), [`margin-right`](margin-right), [`margin-bottom`](margin-bottom), and [`margin-left`](margin-left)
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)
css margin-top margin-top
==========
The `margin-top` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the [margin area](css_box_model/introduction_to_the_css_box_model#margin_area) on the top of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
Try it
------
This property has no effect on *non-[replaced](replaced_element)* inline elements, such as [`<span>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span) or [`<code>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code).
Syntax
------
```
/\* <length> values \*/
margin-top: 10px; /\* An absolute length \*/
margin-top: 1em; /\* relative to the text size \*/
margin-top: 5%; /\* relative to the nearest block container's width \*/
/\* Keyword values \*/
margin-top: auto;
/\* Global values \*/
margin-top: inherit;
margin-top: initial;
margin-top: revert;
margin-top: revert-layer;
margin-top: unset;
```
The `margin-top` property is specified as the keyword `auto`, or a `<length>`, or a `<percentage>`. Its value can be positive, zero, or negative.
### Values
[`<length>`](length) The size of the margin as a fixed value.
[`<percentage>`](percentage) The size of the margin as a percentage, relative to the inline size (*width* in a horizontal language, defined by [`writing-mode`](writing-mode)) of the [containing block](containing_block).
`auto` The browser selects a suitable value to use. See [`margin`](margin).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements, except elements with table [`display`](display) types other than `table-caption`, `table` and `inline-table`. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | no |
| Percentages | refer to the width of the containing block |
| [Computed value](computed_value) | the percentage as specified or the absolute length |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
margin-top =
<length-percentage> [|](value_definition_syntax#single_bar)
auto
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Setting positive and negative top margins
```
.content {
margin-top: 5%;
}
.sidebox {
margin-top: 10px;
}
.logo {
margin-top: -5px;
}
#footer {
margin-top: 1em;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Box Model Module Level 3 # margin-physical](https://w3c.github.io/csswg-drafts/css-box/#margin-physical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `margin-top` | 1 | 12 | 1 | 3 | 3.5 | 1 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
| `auto` | 1 | 12
The `auto` value is not supported in quirks mode. | 1 | 6
The `auto` value is not supported in quirks mode. | 3.5 | 1 | 37 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [`margin-right`](margin-right), [`margin-bottom`](margin-bottom), and [`margin-left`](margin-left) and the [`margin`](margin) shorthand
* The mapped logical properties: [`margin-block-start`](margin-block-start), [`margin-block-end`](margin-block-end), [`margin-inline-start`](margin-inline-start), and [`margin-inline-end`](margin-inline-end) and the shorthands [`margin-block`](margin-block) and [`margin-inline`](margin-inline)
css round() round()
=======
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `round()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) returns a rounded number based on a selected rounding strategy.
Syntax
------
```
width: round(var(--width), 50px);
width: round(up, 101, 10);
width: round(down, 106, 10);
margin: round(to-zero, -105, 10);
```
### Parameter
The `round(<rounding-strategy>, valueToRound, roundingInterval)` function specifies an optional rounding strategy, a value (or mathematical expression) to be rounded and a rounding interval (or mathematical expression). The `valueToRound` is rounded according to the rounding strategy, to the nearest integer multiple of `roundingInterval`.
`<rounding-strategy>` The rounding strategy. This may be one of the following values:
`up` Round `valueToRound` up to the nearest integer multiple of `roundingInterval` (if the value is negative, it will become "more positive"). This is equivalent to the JavaScript [`Math.ceil()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil) method.
`down` Round `valueToRound` down to the nearest integer multiple of `roundingInterval` (if the value is negative, it will become "more negative"). This is equivalent to the JavaScript [`Math.floor()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor) method.
`nearest` (default) Round `valueToRound` to the nearest integer multiple of `roundingInterval`, which may be either above or below the value. If the `valueToRound` is half way between the rounding targets above and below (neither is "nearest"), it will be rounded up. Equivalent to JavaScript [`Math.round()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round).
`to-zero` Round `valueToRound` to the nearest integer multiple of `roundingInterval` closer to/towards zero (a positive number will decrease, while a negative value will become "less negative"). This is equivalent to the JavaScript [`Math.trunc()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc) method.
`valueToRound` The value to be rounded. This must be a [`<number>`](number), [`<dimension>`](dimension), or [`<percentage>`](percentage), or a mathematical expression that resolves to to one of those values.
`roundingInterval` The rounding interval. This is a [`<number>`](number), [`<dimension>`](dimension), or [`<percentage>`](percentage), or a mathematical expression that resolves to to one of those values.
### Return value
The value of `valueToRound`, rounded to the nearest lower or higher integer multiple of `roundingInterval`, depending on the `rounding strategy`.
* If `roundingInterval` is 0, the result is `NaN`.
* If `valueToRound` and `roundingInterval` are both `infinite`, the result is `NaN`.
* If `valueToRound` is infinite but `roundingInterval` is finite, the result is the same `infinity`.
* If `valueToRound` is finite but `roundingInterval` is infinite, the result depends on the rounding strategy and the sign of `A`:
+ `up` - If `valueToRound` is positive (not zero), return `+∞`. If `valueToRound` is `0⁺`, return `0⁺`. Otherwise, return `0⁻`.
+ `down` - If `valueToRound` is negative (not zero), return `−∞`. If `valueToRound` is `0⁻`, return `0⁻`. Otherwise, return `0⁺`.
+ `nearest`, `to-zero` - If `valueToRound` is positive or `0⁺`, return `0⁺`. Otherwise, return `0⁻`.
* The argument calculations can resolve to [`<number>`](number), [`<dimension>`](dimension), or [`<percentage>`](percentage), but must have the same type, or else the function is invalid; the result will have the same type as the arguments.
* If `valueToRound` is exactly equal to an integer multiple of `roundingInterval`, `round()` resolves to `valueToRound` exactly (preserving whether `valueToRound` is `0⁻` or `0⁺`, if relevant). Otherwise, there are two integer multiples of `roundingInterval` that are potentially "closest" to `valueToRound`, lower `roundingInterval` which is closer to `−∞` and upper `roundingInterval` which is closer to `+∞`.
### Formal syntax
```
<round()> =
round( <rounding-strategy>[?](value_definition_syntax#question_mark) , <calc-sum> , <calc-sum> )
<rounding-strategy> =
nearest [|](value_definition_syntax#single_bar)
up [|](value_definition_syntax#single_bar)
down [|](value_definition_syntax#single_bar)
to-zero
<calc-sum> =
<calc-product> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '+' [|](value_definition_syntax#single_bar) '-' []](value_definition_syntax#brackets) <calc-product> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-product> =
<calc-value> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '*' [|](value_definition_syntax#single_bar) '/' []](value_definition_syntax#brackets) <calc-value> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-value> =
[<number>](number) [|](value_definition_syntax#single_bar)
[<dimension>](dimension) [|](value_definition_syntax#single_bar)
[<percentage>](percentage) [|](value_definition_syntax#single_bar)
<calc-constant> [|](value_definition_syntax#single_bar)
( <calc-sum> )
<calc-constant> =
e [|](value_definition_syntax#single_bar)
pi [|](value_definition_syntax#single_bar)
infinity [|](value_definition_syntax#single_bar)
-infinity [|](value_definition_syntax#single_bar)
NaN
```
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 4 # funcdef-round](https://w3c.github.io/csswg-drafts/css-values/#funcdef-round) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `round` | No | No | 108
preview | No | No | 15.4 | No | No | No | No | 15.4 | No |
See also
--------
* `mod`
* [`rem()`](rem)
css @import @import
=======
The `@import` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) <at-rule> is used to import style rules from other valid stylesheets. An `@import` rule *must* be defined at the top of stylesheet, before any other at-rule (except <@charset> and <@layer>) and style declaration, else it will be ignored.
Syntax
------
```
@import url;
@import url list-of-media-queries;
@import url supports(supports-query);
@import url supports(supports-query) list-of-media-queries;
@import url layer;
@import url layer(layer-name);
@import url layer(layer-name) list-of-media-queries;
@import url layer(layer-name) supports(supports-query) list-of-media-queries;
```
where:
*url* Is a [`<string>`](string), a `<url>`, or a [`url()`](url) function representing the location of the resource to import. The URL may be absolute or relative.
*list-of-media-queries* Is a comma-separated list of [media queries](media_queries/using_media_queries), which specify the media-dependent conditions for applying the CSS rules defined in the linked URL. If the browser does not support any of these queries, it does not load the linked resource.
*supports-query* Is either a [`<supports-condition>`](@supports#syntax) or a [`<declaration>`](syntax#css_declarations). If the import conditions do not match, the rules in the imported stylesheet do not apply.
*layer-name* Is the name of a [cascade layer](@layer) into which the contents of the linked resource are imported.
Description
-----------
Imported rules must come before all other types of rules, except [`@charset`](@charset) rules and layer creating [`@layer`](@layer) statements. The `@import` rule is not a [nested statement](syntax#nested_statements). Therefore, it cannot be used inside [conditional group at-rules](at-rule#conditional_group_rules).
So that user agents can avoid retrieving resources for unsupported media types, authors may specify media-dependent import conditions. These conditional imports specify comma-separated [media queries](media_queries/using_media_queries) after the URL. In the absence of any media query, the import is unconditional. Specifying `all` for the `list-of-media-queries` has the same effect.
The `@import` rule can also be used to create a [cascade layer](@layer) by importing rules from a linked resource. Rules can also be imported into an existing cascade layer. The `layer` keyword or the `layer()` function is used with `@import` for this purpose. Declarations in style rules from imported stylesheets interact with the cascade as if they were written literally into the stylesheet at the point of the import.
Formal syntax
-------------
```
@import =
@import [[](value_definition_syntax#brackets) <url> [|](value_definition_syntax#single_bar) [<string>](string) []](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) layer [|](value_definition_syntax#single_bar) layer( <layer-name> ) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) <import-conditions> ;
<url> =
url( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) ) [|](value_definition_syntax#single_bar)
src( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) )
<layer-name> =
[<ident>](ident) [[](value_definition_syntax#brackets) '.' [<ident>](ident) []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<import-conditions> =
[[](value_definition_syntax#brackets) supports( [[](value_definition_syntax#brackets) <supports-condition> [|](value_definition_syntax#single_bar) [<declaration>](declaration) []](value_definition_syntax#brackets) ) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) [<media-query-list>](media-query-list)[?](value_definition_syntax#question_mark)
<supports-condition> =
not <supports-in-parens> [|](value_definition_syntax#single_bar)
<supports-in-parens> [[](value_definition_syntax#brackets) and <supports-in-parens> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk) [|](value_definition_syntax#single_bar)
<supports-in-parens> [[](value_definition_syntax#brackets) or <supports-in-parens> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<supports-in-parens> =
( <supports-condition> ) [|](value_definition_syntax#single_bar)
<supports-feature> [|](value_definition_syntax#single_bar)
<general-enclosed>
<supports-feature> =
<supports-decl>
<general-enclosed> =
[[](value_definition_syntax#brackets) [<function-token>](function-token) [<any-value>](any-value)[?](value_definition_syntax#question_mark) ) []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) ( [<any-value>](any-value)[?](value_definition_syntax#question_mark) ) []](value_definition_syntax#brackets)
<supports-decl> =
( [<declaration>](declaration) )
```
Examples
--------
### Importing CSS rules
```
@import "custom.css";
@import url("chrome://communicator/skin/");
```
The two examples above show how to specify the *url* as a `<string>` and as a `url()` function.
### Importing CSS rules conditionally
```
@import url("fineprint.css") print;
@import url("bluish.css") print, screen;
@import "common.css" screen;
@import url("landscape.css") screen and (orientation: landscape);
@import url("narrow.css") supports(display: flex) screen and (max-width: 400px);
```
The `@import` rules in the above examples show media-dependent conditions that will need to be true before the linked CSS rules are applied.
So for instance, the last `@import` rule will load the `narrow.css` stylesheet if the user agent supports [`display: flex`](display#display_flex). The [media query](media_queries/using_media_queries), using the `and` operator, further specifies to apply the style rules only to a screen device with a maximum viewport width of 400px.
### Importing CSS rules into a cascade layer
```
@import "theme.css" layer(utilities);
```
In the above example, a cascade layer named `utilities` is created and it will include rules from the imported stylesheet `theme`.
```
@import url(headings.css) layer(default);
@import url(links.css) layer(default);
@layer default {
audio[controls] {
display: block;
}
}
```
In the above example, the rules in `headings.css` and `links.css` stylesheets cascade within the same layer as the `audio[controls]` rule.
```
@import "theme.css" layer();
@import "style.css" layer;
```
This is an example of creating two separate anonymous cascade layers and importing the linked rules into each one separately. A cascade layer declared without a name is an anonymous cascade layer. Anonymous cascade layers are finalized when created: they do not provide any means for re-arranging or adding styles and they cannot be referenced from outside.
Specifications
--------------
| Specification |
| --- |
| [CSS Cascading and Inheritance Level 5 # at-import](https://w3c.github.io/csswg-drafts/css-cascade-5/#at-import) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `@import` | 1 | 12 | 1 | 5.5 | 3.5 | 1 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `layer` | 99 | 99 | 97 | No | 85 | 15.4 | 99 | 99 | 97 | 68 | 15.4 | 18.0 |
See also
--------
* [`@media`](@media)
* [`@supports`](@supports)
| programming_docs |
css inset-block-start inset-block-start
=================
The `inset-block-start` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the logical block start offset of an element, which maps to a physical inset depending on the element's writing mode, directionality, and text orientation. It corresponds to the [`top`](top), [`right`](right), [`bottom`](bottom), or [`left`](left) property depending on the values defined for [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation).
Try it
------
Syntax
------
```
/\* <length> values \*/
inset-block-start: 3px;
inset-block-start: 2.4em;
/\* <percentage>s of the width or height of the containing block \*/
inset-block-start: 10%;
/\* Keyword value \*/
inset-block-start: auto;
/\* Global values \*/
inset-block-start: inherit;
inset-block-start: initial;
inset-block-start: revert;
inset-block-start: revert-layer;
inset-block-start: unset;
```
### Values
The `inset-block-start` property takes the same values as the [`left`](left) property.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | positioned elements |
| [Inherited](inheritance) | no |
| Percentages | logical-height of containing block |
| [Computed value](computed_value) | same as box offsets: [`top`](top), [`right`](right), [`bottom`](bottom), [`left`](left) properties except that directions are logical |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
inset-block-start =
auto [|](value_definition_syntax#single_bar)
<length-percentage>
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Setting block start offset
#### HTML
```
<div>
<p class="exampleText">Example text</p>
</div>
```
#### CSS
```
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-lr;
position: relative;
inset-block-start: 20px;
background-color: #c8c800;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # position-properties](https://w3c.github.io/csswg-drafts/css-logical/#position-properties) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `inset-block-start` | 87 | 87 | 63
41-63 | No | 73 | 14.1 | 87 | 87 | 63
41-63 | 62 | 14.5 | 14.0 |
See also
--------
* The properties which defines other insets: [`inset-block-end`](inset-block-end), [`inset-inline-start`](inset-inline-start), and [`inset-inline-end`](inset-inline-end)
* The mapped physical properties: [`top`](top), [`right`](right), [`bottom`](bottom), and [`left`](left)
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)
css cos() cos()
=====
The `cos()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) is a trigonometric function that returns the cosine of a number, which is a value between `-1` and `1`. The function contains a single calculation that must resolve to either a [`<number>`](number) or an [`<angle>`](angle) by interpreting the result of the argument as radians. That is, `cos(45deg)`, `cos(0.125turn)`, and `cos(3.14159 / 4)` all represent the same value, approximately `0.707`.
Syntax
------
```
/\* Single <angle> values \*/
width: calc(100px * cos(45deg));
width: calc(100px * cos(0.125turn));
width: calc(100px * cos(0.785398163rad));
/\* Single <number> values \*/
width: calc(100px * cos(63.673));
width: calc(100px * cos(2 * 0.125));
/\* Other values \*/
width: calc(100px * cos(pi));
width: calc(100px * cos(e / 2));
```
### Parameter
The `cos(angle)` function accepts only one value as its parameter.
`angle` A calculation which resolves to a [`<number>`](number) or an [`<angle>`](angle). When specifying unitless numbers they are interpreted as a number of radians, representing an [`<angle>`](angle).
### Return value
The cosine of an `angle` will always return a number between `−1` and `1`.
* If `angle` is `infinity`, `-infinity`, or `NaN`, the result is `NaN`.
### Formal syntax
```
<cos()> =
cos( <calc-sum> )
<calc-sum> =
<calc-product> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '+' [|](value_definition_syntax#single_bar) '-' []](value_definition_syntax#brackets) <calc-product> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-product> =
<calc-value> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '*' [|](value_definition_syntax#single_bar) '/' []](value_definition_syntax#brackets) <calc-value> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-value> =
[<number>](number) [|](value_definition_syntax#single_bar)
[<dimension>](dimension) [|](value_definition_syntax#single_bar)
[<percentage>](percentage) [|](value_definition_syntax#single_bar)
<calc-constant> [|](value_definition_syntax#single_bar)
( <calc-sum> )
<calc-constant> =
e [|](value_definition_syntax#single_bar)
pi [|](value_definition_syntax#single_bar)
infinity [|](value_definition_syntax#single_bar)
-infinity [|](value_definition_syntax#single_bar)
NaN
```
Examples
--------
### Keep the size of a rotated box
The `cos()` function can be used to keep the size of a rotated box.
When the element is rotated using [`rotate()`](transform-function/rotate), it goes beyond its initial size. To fix this, we will use `cos()` to update the element size.
For example, if you rotate a `100px`/`100px` square `45deg`, the diamond it creates will be wider and taller than the original square. To shrink the diamond into the box allotted for the original square, you would have to scale down the diamond using this formula: `width = height = 100px * cos(45deg) = 100px * 0.707 = 70.7px`. You need to also adjust the [`transform-origin`](transform-origin) and add [`translate()`](transform-function/translate) to correct the position:
#### HTML
```
<div class="original-square"></div>
<div class="rotated-diamond"></div>
<div class="rotated-scaled-diamond"></div>
```
#### CSS
```
div.original-square {
width: 100px;
height: 100px;
background-color: blue;
}
div.rotated-diamond {
width: 100px;
height: 100px;
background-color: red;
transform: rotate(45deg);
}
div.rotated-scaled-diamond {
width: calc(100px * cos(45deg));
height: calc(100px * cos(45deg));
margin: calc(100px / 4 * cos(45deg));
transform: rotate(45deg);
transform-origin: center;
background-color: green;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 4 # trig-funcs](https://w3c.github.io/csswg-drafts/css-values/#trig-funcs) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `cos` | No | No | 108 | No | No | 15.4 | No | No | 108 | No | 15.4 | No |
See also
--------
* [`sin()`](sin)
* [`tan()`](tan)
* [`asin()`](asin)
* [`acos()`](acos)
* [`atan()`](atan)
* [`atan2()`](atan2)
css Scaling of SVG backgrounds Scaling of SVG backgrounds
==========================
Given the flexibility of SVG images, there's a lot to keep in mind when using them as background images with the [`background-image`](background-image) property, and even more to keep in mind when also scaling them using the [`background-size`](background-size) property. This article describes how scaling of SVG images is handled when using these properties.
The algorithm, in summary
-------------------------
The algorithm can for the most part be summarized by these four rules. There are some edge cases that aren't covered by these rules, but this covers the majority of cases.
1. If [`background-size`](background-size) specifies a fixed dimension (that is, percentages and relative units are fixed by their context), that dimension wins.
2. If the image has an intrinsic ratio (that is, its width:height ratio is constant, such as 16:9, 4:3, 2.39:1, 1:1, and so forth), the rendered size preserves that ratio.
3. If the image specifies a size, and the size isn't modified by constrain or cover, that specified size wins.
4. If none of the above cases are met, the image is rendered at the same size as the background area.
It's worth noting that the sizing algorithm only cares about the image's dimensions and proportions, or lack thereof. An SVG image with fixed dimensions will be treated just like a raster image of the same size.
**Note:** If you are trying to stretch your SVG to a different aspect ratio with CSS—for example in order to stretch it over the page background—make sure your SVG includes `preserveAspectRatio="none"`. Find out more about `[preserveAspectRatio](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio)`.
Source image examples
---------------------
Before diving in to look at the results of using different kinds of source images and seeing how they look when used with [`background-size`](background-size), it would be helpful to look at a few example source images that have different dimensions and sizing settings.
In each case, we show what the source image looks like rendered in a 150x150 box, and provide a link to the SVG source.
### Dimensionless and proportionless
This image is both dimensionless and proportionless. It doesn't care what size it is, nor does it care about remaining at a particular aspect ratio. This would make a good gradient desktop background that would work regardless of your screen size and its aspect ratio.
[SVG source](https://media.prod.mdn.mozit.cloud/attachments/2012/07/09/3469/6587a382ffb2c944462a6b110b079496/no-dimensions-or-ratio.svg)
### One specified dimension and proportionless
This image specifies a width of 100 pixels but no height or intrinsic ratio. This is, basically, a thin strip of wallpaper that could be stretched across the entire height of a block.
[SVG source](https://media.prod.mdn.mozit.cloud/attachments/2012/07/09/3468/af73bea307a10ffe2559df42fad199e3/100px-wide-no-height-or-ratio.svg)
### One specified dimension with intrinsic ratio
This image specifies a 100 pixel height but no width. It also specifies an intrinsic aspect ratio of 3:4. This ensures that its width:height ratio is always 3:4, unless it's deliberately scaled to a disproportionate size (that is, by explicitly specifying both width and height that aren't of that ratio).
This is very much like specifying a specific width and height, since once you have one dimension and a ratio, the other dimension is implied, but it's still a useful example.
[SVG source](https://media.prod.mdn.mozit.cloud/attachments/2012/07/09/3467/fd0c534c506be06d52f0a954a59863a6/100px-height-3x4-ratio.svg)
### No width or height with intrinsic ratio
This image doesn't specify either a width or a height; instead, it specifies an intrinsic ratio of 1:1. Think of this like a program icon. It's always square, and is usable at any size, such as 32x32, 128x128, or 512x512, for example.
[SVG source](https://media.prod.mdn.mozit.cloud/attachments/2012/07/09/3466/a3398e03c058d99fb2b7837167cdbc26/no-dimensions-1x1-ratio.svg)
Scaling examples
----------------
Now let's see some examples of what happens as we apply different scaling to these images. In each of the examples below, the enclosing rectangles are 300 pixels wide and 200 pixels tall. In addition, the backgrounds have [`background-repeat`](background-repeat) set to no-repeat for clarity.
**Note:** The screenshots below show the **expected** rendering. Not all browsers currently render these correctly.
### Specifying fixed lengths for both dimensions
If you use [`background-size`](background-size) to specify fixed lengths for both dimensions, those lengths are always used, per rule 1 above. In other words, the image will always get stretched to the dimensions you specify, regardless of whether or not the source image has specified its dimensions and/or aspect ratio.
#### Source: No dimensions or intrinsic ratio
Given this CSS:
```
background: url(no-dimensions-or-ratio.svg);
background-size: 125px 175px;
```
The rendered output would look like this:
#### Source: One specified dimension, no intrinsic ratio
Given this CSS:
```
background: url(100px-wide-no-height-or-ratio.svg);
background-size: 250px 150px;
```
The rendered output would look like this:
#### Source: One specified dimension with intrinsic ratio
Given this CSS:
```
background: url(100px-height-3x4-ratio.svg);
background-size: 275px 125px;
```
The rendered output would look like this:
#### Source: No specified width or height with intrinsic ratio
Given this CSS:
```
background: url(no-dimensions-1x1-ratio.svg);
background-size: 250px 100px;
```
The rendered output would look like this:
### Using contain or cover
Specifying `cover` for [`background-size`](background-size) makes the picture as small as possible while still covering the entire background area. `contain`, on the other hand, makes the image as large as possible while not being clipped by the background area.
For an image with an intrinsic ratio, exactly one size matches the `cover`/fit criteria alone. But if there is no intrinsic ratio specified, `cover`/fit isn't sufficient, so the large/small constraints choose the resulting size.
#### Source: No dimensions or intrinsic ratio
If an image doesn't specify either dimensions or an intrinsic ratio, neither rule 2 nor rule 3 apply, so rule 4 takes over: the background image is rendered covering the entire background area. This satisfies the largest-or-smallest constraint.
```
background: url(no-dimensions-or-ratio.svg);
background-size: contain;
```
The rendered output looks like this:
#### Source: One specified dimension, no intrinsic ratio
Similarly, if the image has one dimension specified but no intrinsic ratio, rule 4 applies, and the image is scaled to cover the entire background area.
```
background: url(100px-wide-no-height-or-ratio.svg);
background-size: contain;
```
The rendered output looks like this:
#### Source: One specified dimension with intrinsic ratio
Things change when you specify an intrinsic ratio. In this case, rule 1 isn't relevant, so rule 2 is applied: we try to preserve any intrinsic ratio (while respecting `contain` or `cover`). For example, preserving a 3:4 intrinsic aspect ratio for a 300x200 box with `contain` means drawing a 150x200 background.
##### contain case
```
background: url(100px-height-3x4-ratio.svg);
background-size: contain;
```
The rendered output looks like this:
Notice how the entire image is rendered, fitting as best as possible into the box without clipping any of it away.
##### cover case
```
background: url(100px-height-3x4-ratio.svg);
background-size: cover;
```
The rendered output looks like this:
Here, the 3:4 ratio is preserved while still stretching the image to fill the entire box. That causes the bottom of the image to be clipped away.
#### Source: No dimensions with intrinsic ratio
When using an image with no intrinsic dimensions but an intrinsic ratio, things work similarly.
##### contain case
```
background: url(no-dimensions-1x1-ratio.svg);
background-size: contain;
```
The rendered output looks like this:
Notice that the image is sized to fit the smallest dimension while preserving the 1:1 aspect ratio.
##### cover case
```
background: url(no-dimensions-1x1-ratio.svg);
background-size: cover;
```
The rendered output looks like this:
Here, the image is sized so that it fills the largest dimension. The 1:1 aspect ratio has been preserved, although with this source image, that can be difficult to see.
### Automatic sizing using "auto" for both dimensions
If [`background-size`](background-size) is set to `auto` or `auto auto`, rule 2 says that rendering must preserve any intrinsic ratio that's provided.
#### Source: No dimensions or intrinsic ratio
When no intrinsic ratio or dimensions are specified by the source image, rule 4 takes effect, and the image is rendered to fill the background area.
```
background: url(no-dimensions-or-ratio.svg);
background-size: auto auto;
```
The rendered output looks like this:
#### Source: One dimension and no intrinsic ratio
If no intrinsic ratio is specified, but at least one dimension is specified, rule 3 takes effect, and we render the image obeying those dimensions.
```
background: url(100px-wide-no-height-or-ratio.svg);
background-size: auto auto;
```
The rendered output looks like this:
Note here that the width, which is specified in the source SVG at 100 pixels, is obeyed, while the height fills the background area since it's not specified (either explicitly or by an intrinsic ratio).
#### Source: One dimension and an intrinsic ratio
If we have an intrinsic ratio with a fixed dimension, that fixes both dimensions in place. Knowing one dimension and a ratio is, as has been mentioned already, the same as specifying both dimensions explicitly.
```
background: url(100px-height-3x4-ratio.svg);
background-size: auto auto;
```
The rendered output looks like this:
Since this image has an explicit 100 pixel height, the 3:4 ratio explicitly sets its width at 75 pixels, so that's how it's rendered in the `auto` case.
#### Source: No fixed dimensions with intrinsic ratio
When an intrinsic ratio is specified, but no dimensions, rule 4 is applied — except that rule 2 also applies. The image is therefore rendered just like for the `contain` case.
```
background: url(no-dimensions-1x1-ratio.svg);
background-size: auto auto;
```
The rendered output looks like this:
### Using "auto" and one specific length
Given rule 1, specified dimensions are always used, so we need to use our rules only to determine the second dimension.
#### Source: No dimensions or intrinsic ratio
If the image has no dimensions or intrinsic ratio, rule 4 applies, and we use the background area's dimension to determine the value for the `auto` dimension.
```
background: url(no-dimensions-or-ratio.svg);
background-size: auto 150px;
```
Here, the width is determined using the background area's width per rule 4, while the height is the 140px specified in the CSS.
#### Source: One specified dimension with no intrinsic ratio
If the image has one specified dimension but no intrinsic ratio, that specified dimension is used per rule 3 if that dimension is set to `auto` in the CSS.
```
background: url(100px-wide-no-height-or-ratio.svg);
background-size: 200px auto;
```
Here, the 200px specified in the CSS overrides the 100px width specified in the SVG, per rule 1. Since there's no intrinsic ratio or height provided, `auto` selects the height of the background area as the height for the rendered image.
```
background: url(100px-wide-no-height-or-ratio.svg);
background-size: auto 125px;
```
In this case, the width is specified as auto in the CSS, so the 100px width specified in the SVG is selected, per rule 3. The height is set at 125px in the CSS, so that is selected per rule 1.
#### Source: One specified dimension with intrinsic ratio
When a dimension is specified, rule 1 applies that dimension from the SVG to the rendered background unless specifically overridden by the CSS. When an intrinsic ratio is also specified, that's used to determine the other dimension.
```
background: url(100px-height-3x4-ratio.svg);
background-size: 150px auto;
```
In this case, we use the width of the image specified in the CSS set at 150px, so rule 1 is applied. The intrinsic 3:4 aspect ratio then determines the height for the `auto` case.
#### Source: No specified dimensions with intrinsic ratio
If no dimensions are specified in the SVG, the specified dimension in the CSS is applied, then the intrinsic ratio is used to select the other dimension, per rule 2.
```
background: url(no-dimensions-1x1-ratio.svg);
background-size: 150px auto;
```
The width is set by the CSS to 150px. The `auto` value for the height is computed using that width and the 1:1 aspect ratio to be 150px as well, resulting in the image above.
See also
--------
* [`background-size`](background-size)
* Blog post: [Properly resizing vector image backgrounds](https://whereswalden.com/2011/10/21/properly-resizing-vector-image-backgrounds/)
| programming_docs |
css border-top-width border-top-width
================
The `border-top-width` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the width of the top border of an element.
Try it
------
Syntax
------
```
/\* Keyword values \*/
border-top-width: thin;
border-top-width: medium;
border-top-width: thick;
/\* <length> values \*/
border-top-width: 10em;
border-top-width: 3vmax;
border-top-width: 6px;
/\* Global keywords \*/
border-top-width: inherit;
border-top-width: initial;
border-top-width: revert;
border-top-width: revert-layer;
border-top-width: unset;
```
### Values
`<line-width>` Defines the width of the border, either as an explicit nonnegative [`<length>`](length) or a keyword. If it's a keyword, it must be one of the following values:
* `thin`
* `medium`
* `thick`
**Note:** Because the specification doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific. Nevertheless, they always follow the pattern `thin ≤ medium ≤ thick`, and the values are constant within a single document.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `medium` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | the absolute length or `0` if [`border-top-style`](border-top-style) is `none` or `hidden` |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
border-top-width =
<line-width>
<line-width> =
[<length [0,∞]>](length) [|](value_definition_syntax#single_bar)
thin [|](value_definition_syntax#single_bar)
medium [|](value_definition_syntax#single_bar)
thick
```
Examples
--------
### HTML
```
<div>Element 1</div>
<div>Element 2</div>
```
### CSS
```
div {
border: 1px solid red;
margin: 1em 0;
}
div:nth-child(1) {
border-top-width: thick;
}
div:nth-child(2) {
border-top-width: 2em;
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # the-border-width](https://w3c.github.io/csswg-drafts/css-backgrounds/#the-border-width) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-top-width` | 1 | 12 | 1 | 4 | 3.5 | 1 | 2.2 | 18 | 4 | 10.1 | 1 | 1.0 |
See also
--------
* The other border-width-related CSS properties: [`border-left-width`](border-left-width), [`border-right-width`](border-right-width), [`border-bottom-width`](border-bottom-width), and [`border-width`](border-width).
* The other border-top-related CSS properties: [`border`](border), [`border-top`](border-top), [`border-top-style`](border-top-style), and [`border-top-color`](border-top-color).
css :autofill :autofill
=========
The `:autofill` CSS [pseudo-class](pseudo-classes) matches when an [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) element has its value autofilled by the browser. The class stops matching if the user edits the field.
Try it
------
**Note:** The user agent style sheets of many browsers use `!important` in their `:-webkit-autofill` style declarations, making them non-overridable by webpages without resorting to JavaScript hacks. For example Chrome has the following in its internal stylesheet:
```
background-color: rgb(232, 240, 254) !important;
background-image: none !important;
color: -internal-light-dark(black, white) !important;
```
This means that you cannot set the [`background-color`](background-color), [`background-image`](background-image), or [`color`](color) in your own rules.
Syntax
------
```
:autofill
```
Examples
--------
The following example demonstrates the use of the `:autofill` pseudo-class to change the border of a text field that has been autocompleted by the browser. For the best browser compatibility use both `:-webkit-autofill` and `:autofill`.
```
input {
border: 3px solid grey;
border-radius: 3px;
}
input:-webkit-autofill {
border: 3px solid blue;
}
input:autofill {
border: 3px solid blue;
}
```
```
<form method="post" action="">
<label for="email">Email</label>
<input type="email" name="email" id="email" autocomplete="email" />
</form>
```
Specifications
--------------
| Specification |
| --- |
| [HTML Standard # selector-autofill](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-autofill) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:autofill` | 1 | 79 | 86
86 | No | 15 | 15
3 | 4.4 | 18 | 86
86 | 14 | 15
1 | 1.0 |
See also
--------
* [Chromium issue 46543: Auto-filled input text box yellow background highlight cannot be turned off](https://bugs.chromium.org/p/chromium/issues/detail?id=46543)
* [WebKit bug 66032: Allow site authors to override autofilled fields' colors.](https://bugs.webkit.org/show_bug.cgi?id=66032)
* [Mozilla bug 740979: implement `:-moz-autofill` pseudo-class on input elements with an autofilled value](https://bugzilla.mozilla.org/show_bug.cgi?id=740979)
* [User Interface Module Level 4: more selectors](https://wiki.csswg.org/spec/css4-ui#more-selectors)
css Selector list Selector list
=============
The CSS **selector list** (`,`) selects all the matching nodes. A selector list is a comma-separated list of selectors.
Description
-----------
When multiple selectors share the same declarations, they can be grouped together into a comma-separated list. Selector lists can also be passed as parameters to some functional CSS pseudo-classes. White space may appear before and/or after the comma.
The following three declarations are equivalent:
```
span {
border: red 2px solid;
}
div {
border: red 2px solid;
}
```
```
span,
div {
border: red 2px solid;
}
```
```
:is(span, div) {
border: red 2px solid;
}
```
Examples
--------
When applying the same styles to elements matching different criteria, grouping the selectors in a comma-separated list can improve consistency while reducing the size of style sheets.
### Single line grouping
This example shows grouping selectors in a single line using a comma-separated list.
```
h1, h2, h3, h4, h5, h6 {
font-family: helvetica;
}
```
### Multi line grouping
This example shows grouping selectors in multiple lines using a comma-separated list.
```
#main,
.content,
article,
h1 + p {
font-size: 1.1em;
}
```
Valid and invalid selector lists
--------------------------------
An invalid selector represents, and therefore matches, nothing. When a selector list contains an invalid selector, the entire style block is ignored, except for the [`:is()`](:is) and [`:where()`](:where) pseudo-classes that accept [forgiving selector lists](#forgiving-selector-list).
### Invalid selector list
A downside to using a selector list is that a single unsupported selector in the selector list invalidates the entire rule.
Consider the following two CSS rule sets:
```
h1 {
font-family: sans-serif;
}
h2:invalid-pseudo {
font-family: sans-serif;
}
h3 {
font-family: sans-serif;
}
```
```
h1, h2:invalid-pseudo, h3 {
font-family: sans-serif;
}
```
They are not equivalent. In the first rule set, styles will be applied on the `h1` and `h3` elements, but the `h2:invalid-pseudo` rule will not be parsed. In the second rule set, because one selector in the list is invalid, the entire rule will not be parsed. Because of this, no style will be applied to the `h1` and `h3` elements as when any selector in a list of selectors in invalid, the entire style block will be ignored.
### Forgiving selector list
A way to remedy the [invalid selector list](#invalid_selector_list) problem is to use the [`:is()`](:is) or the [`:where()`](:where) pseudo-class, which accept a forgiving selector list. Each selector in a forgiving selector list is parsed individually. So any invalid selectors in the list are ignored and the valid ones are used.
Carrying on from the previous example, the following two CSS rule sets are now equivalent:
```
h1 {
font-family: sans-serif;
}
h2:maybe-unsupported {
font-family: sans-serif;
}
h3 {
font-family: sans-serif;
}
```
```
:is(h1, h2:maybe-unsupported, h3) {
font-family: sans-serif;
}
```
The difference between the two is that the specificity of `:is()` is its most specific argument, whereas the `:where()` selector and the forgiving selector list parameter do not add any specificity weight.
### Relative selector list
A relative selector list is a comma-separated selector list parsed as [relative selectors](css_selectors#relative_selector), which begin with an explicit or implied combinator.
```
h2:has(+ p, + ul.red) {
font-style: italic;
}
```
In the above example, the italic style will be applied to any `h2` heading that is immediately followed by `<p>` or `<ul class="red">`. Note that pseudo-elements and the `:has()` selector are not valid within the [`:has()`](:has) relative selector list.
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # grouping](https://w3c.github.io/csswg-drafts/selectors/#grouping) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `Selector_list` | 1 | 12 | 1 | 3 | 3.5 | 1 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
See also
--------
* The [`:is()`](:is) and [`:where()`](:where) pseudo-classes accept forgiving selector lists.
* The [`:not()`](:not) pseudo-class accepts a regular selector list
* The [`:has()`](:has) pseudo-class accepts a relative selector list.
* [CSS selectors](css_selectors)
css hyphenate-limit-chars hyphenate-limit-chars
=====================
The `hyphenate-limit-chars` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property specifies the minimum word length to allow hyphenation of words as well as the the minimum number of characters before and after the hyphen.
This property provides you with fine-grained control over hyphenation in text. This control enables you to avoid awkward hyphenations and set appropriate hyphenation for different languages, which, in turn, allows for better typography.
Try it
------
In the interactive example above, the default minimum word length setting of `hyphenate-limit-chars` is too large for either of the long words to be hyphenated, and so the output looks untidy. However, by choosing the other value option, the minimum word length limit is reduced. This allows both the long words to be hyphenated, making for a neater layout.
Syntax
------
```
/\* Numeric values \*/
hyphenate-limit-chars: 10 4 4;
hyphenate-limit-chars: 10 4;
hyphenate-limit-chars: 10;
/\* Keyword values \*/
hyphenate-limit-chars: auto auto auto;
hyphenate-limit-chars: auto auto;
hyphenate-limit-chars: auto;
/\* Mix of numeric and keyword values \*/
hyphenate-limit-chars: 10 auto 4;
hyphenate-limit-chars: 10 auto;
hyphenate-limit-chars: auto 3;
/\* Global values \*/
hyphenate-limit-chars: inherit;
hyphenate-limit-chars: initial;
hyphenate-limit-chars: revert;
hyphenate-limit-chars: revert-layer;
hyphenate-limit-chars: unset;
```
The `hyphenate-limit-chars` property takes 1–3 values that can be numeric or `auto`, as explained below.
### Values
`x y z` The first value is the minimum word length before words should be hyphenated. The second value is the minimum number of characters before the hyphen. The third value is the minimum number of characters after the hyphen.
`x y` The first value is the minimum word length before words should be hyphenated. The second value is the minimum number of characters before the hyphen. The minimum number of characters after the hyphen will be set equal to the second value.
`x` The value is the minimum word length before words should be hyphenated. The minimum number of characters before and after the hyphen will be set to `auto`.
If `auto` is set for any of the values, the user agent will choose an appropriate value for the current layout. Unless the user agent can calculate a better value, the following default values will be used:
* Minimum word length to allow hyphenation: 5
* Minimum number of characters before the hyphen: 2
* Minimum number of characters after the hyphen: 2
**Note:** If a word is shorter than any of the provided values, it will not be hyphenated.
Formal definition
-----------------
Value not found in DB!Formal syntax
-------------
```
hyphenate-limit-chars =
[[](value_definition_syntax#brackets) auto [|](value_definition_syntax#single_bar) [<integer>](integer) []](value_definition_syntax#brackets)[{1,3}](value_definition_syntax#curly_braces)
```
Examples
--------
```
p {
hyphens: auto;
hyphenate-limit-chars: 10 3 4;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Text Module Level 4 # propdef-hyphenate-limit-chars](https://w3c.github.io/csswg-drafts/css-text-4/#propdef-hyphenate-limit-chars) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `hyphenate-limit-chars` | 109 | 109 | No | No | No | No | 109 | 109 | No | No | No | No |
See also
--------
* [`hyphens`](hyphens)
* [CSS Text module](css_text)
css :target-within :target-within
==============
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `:target-within` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) represents an element that is a target element or *contains* an element that is a target. A target element is a unique element with an [`id`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#id) matching the URL's fragment. In other words, it represents an element that is itself matched by the [`:target`](:target) pseudo-class or has a descendant that is matched by `:target`. (This includes descendants in [shadow trees](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM).)
```
/\* Selects a <div> when one of its descendants is a target \*/
div:target-within {
background: cyan;
}
```
Syntax
------
```
:target-within
```
Examples
--------
### Highlighting an article
The `:target-within` pseudo-class can be used to highlight the article if anything inside it has been directly linked to. The `:target` pseudo-class is also being used to show which item has been targeted.
#### HTML
```
<h3>Table of Contents</h3>
<ol>
<li><a href="#p1">Jump to the first paragraph!</a></li>
<li><a href="#p2">Jump to the second paragraph!</a></li>
</ol>
<article>
<h3>My Fun Article</h3>
<p id="p1">
You can target <i>this paragraph</i> using a URL fragment. Click on the link
above to try out!
</p>
<p id="p2">
This is <i>another paragraph</i>, also accessible from the links above.
Isn't that delightful?
</p>
</article>
```
#### CSS
```
article:target-within {
background-color: gold;
}
/\* Add a pseudo-element inside the target element \*/
p:target::before {
font: 70% sans-serif;
content: "►";
color: limegreen;
margin-right: 0.25em;
}
/\* Style italic elements within the target element \*/
p:target i {
color: red;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # the-target-within-pseudo](https://w3c.github.io/csswg-drafts/selectors/#the-target-within-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:target-within` | No | No | No | No | No | No | No | No | No | No | No | No |
See also
--------
* [`:target`](:target)
css Pseudo-elements Pseudo-elements
===============
A CSS **pseudo-element** is a keyword added to a selector that lets you style a specific part of the selected element(s). For example, [`::first-line`](::first-line) can be used to change the font of the first line of a paragraph.
```
/\* The first line of every <p> element. \*/
p::first-line {
color: blue;
text-transform: uppercase;
}
```
**Note:** In contrast to pseudo-elements, [`pseudo-classes`](pseudo-classes) can be used to style an element based on its *state*.
Syntax
------
```
selector::pseudo-element {
property: value;
}
```
You can use only one pseudo-element in a selector. It must appear after the simple selectors in the statement.
**Note:** As a rule, double colons (`::`) should be used instead of a single colon (`:`). This distinguishes pseudo-classes from pseudo-elements. However, since this distinction was not present in older versions of the W3C spec, most browsers support both syntaxes for the original pseudo-elements.
Alphabetical index
------------------
Pseudo-elements defined by a set of CSS specifications include the following:
A
* [`::after`](::after)
B
* [`::backdrop`](::backdrop)
* [`::before`](::before)
C
* [`::cue`](::cue)
* [`::cue-region`](::cue-region)
F
* [`::first-letter`](::first-letter)
* [`::first-line`](::first-line)
* [`::file-selector-button`](::file-selector-button)
G
* [`::grammar-error`](::grammar-error) Experimental
M
* [`::marker`](::marker)
P
* [`::part()`](::part)
* [`::placeholder`](::placeholder)
S
* [`::selection`](::selection)
* [`::slotted()`](::slotted)
* [`::spelling-error`](::spelling-error) Experimental
T
* [`::target-text`](::target-text) Experimental
Specifications
--------------
| Specification |
| --- |
| [Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification # pseudo-element-selectors](https://www.w3.org/TR/CSS22/selector.html#pseudo-element-selectors) |
Browser compatibility
---------------------
See also
--------
* [Pseudo-classes](pseudo-classes)
css grid-auto-flow grid-auto-flow
==============
The `grid-auto-flow` CSS property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid.
Try it
------
Syntax
------
```
/\* Keyword values \*/
grid-auto-flow: row;
grid-auto-flow: column;
grid-auto-flow: dense;
grid-auto-flow: row dense;
grid-auto-flow: column dense;
/\* Global values \*/
grid-auto-flow: inherit;
grid-auto-flow: initial;
grid-auto-flow: revert;
grid-auto-flow: revert-layer;
grid-auto-flow: unset;
```
This property may take one of two forms:
* a single keyword: one of `row`, `column`, or `dense`.
* two keywords: `row dense` or `column dense`.
### Values
`row` Items are placed by filling each row in turn, adding new rows as necessary. If neither `row` nor `column` is provided, `row` is assumed.
`column` Items are placed by filling each column in turn, adding new columns as necessary.
`dense` "dense" packing algorithm attempts to fill in holes earlier in the grid, if smaller items come up later. This may cause items to appear out-of-order, when doing so would fill in holes left by larger items.
If it is omitted, a "sparse" algorithm is used, where the placement algorithm only ever moves "forward" in the grid when placing items, never backtracking to fill holes. This ensures that all of the auto-placed items appear "in order", even if this leaves holes that could have been filled by later items.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `row` |
| Applies to | grid containers |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
grid-auto-flow =
[[](value_definition_syntax#brackets) row [|](value_definition_syntax#single_bar) column []](value_definition_syntax#brackets) [||](value_definition_syntax#double_bar)
dense
```
Examples
--------
### Setting grid auto-placement
#### HTML
```
<div id="grid">
<div id="item1"></div>
<div id="item2"></div>
<div id="item3"></div>
<div id="item4"></div>
<div id="item5"></div>
</div>
<select id="direction">
<option value="column">column</option>
<option value="row">row</option>
</select>
<input id="dense" type="checkbox" />
<label for="dense">dense</label>
```
#### CSS
```
#grid {
height: 200px;
width: 200px;
display: grid;
gap: 10px;
grid-template: repeat(4, 1fr) / repeat(2, 1fr);
grid-auto-flow: column; /\* or 'row', 'row dense', 'column dense' \*/
}
#item1 {
background-color: lime;
grid-row-start: 3;
}
#item2 {
background-color: yellow;
}
#item3 {
background-color: blue;
}
#item4 {
grid-column-start: 2;
background-color: red;
}
#item5 {
background-color: aqua;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Grid Layout Module Level 2 # grid-auto-flow-property](https://w3c.github.io/csswg-drafts/css-grid/#grid-auto-flow-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `grid-auto-flow` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
See also
--------
* Related CSS properties: [`grid-auto-rows`](grid-auto-rows), [`grid-auto-columns`](grid-auto-columns), [`grid`](grid)
* Grid Layout Guide: *[Auto-placement in grid layout](css_grid_layout/auto-placement_in_css_grid_layout)*
* Video tutorial: *[Introducing Grid auto-placement and order](https://gridbyexample.com/video/series-auto-placement-order/)*
| programming_docs |
css border-top-color border-top-color
================
The `border-top-color` CSS property sets the color of an element's top <border>. It can also be set with the shorthand CSS properties [`border-color`](border-color) or [`border-top`](border-top).
Try it
------
Syntax
------
```
/\* <color> values \*/
border-top-color: red;
border-top-color: #ffbb00;
border-top-color: rgb(255 0 0);
border-top-color: hsl(100deg 50% 25% / 0.75);
border-top-color: currentcolor;
border-top-color: transparent;
/\* Global values \*/
border-top-color: inherit;
border-top-color: initial;
border-top-color: revert;
border-top-color: revert-layer;
border-top-color: unset;
```
The `border-top-color` property is specified as a single value.
### Values
[`<color>`](color_value) The color of the top border.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `currentcolor` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | computed color |
| Animation type | a [color](color_value#interpolation) |
Formal syntax
-------------
```
border-top-color =
[<color>](color_value)
```
Examples
--------
### A simple div with a border
#### HTML
```
<div class="mybox">
<p>
This is a box with a border around it. Note which side of the box is
<span class="redtext">red</span>.
</p>
</div>
```
#### CSS
```
.mybox {
border: solid 0.3em gold;
border-top-color: red;
width: auto;
}
.redtext {
color: red;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # border-color](https://w3c.github.io/csswg-drafts/css-backgrounds/#border-color) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-top-color` | 1 | 12 | 1
Firefox also supports the non-standard [`-moz-border-top-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-top-colors) CSS property that sets the top border to multiple colors. | 4 | 3.5 | 1 | 4.4 | 18 | 4
Firefox also supports the non-standard [`-moz-border-top-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-top-colors) CSS property that sets the top border to multiple colors. | 10.1 | 1 | 1.0 |
See also
--------
* The border-related CSS shorthand properties: [`border`](border), [`border-top`](border-top), and [`border-color`](border-color).
* The color-related CSS properties for the other borders: [`border-right-color`](border-right-color), [`border-bottom-color`](border-bottom-color), and [`border-left-color`](border-left-color).
* The other border-related CSS properties applying to the same border: [`border-top-style`](border-top-style) and [`border-top-width`](border-top-width).
css Visual formatting model Visual formatting model
=======================
In CSS The **Visual Formatting Model** describes how user agents take the document tree, and process and display it for visual media. This includes [continuous media](https://developer.mozilla.org/en-US/docs/Glossary/Continuous_Media) such as a computer screen and paged media such as a book or document printed by browser print functions. Most of the information applies equally to continuous and paged media.
In the visual formatting model, each element in the document tree generates zero or more boxes according to the box model. The layout of these boxes is governed by:
* Box dimensions and type.
* Positioning scheme (normal flow, float, and absolute positioning).
* Relationships between elements in the document tree.
* External information (e.g., viewport size, intrinsic dimensions of images, etc.).
Much of the information about the visual formatting model is defined in CSS2, however, various level 3 specifications have added to this information. When reading specifications you will often find references to the model as defined in CSS2, so an understanding of the model and the terms used to describe it in CSS2 is valuable when reading other layout specifications.
In this document we define the model and introduce some of the related terms and concepts, linking to more specific pages on MDN for further details.
The role of the viewport
------------------------
In continuous media, the [viewport](https://developer.mozilla.org/en-US/docs/Glossary/Viewport) is the viewing area of the browser window. User agents can change the layout of the page when the viewport size changes — for example, if you resize your window, or change the orientation of a mobile device.
If the viewport is smaller than the size of the document then the user agent needs to offer a way to scroll to the parts of the document that are not displayed. We most often see this as scrolling in the **block dimension** — vertically in a horizontal, top-to-bottom language. However, you might design something that requires scrolling in the **inline dimension** too.
Box generation
--------------
**Box generation** is the part of the CSS visual formatting model that creates boxes from the document's elements. Generated boxes are of different types, which affect their visual formatting. The type of the box generated depends on the value of the CSS [`display`](display) property.
Initially defined in CSS2, the `display` property is extended in the [CSS Display Module Level 3](https://www.w3.org/TR/css-display-3/). In addition, some of the terminologies around the display have been updated and clarified in the years since CSS2.
CSS takes your source document and renders it onto a canvas. To do this, it generates an intermediary structure, the **box tree**, which represents the formatting structure of the rendered document. Each box in the box tree represents its corresponding element (or pseudo-element) in space and/or time on the canvas, while each text run in the box tree likewise represents the contents of its corresponding text nodes.
Then, for each element, CSS generates zero or more boxes as specified by that element's `display` property value.
**Note:** Boxes are often referred to by their display type — e.g. a box generated by an element with `display: block` is called a "block box" or just a "block". Note however that block boxes, block-level boxes and box containers are all subtly different; see the [Block boxes](#block_boxes) section below for more details.
### The principal box
When an element generates one or more boxes, one of them is the **principal box**, which contains its descendant boxes and generated content in the box tree, and is also the box involved in any positioning scheme.
Some elements may generate additional boxes in addition to the principal box, for example `display: list-item` generates more than one box (e.g. a **principal block box** and a **child marker box**). And some values (such as `none` or `contents`) cause the element and/or its descendants to not generate any boxes at all.
### Anonymous boxes
An **anonymous box** is created when there is not an HTML element to use for the box. This situation happens when, for example, you declare `display: flex` on a parent element, and directly inside there is a run of text not contained in another element. In order to fix the box tree, an anonymous box is created around that run of text. It will then behave as a flex item, however, it cannot be targeted and styled like a regular box because there is no element to target.
The same thing happens when you have text runs interspersed with block elements. In the next example I have a string inside a `<div>`; in the middle of my string is a `<p>` element containing part of the text.
The string is split into three boxes in the box tree. The part of the string before the paragraph element is wrapped in an anonymous box, then we have the `<p>`, which generates a box, and then another anonymous box.
Something to consider about these anonymous boxes is that they inherit styles from their direct parent, but you cannot change how they look by targeting the anonymous box. In my examples, I am using a direct child selector to target the children of the container. This does not change the anonymous boxes, as they are not "elements" as such.
**Inline anonymous boxes** are created when a string is split by an inline element, for example, a sentence that includes a section wrapped with `<em></em>`. This splits the sentence into three inline boxes — an anonymous inline box before the emphasized section, the section wrapped in the `<em>` element, then a final anonymous inline box. As with the anonymous block boxes, these anonymous inline boxes cannot be styled independently in the way the `<em>` can; they just inherit the styles of their container.
Other formatting contexts also create anonymous boxes. [Grid Layout](css_grid_layout) behaves in the same way as the [flexbox](css_flexible_box_layout) example above, turning strings of text into a grid item with an anonymous box. [Multiple-column](css_columns) layout creates anonymous column boxes around the columns; these also cannot be styled or otherwise targeted. [Table layout](css_table) will add anonymous boxes to create a proper table structure — for example adding an anonymous table row — if there was no box with `display: table-row`.
### Line boxes
**Line boxes** are the boxes that wrap each line of text. You can see the difference between line boxes and their containing block if you float an item and then follow it by a block that has a background color.
In the following example, the line boxes following the floated `<div>` are shortened to wrap around the float. The background of the box runs behind the float, as the floated item has been taken out of flow.
Positioning schemes and in-flow and out-of-flow elements
--------------------------------------------------------
In CSS, a box may be laid out according to three positioning schemes — **normal flow**, **floats**, or **absolute positioning**.
### Normal flow
In CSS, the normal flow includes block-level formatting of block boxes, inline-level formatting of inline boxes, and also includes relative and sticky positioning of block-level and inline-level boxes.
Read more about [flow layout](css_flow_layout) in CSS.
### Floats
In the float model, a box is first laid out according to the normal flow, then taken out of the flow and positioned, typically to the left or right. Content may flow along the side of a float.
Find out more about [floats](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Floats).
### Absolute positioning
In the absolute positioning model (which also includes fixed positioning), a box is removed from the normal flow entirely and assigned a position with respect to a containing block (which is the viewport in the case of fixed positioning).
An element is called **out of flow** if it is floated, absolutely positioned, or is the root element. An element is called **in-flow** if it is not out of the flow.
Read about [CSS Positioned Layout](css_positioning).
Formatting contexts and the display property
--------------------------------------------
Boxes can be described as having an **outer display type**, which is `block` or `inline`. This outer display type refers to how the box behaves alongside other elements on the page.
Boxes also have an inner display type, dictating how their children behave. For normal block and inline layout, or normal flow, this display type is `flow`. This means that the child elements will also be either `block` or `inline`.
However, the inner display type might be something like `grid` or `flex`, in which case the direct children will display as a grid, or flex items. In such a case the element is described as creating a grid or flex [formatting context](css_flow_layout/intro_to_formatting_contexts). In many ways this is similar to a block formatting context, however, the children behave as flex or grid items rather than items in normal flow.
The interactions between block-level and inline-level boxes are described in the MDN documentation for [`display`](display).
In addition, the references for specific values of display explain how these formatting contexts work in terms of box layout.
* [CSS Grid Layout](css_grid_layout)
* [CSS Flexible Box Layout](css_flexible_box_layout)
* [CSS Table Layout](css_table)
* [Lists](css_lists_and_counters)
### Independent formatting contexts
Elements either participate in the formatting context of their containing block or establish an independent formatting context. A grid container, for example, establishes a new **Grid Formatting Context** for its children.
**Independent formatting contexts** contain floats, and margins do not collapse across formatting context boundaries. Therefore, creating a new block formatting context can ensure that floats and margins remain inside a box. To do this, add `display: flow-root` to the box on which you wish to create a new [block formatting context](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context).
The following example shows the effect of `display: flow-root`. The box with the black background appears to wrap round the floated item and text. If you remove `display: flow-root` from the editable CSS the floated item will poke out of the bottom of the box as it is no longer contained.
### Block boxes
In specifications, block boxes, block-level boxes, and block containers are all referred to as **block boxes** in certain places. These things are somewhat different and the term block box should only be used if there is no ambiguity.
#### Block containers
A **block container** either contains only inline-level boxes participating in an inline formatting context, or only block-level boxes participating in a block formatting context. For this reason, we see the behavior explained above, where anonymous boxes are introduced to ensure all of the items can participate in a block or inline formatting context. An element is a block container only if it contains block-level or inline-level boxes.
#### Inline-level and block-level boxes
These are the boxes contained inside the block container that are participating in inline or block layout, respectively.
#### Block boxes
A block box is a block-level box that is also a block container. As described in CSS `display`, it is possible for a box to be a block-level box, but not also a block container (it might be a flex or grid container for example).
See also
--------
* CSS key concepts:
+ [CSS syntax](syntax)
+ [Comments](comments)
+ [Specificity](specificity)
+ [Inheritance](inheritance)
+ [Box model](css_box_model/introduction_to_the_css_box_model)
+ [Layout modes](layout_mode)
+ [Visual formatting models](visual_formatting_model)
+ [Margin collapsing](css_box_model/mastering_margin_collapsing)
+ Values
- [Initial values](initial_value)
- [Computed values](computed_value)
- [Used values](used_value)
- [Actual values](actual_value)
+ [Value definition syntax](value_definition_syntax)
+ [Shorthand properties](shorthand_properties)
+ [Replaced elements](replaced_element)
css padding-bottom padding-bottom
==============
The `padding-bottom` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the height of the [padding area](css_box_model/introduction_to_the_css_box_model#padding_area) on the bottom of an element.
Try it
------
An element's padding area is the space between its content and its border.
**Note:** The [`padding`](padding) property can be used to set paddings on all four sides of an element with a single declaration.
Syntax
------
```
/\* <length> values \*/
padding-bottom: 0.5em;
padding-bottom: 0;
padding-bottom: 2cm;
/\* <percentage> value \*/
padding-bottom: 10%;
/\* Global values \*/
padding-bottom: inherit;
padding-bottom: initial;
padding-bottom: revert;
padding-bottom: revert-layer;
padding-bottom: unset;
```
The `padding-bottom` property is specified as a single value chosen from the list below. Unlike margins, negative values are not allowed for padding.
### Values
[`<length>`](length) The size of the padding as a fixed value. Must be nonnegative.
[`<percentage>`](percentage) The size of the padding as a percentage, relative to the inline size (*width* in a horizontal language, defined by [`writing-mode`](writing-mode)) of the [containing block](containing_block). Must be nonnegative.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements, except `table-row-group`, `table-header-group`, `table-footer-group`, `table-row`, `table-column-group` and `table-column`. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | no |
| Percentages | refer to the width of the containing block |
| [Computed value](computed_value) | the percentage as specified or the absolute length |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
padding-bottom =
[<length-percentage [0,∞]>](length-percentage)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Setting padding bottom with pixels and percentages
```
.content {
padding-bottom: 5%;
}
.sidebox {
padding-bottom: 10px;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Box Model Module Level 3 # padding-physical](https://w3c.github.io/csswg-drafts/css-box/#padding-physical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `padding-bottom` | 1 | 12 | 1 | 4 | 3.5 | 1 | ≤37 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [Introduction to the CSS basic box model](css_box_model/introduction_to_the_css_box_model)
* [`padding-top`](padding-top), [`padding-right`](padding-right), [`padding-left`](padding-left) and the [`padding`](padding) shorthand
* The mapped logical properties: [`padding-block-start`](padding-block-start), [`padding-block-end`](padding-block-end), [`padding-inline-start`](padding-inline-start), and [`padding-inline-end`](padding-inline-end) and the shorthands [`padding-block`](padding-block) and [`padding-inline`](padding-inline)
css CSS Conditional Rules CSS Conditional Rules
=====================
**CSS Conditional Rules** is a CSS module that allows to define a set of rules that will only apply based on the capabilities of the processor or the document the style sheet is being applied to.
Reference
---------
### At-rules
* [`@document`](@document)
* [`@media`](@media)
* [`@supports`](@supports)
* [`@import`](@import)
Specifications
--------------
| Specification |
| --- |
| [CSS Cascading and Inheritance Level 5 # at-import](https://w3c.github.io/csswg-drafts/css-cascade-5/#at-import) |
| [Media Queries Level 4 # media-descriptor-table](https://w3c.github.io/csswg-drafts/mediaqueries/#media-descriptor-table) |
| [CSS Conditional Rules Module Level 3 # at-media](https://w3c.github.io/csswg-drafts/css-conditional-3/#at-media) |
| [CSS Conditional Rules Module Level 4 # at-supports-ext](https://w3c.github.io/csswg-drafts/css-conditional-4/#at-supports-ext) |
| [CSS Conditional Rules Module Level 3 # at-supports](https://w3c.github.io/csswg-drafts/css-conditional-3/#at-supports) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `CSS_Conditional_Rules` | 28 | 12 | 22 | No | 12.1 | 9 | 4.4 | 28 | 22 | 12.1 | 9 | 1.5 |
| `font-format` | No | No | 106 | No | No | No | No | No | 106 | No | No | No |
| `font-tech` | No | No | 106 | No | No | No | No | No | 106 | No | No | No |
| `selector` | 83 | 83 | 69 | No | 69 | 14.1 | 83 | 83 | 79 | No
See [bug 979041](https://crbug.com/979041). | 14.5 | 13.0 |
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `-moz-device-pixel-ratio` | No | No | 4 | No | No | No | No | No | 4 | No | No | No |
| `-webkit-animation` | 2-36 | No | No | No | 15-23 | 4 | 2-37 | 18-36 | No | 14-24 | 3.2 | 1.0-3.0 |
| `-webkit-device-pixel-ratio` | 1 | 12 | 63
Implemented as an alias for `-moz-device-pixel-ratio`. | No | 15 | 3 | ≤37 | 18 | 63
Implemented as an alias for `-moz-device-pixel-ratio`. | 14 | 1 | 1.0 |
| `-webkit-max-device-pixel-ratio` | 1 | 12 | 63
Implemented as an alias for `max--moz-device-pixel-ratio`. | No | 15 | 3 | ≤37 | 18 | 63
Implemented as an alias for `max--moz-device-pixel-ratio`. | 14 | 1 | 1.0 |
| `-webkit-min-device-pixel-ratio` | 1 | 12 | 63
Implemented as an alias for `min--moz-device-pixel-ratio`. | No | 15 | 3 | ≤37 | 18 | 63
Implemented as an alias for `min--moz-device-pixel-ratio`. | 14 | 1 | 1.0 |
| `-webkit-transform-2d` | 2-36 | No | No | No | 15-23 | 4 | 2-37 | 18-36 | No | 14-24 | 3.2 | 1.0-3.0 |
| `-webkit-transform-3d` | 2 | 12 | 49 | No | 15 | 4 | 4.4 | 18 | 49 | 14 | 3.2 | 1.0 |
| `-webkit-transition` | 2-36 | No | No | No | 15-23 | 4 | 2-37 | 18-36 | No | 14-24 | 3.2 | 1.0-3.0 |
| `CSS_Conditional_Rules` | 1 | 12 | 1 | 6 | 9.2 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `any-hover` | 41 | 16 | 64 | No | 28 | 9 | 41 | 41 | 64 | 28 | 9 | 5.0 |
| `any-pointer` | 41 | 12 | 64 | No | 28 | 9 | 41 | 41 | 64 | 28 | 9 | 4.0 |
| `aspect-ratio` | 3 | 12 | 3.5 | 9 | 10 | 5 | ≤37 | 18 | 4 | 10.1 | 4.2 | 1.0 |
| `calc` | 66 | 79 | 59 | No | 53 | 12 | 66 | 66 | 59 | 47 | 12 | 9.0 |
| `color` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `color-gamut` | 58 | 79 | No | No | 45 | 10 | 58 | 58 | No | 43 | 10 | 7.0 |
| `color-index` | 29 | 79 | No | No | 16 | 8 | 4.4 | 29 | No | 16 | 8 | 2.0 |
| `device-aspect-ratio` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `device-height` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `device-width` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `display-mode` | 42 | 79 | 47
Firefox 47 and later support `display-mode` values `fullscreen` and `browser`. Firefox 57 added support for `minimal-ui` and `standalone` values. | No | 29 | 13 | 42 | 42 | 47
Firefox 47 and later support `display-mode` values `fullscreen` and `browser`. Firefox 57 added support for `minimal-ui` and `standalone` values. | 29 | 12.2 | 4.0 |
| `dynamic-range` | 98 | 98 | 100 | No | 84 | 13.1 | 98 | 98 | 100 | 68 | 13.4 | 18.0 |
| `forced-colors` | 89 | 79 | 89 | No | No | No | No
See [bug 970285](https://crbug.com/970285). | No
See [bug 970285](https://crbug.com/970285). | 89 | No | No | No
See [bug 970285](https://crbug.com/970285). |
| `grid` | 1 | 12 | 2 | 10 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `height` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `hover` | 38
Before Chrome 41, the implementation was buggy and reported `(hover: none)` on non-touch-based computers with a mouse/trackpad. See [bug 441613](https://crbug.com/441613). | 12 | 64 | No | 28 | 9 | 38
Before Chrome 41, the implementation was buggy and reported `(hover: none)` on non-touch-based computers with a mouse/trackpad. See [bug 441613](https://crbug.com/441613). | 50 | 64 | 28 | 9 | 5.0 |
| `inverted-colors` | No | No | No | No | No | 9.1 | No | No | No | No | 10 | No |
| `media_features` | 1 | 12 | 1 | 9 | 9.2 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
| `media_query_values` | 66 | 79 | 59 | No | 53 | No | 66 | 66 | 59 | 47 | No | 9.0 |
| `monochrome` | 1 | 79 | 2 | No | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `nested-queries` | 26 | 12 | 11 | No | 12.1 | 7 | 4.4 | 26 | 14 | 12.1 | 7 | 1.5 |
| `orientation` | 3 | 12 | 2 | 9 | 10.6 | 5 | ≤37 | 18 | 4 | 11 | 4.2 | 1.0 |
| `overflow-block` | No | No | 66 | No | No | No | No | No | 66 | No | No | No |
| `overflow-inline` | No | No | 66 | No | No | No | No | No | 66 | No | No | No |
| `pointer` | 41 | 12 | 64 | No | 28 | 9 | 41 | 50 | 64 | 28 | 9 | 5.0 |
| `prefers-color-scheme` | 76 | 79 | 67 | No | 62 | 12.1 | 76 | 76 | 67 | 54 | 13 | 14.2 |
| `prefers-contrast` | 96 | 96 | 101 | No | 82 | 14.1 | 96 | 96 | 101 | No | 14.5 | 17.0 |
| `prefers-reduced-data` | 85
See [bug 1051189](https://crbug.com/1051189). | 85
See [bug 1051189](https://crbug.com/1051189). | No | No | 71
See [bug 1051189](https://crbug.com/1051189). | No | No
See [bug 1051189](https://crbug.com/1051189). | 85
See [bug 1051189](https://crbug.com/1051189). | No | No | No | No |
| `prefers-reduced-motion` | 74 | 79 | 63 | No | 62 | 10.1 | 74 | 74 | 64 | 53 | 10.3 | 11.0 |
| `range_syntax` | 104 | No | 63 | No | No | No | 104 | 104 | 63 | 71 | No | No |
| `resolution` | 29 | 12 | 8
3.5
Supports [`<integer>`](https://developer.mozilla.org/docs/Web/CSS/integer) values only. | 9 | 16
10-15 | No
See [bug 78087](https://webkit.org/b/78087). | 4.4 | 29 | 8
4
Supports [`<integer>`](https://developer.mozilla.org/docs/Web/CSS/integer) values only. | 16
10.1-14 | No
See [bug 78087](https://webkit.org/b/78087). | 2.0 |
| `scripting` | No
See [bug 489957](https://crbug.com/489957). | No
See [bug 489957](https://crbug.com/489957). | No
See [bug 1166581](https://bugzil.la/1166581). | No | No | No | No
See [bug 489957](https://crbug.com/489957). | No
See [bug 489957](https://crbug.com/489957). | No
See [bug 1166581](https://bugzil.la/1166581). | No | No | No
See [bug 489957](https://crbug.com/489957). |
| `update` | No | No | 102 | No | No | No | No | No | 102 | No | No | No |
| `video-dynamic-range` | 98 | 98 | 100 | No | 84 | 13.1 | 98 | 98 | 100 | 68 | 13.4 | 18.0 |
| `width` | 1 | 12 | 2 | 9 | 10 | 3 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `CSS_Conditional_Rules` | 1 | 12 | 1 | 5.5 | 3.5 | 1 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `layer` | 99 | 99 | 97 | No | 85 | 15.4 | 99 | 99 | 97 | 68 | 15.4 | 18.0 |
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `CSS_Conditional_Rules` | No | No | 61
Only supports an empty `url-prefix()` value, which is supported due to its [use in Firefox browser detection](https://css-tricks.com/snippets/css/css-hacks-targeting-firefox/). Still supported in user stylesheets.
1.5-61 | No | No | No | No | No | 61
Only supports an empty `url-prefix()` value, which is supported due to its [use in Firefox browser detection](https://css-tricks.com/snippets/css/css-hacks-targeting-firefox/). Still supported in user stylesheets.
4-61 | No | No | No |
| `regexp` | No | No | 6-61 | No | No | No | No | No | 6-61 | No | No | No |
### css.at-rules.document
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
### css.at-rules.import
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
### css.at-rules.media
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
### css.at-rules.supports
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
| programming_docs |
css -moz-outline-radius-topleft -moz-outline-radius-topleft
===========================
**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the [compatibility table](#browser_compatibility) at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
In Mozilla applications, the `-moz-outline-radius-topleft` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property can be used to round the top-left corner of an element's [`outline`](outline).
Syntax
------
The value of `-moz-outline-radius-topleft` is either a CSS [`<length>`](length) or a <percentage> of the corresponding dimensions of the border box. The [`calc()`](calc) function may be used as well.
### Values
`<length>` The radius of the circle defining the curvature of the top and left edges of the element, specified as a CSS [`<length>`](length).
`<percentage>` The radius of the circle defining the rounding of the top-left corner of the element, specified as the [percentages](percentage) of the top and left sides of the border box.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| Percentages | refer to the corresponding dimension of the border box |
| [Computed value](computed_value) | as specified |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
-moz-outline-radius-topleft =
<outline-radius>
```
Examples
--------
The example below will not display the desired effect if you are viewing this in a browser other than Firefox.
### HTML
```
<p>Look at this paragraph's top-left corner.</p>
```
### CSS
```
p {
margin: 5px;
border: solid cyan;
outline: dotted red;
-moz-outline-radius-topleft: 2em;
}
```
### Result
Specifications
--------------
Not part of any standard.
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `-moz-outline-radius-topleft` | No | No | 1-88
From Firefox 88, [outline](https://developer.mozilla.org/docs/Web/CSS/outline) now follows the shape created by [border-radius](https://developer.mozilla.org/docs/Web/CSS/border-radius) automatically, so this property is no longer needed (see [bug 1694146](https://bugzil.la/1694146)). | No | No | No | No | No | 4-88
From Firefox 88, [outline](https://developer.mozilla.org/docs/Web/CSS/outline) now follows the shape created by [border-radius](https://developer.mozilla.org/docs/Web/CSS/border-radius) automatically, so this property is no longer needed (see [bug 1694146](https://bugzil.la/1694146)). | No | No | No |
See also
--------
* See the [`-moz-outline-radius`](-moz-outline-radius) property for more information.
css margin-inline-end margin-inline-end
=================
The `margin-inline-end` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the logical inline end margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. In other words, it corresponds to the [`margin-top`](margin-top), [`margin-right`](margin-right), [`margin-bottom`](margin-bottom) or [`margin-left`](margin-left) property depending on the values defined for [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation).
Try it
------
Syntax
------
```
/\* <length> values \*/
margin-inline-end: 10px; /\* An absolute length \*/
margin-inline-end: 1em; /\* relative to the text size \*/
margin-inline-end: 5%; /\* relative to the nearest block container's width \*/
/\* Keyword values \*/
margin-inline-end: auto;
/\* Global values \*/
margin-inline-end: inherit;
margin-inline-end: initial;
margin-inline-end: revert;
margin-inline-end: revert-layer;
margin-inline-end: unset;
```
It relates to [`margin-block-start`](margin-block-start), [`margin-block-end`](margin-block-end), and [`margin-inline-start`](margin-inline-start), which define the other margins of the element.
### Values
The `margin-inline-end` property takes the same values as the [`margin-left`](margin-left) property.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | same as [`margin`](margin) |
| [Inherited](inheritance) | no |
| Percentages | depends on layout model |
| [Computed value](computed_value) | if specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, `auto` |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
margin-inline-end =
<'margin-top'>
```
Examples
--------
### Setting inline end margin
#### HTML
```
<div>
<p class="exampleText">Example text</p>
</div>
```
#### CSS
```
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-lr;
margin-inline-end: 20px;
background-color: #c8c800;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # margin-properties](https://w3c.github.io/csswg-drafts/css-logical/#margin-properties) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `margin-inline-end` | 87
2 | 87
79 | 41
3 | No | 73
15 | 12.1
3 | 87
2 | 87
18 | 41
4 | 62
14 | 12.2
3 | 14.0
1.0 |
See also
--------
* [CSS Logical Properties and Values](css_logical_properties)
* [`margin-inline-start`](margin-inline-start)
* The mapped physical properties: [`margin-top`](margin-top), [`margin-right`](margin-right), [`margin-bottom`](margin-bottom), and [`margin-left`](margin-left)
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)
css cross-fade() cross-fade()
============
The `cross-fade()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) can be used to blend two or more images at a defined transparency. It can be used for many simple image manipulations, such as tinting an image with a solid color or highlighting a particular area of the page by combining an image with a radial gradient.
Syntax
------
**Warning:** The specification and current implementations have different syntaxes. The specification syntax is explained first.
### Specification syntax
The `cross-fade()` function takes a list of images with a percentage defining how much of each image is retained in terms of opacity when it is blended with the other images. The percent value must be coded without quotes, must contain the `'%'` symbol, and its value must be between 0% and 100%.
The function can be used in CSS anywhere an ordinary image reference can be used.
#### Cross-fade percentages
Think of the percentage as an opacity value for each image. This means a value of 0% means the image is fully transparent while a value of 100% makes the image fully opaque.
```
cross-fade(url(white.png) 0%, url(black.png) 100%); /\* fully black \*/
cross-fade(url(white.png) 25%, url(black.png) 75%); /\* 25% white, 75% black \*/
cross-fade(url(white.png) 50%, url(black.png) 50%); /\* 50% white, 50% black \*/
cross-fade(url(white.png) 75%, url(black.png) 25%); /\* 75% white, 25% black \*/
cross-fade(url(white.png) 100%, url(black.png) 0%); /\* fully white \*/
cross-fade(url(green.png) 75%, url(red.png) 75%); /\* both green and red at 75% \*/
```
If any percentages are omitted, all the specified percentages are summed together and subtracted from `100%`. If the result is greater than 0%, the result is then divided equally between all images with omitted percentages.
In the simplest case, two images are faded between each other. To do that, only one of the images needs to have a percentage, the other one will be faded accordingly. For example, a value of 0% defined for the first image yields only the second image, while 100% yields only the first. A 25% value renders the first image at 25% and the second at 75%. The 75% value is the inverse, showing the first image at 75% and the second at 25%.
The above could also have been written as:
```
cross-fade(url(white.png) 0%, url(black.png)); /\* fully black \*/
cross-fade(url(white.png) 25%, url(black.png)); /\* 25% white, 75% black \*/
cross-fade(url(white.png), url(black.png)); /\* 50% white, 50% black \*/
cross-fade(url(white.png) 75%, url(black.png)); /\* 75% white, 25% black \*/
cross-fade(url(white.png) 100%, url(black.png)); /\* fully white \*/
cross-fade(url(green.png) 75%, url(red.png) 75%); /\* both green and red at 75% \*/
```
If no percentages are declared, both the images will be 50% opaque, with a cross-fade rendering as an even merge of both images. The 50%/50% example seen above did not need to have the percentages listed, as when a percentage value is omitted, the included percentages are added together and subtracted from 100%. The result, if greater than 0, is then divided equally between all images with omitted percentages.
In the last example, the sum of both percentages is not 100%, and therefore both images include their respective opacities.
If no percentages are declared and three images are included, each image will be 33.33% opaque. The two following are lines (almost) identical:
```
cross-fade(url(red.png), url(yellow.png), url(blue.png)); /\* all three will be 33.3333% opaque \*/
cross-fade(url(red.png) 33.33%, url(yellow.png) 33.33%, url(blue.png) 33.33%);
```
### Older, implemented syntax
```
cross-fade( <image>, <image>, <percentage> )
```
The specification for the `cross-fade()` function allows for multiple images and for each image to have transparency values independent of the other values. This was not always the case. The original syntax, which has been implemented in some browsers, only allowed for two images, with the sum of the transparency of those two images being exactly 100%. The original syntax is supported in Safari and supported with the `-webkit-` prefix in Chrome, Opera, and other blink-based browsers.
```
cross-fade(url(white.png), url(black.png), 0%); /\* fully black \*/
cross-fade(url(white.png), url(black.png), 25%); /\* 25% white, 75% black \*/
cross-fade(url(white.png), url(black.png), 50%); /\* 50% white, 50% black \*/
cross-fade(url(white.png), url(black.png), 75%); /\* 75% white, 25% black \*/
cross-fade(url(white.png), url(black.png), 100%); /\* fully white \*/
```
In the implemented syntax, the two comma-separated images are declared first, followed by a comma and required percent value. Omitting the comma or percent invalidates the value. The percent is the opacity of the first declared image. The included percentage is subtracted from 100%, with the difference being the opacity of the second image.
The green/red example (with the percentages totaling 150%) and the yellow/red/blue example (with three images) from the specification syntax section, are not possible in this implementation.
Accessibility concerns
----------------------
Browsers do not provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. When using background images, make sure the contrast in color is great enough that any text is legible over the image as well as if the images are missing.
* [MDN Understanding WCAG, Guideline 1.1 explanations](#)
* [Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/2016/NOTE-UNDERSTANDING-WCAG20-20161007/text-equiv-all.html)
Formal syntax
-------------
```
<cross-fade()> =
cross-fade( <cf-image>[#](value_definition_syntax#hash_mark) )
<cf-image> =
[<percentage [0,100]>](percentage)[?](value_definition_syntax#question_mark) [&&](value_definition_syntax#double_ampersand)
[[](value_definition_syntax#brackets) <image> [|](value_definition_syntax#single_bar) [<color>](color_value) []](value_definition_syntax#brackets)
<image> =
<url> [|](value_definition_syntax#single_bar)
[<gradient>](gradient)
<url> =
url( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) ) [|](value_definition_syntax#single_bar)
src( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) )
```
Examples
--------
### Older syntax for cross-fade
#### HTML
```
<div class="crossfade"></div>
```
#### CSS
```
.crossfade {
width: 300px;
height: 300px;
background-image: -webkit-cross-fade(url("br.png"), url("tr.png"), 75%);
background-image: cross-fade(url("br.png"), url("tr.png"), 75%);
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Image Values and Replaced Content Module Level 4 # cross-fade-function](https://w3c.github.io/csswg-drafts/css-images-4/#cross-fade-function) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `cross-fade` | 17
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | 79
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | No
See [bug 1657516](https://bugzil.la/1657516). | No | 15
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | 10
Supports the original dual-image with percentage implementation only.
5.1
Supports the original dual-image with percentage implementation only. | 4.4
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | 18
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | No
See [bug 1657516](https://bugzil.la/1657516). | 14
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] | 9.3
Support for the original dual-image with percentage implementation only.
5
Supports the original dual-image with percentage implementation only. | 1.0
["Supports the original dual-image with percentage implementation only.", "See [bug 614906](https://crbug.com/614906) for supporting the unprefixed `cross-fade()` function."] |
See also
--------
* [`<image>`](image)
* [`url()`](url)
* [`image()`](image/image)
* [`image-set()`](image/image-set)
* [`element()`](element())
* [Using CSS gradients](css_images/using_css_gradients)
* Gradient functions: [`linear-gradient()`](gradient/linear-gradient), [`radial-gradient()`](gradient/radial-gradient), [`repeating-linear-gradient()`](gradient/repeating-linear-gradient), [`repeating-radial-gradient()`](gradient/repeating-radial-gradient), [`conic-gradient()`](gradient/conic-gradient), [`repeating-conic-gradient()`](gradient/repeating-conic-gradient)
css scroll-margin-inline-start scroll-margin-inline-start
==========================
The `scroll-margin-inline-start` property defines the margin of the scroll snap area at the start of the inline dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets.
Try it
------
Syntax
------
```
/\* <length> values \*/
scroll-margin-inline-start: 10px;
scroll-margin-inline-start: 1em;
/\* Global values \*/
scroll-margin-inline-start: inherit;
scroll-margin-inline-start: initial;
scroll-margin-inline-start: revert;
scroll-margin-inline-start: revert-layer;
scroll-margin-inline-start: unset;
```
### Values
`<length>` An outset from the inline start edge of the scroll container.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-margin-inline-start =
[<length>](length)
```
Examples
--------
### Simple demonstration
This example implements something very similar to the interactive example above, except that here we'll explain to you how it's implemented.
The aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the left of each block.
#### HTML
The HTML that represents the blocks is very simple:
```
<div class="scroller">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
```
#### CSS
Let's walk through the CSS. The outer container is styled like this:
```
.scroller {
text-align: left;
width: 250px;
height: 250px;
overflow-x: scroll;
display: flex;
box-sizing: border-box;
border: 1px solid #000;
scroll-snap-type: x mandatory;
}
```
The main parts relevant to the scroll snapping are `overflow-x: scroll`, which makes sure the contents will scroll and not be hidden, and `scroll-snap-type: x mandatory`, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point.
The child elements are styled as follows:
```
.scroller > div {
flex: 0 0 250px;
width: 250px;
background-color: #663399;
color: #fff;
font-size: 30px;
display: flex;
align-items: center;
justify-content: center;
scroll-snap-align: start;
}
.scroller > div:nth-child(2n) {
background-color: #fff;
color: #663399;
}
```
The most relevant part here is `scroll-snap-align: start`, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap points.
Last of all we specify the scroll margin-values, a different one for the second and third child elements:
```
.scroller > div:nth-child(2) {
scroll-margin-inline-start: 1rem;
}
.scroller > div:nth-child(3) {
scroll-margin-inline-start: 2rem;
}
```
This means that when scrolling past the middle child elements, the scrolling will snap to `1rem` outside the inline start edge of the second `<div>`, and `2rems` outside the inline start edge of the third `<div>`.
#### Result
Try it for yourself:
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # margin-longhands-logical](https://w3c.github.io/csswg-drafts/css-scroll-snap/#margin-longhands-logical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-margin-inline-start` | 69 | 79 | 68 | No | 56 | 14.1 | 69 | 69 | 68 | 48 | 14.5 | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
| programming_docs |
css border-right-style border-right-style
==================
The `border-right-style` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the line style of an element's right [`border`](border).
Try it
------
**Note:** The specification doesn't define how borders of different styles connect in the corners.
Syntax
------
```
/\* Keyword values \*/
border-right-style: none;
border-right-style: hidden;
border-right-style: dotted;
border-right-style: dashed;
border-right-style: solid;
border-right-style: double;
border-right-style: groove;
border-right-style: ridge;
border-right-style: inset;
border-right-style: outset;
/\* Global values \*/
border-right-style: inherit;
border-right-style: initial;
border-right-style: revert;
border-right-style: revert-layer;
border-right-style: unset;
```
The `border-right-style` property is specified as a single keyword chosen from those available for the [`border-style`](border-style) property.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
border-right-style =
<line-style>
<line-style> =
none [|](value_definition_syntax#single_bar)
hidden [|](value_definition_syntax#single_bar)
dotted [|](value_definition_syntax#single_bar)
dashed [|](value_definition_syntax#single_bar)
solid [|](value_definition_syntax#single_bar)
double [|](value_definition_syntax#single_bar)
groove [|](value_definition_syntax#single_bar)
ridge [|](value_definition_syntax#single_bar)
inset [|](value_definition_syntax#single_bar)
outset
```
Examples
--------
### Border styles
#### HTML
```
<table>
<tr>
<td class="b1">none</td>
<td class="b2">hidden</td>
<td class="b3">dotted</td>
<td class="b4">dashed</td>
</tr>
<tr>
<td class="b5">solid</td>
<td class="b6">double</td>
<td class="b7">groove</td>
<td class="b8">ridge</td>
</tr>
<tr>
<td class="b9">inset</td>
<td class="b10">outset</td>
</tr>
</table>
```
#### CSS
```
/\* Define look of the table \*/
table {
border-width: 2px;
background-color: #52e385;
}
tr,
td {
padding: 3px;
}
/\* border-right-style example classes \*/
.b1 {border-right-style: none;}
.b2 {border-right-style: hidden;}
.b3 {border-right-style: dotted;}
.b4 {border-right-style: dashed;}
.b5 {border-right-style: solid;}
.b6 {border-right-style: double;}
.b7 {border-right-style: groove;}
.b8 {border-right-style: ridge;}
.b9 {border-right-style: inset;}
.b10 {border-right-style: outset;}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # the-border-style](https://w3c.github.io/csswg-drafts/css-backgrounds/#the-border-style) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-right-style` | 1 | 12 | 1
Before Firefox 50, border styles of rounded corners (with [`border-radius`](https://developer.mozilla.org/docs/Web/CSS/border-radius)) were always rendered as if `border-bottom-style` was `solid`. This has been fixed in Firefox 50. | 5.5 | 9.2 | 1 | ≤37 | 18 | 14
Before Firefox 50, border styles of rounded corners (with [`border-radius`](https://developer.mozilla.org/docs/Web/CSS/border-radius)) were always rendered as if `border-bottom-style` was `solid`. This has been fixed in Firefox 50. | 14 | 1 | 1.0 |
See also
--------
* The other style-related border properties: [`border-bottom-style`](border-bottom-style), [`border-left-style`](border-left-style), [`border-top-style`](border-top-style), and [`border-style`](border-style).
* The other right-border-related properties: [`border-right`](border-right), [`border-right-color`](border-right-color), and [`border-right-width`](border-right-width).
css Actual value Actual value
============
The **actual value** of a [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property is the [used value](used_value) of that property after any necessary approximations have been applied. For example, a [user agent](https://developer.mozilla.org/en-US/docs/Glossary/User_agent) that can only render borders with a whole-number pixel width may round the thickness of the border to the nearest integer.
Calculating a property's actual value
-------------------------------------
The [user agent](https://developer.mozilla.org/en-US/docs/Glossary/User_agent) performs four steps to calculate a property's actual (final) value:
1. First, the [specified value](specified_value) is determined based on the result of [cascading](cascade), <inheritance>, or using the [initial value](initial_value).
2. Next, the [computed value](computed_value) is calculated according to the specification (for example, a `span` with `position: absolute` will have its computed `display` changed to `block`).
3. Then, layout is calculated, resulting in the [used value](used_value).
4. Finally, the used value is transformed according to the limitations of the local environment, resulting in the actual value.
Specifications
--------------
| Specification |
| --- |
| [Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification # actual-value](https://www.w3.org/TR/CSS22/cascade.html#actual-value) |
See also
--------
* CSS key concepts:
+ [CSS syntax](syntax)
+ [At-rules](at-rule)
+ [Comments](comments)
+ [Specificity](specificity)
+ [Inheritance](inheritance)
+ [Box model](css_box_model/introduction_to_the_css_box_model)
+ [Layout modes](layout_mode)
+ [Visual formatting models](visual_formatting_model)
+ [Margin collapsing](css_box_model/mastering_margin_collapsing)
+ Values
- [Initial values](initial_value)
- [Computed values](computed_value)
- [Used values](used_value)
+ [Value definition syntax](value_definition_syntax)
+ [Shorthand properties](shorthand_properties)
+ [Replaced elements](replaced_element)
css font-variation-settings font-variation-settings
=======================
The `font-variation-settings` CSS property provides low-level control over [variable font](css_fonts/variable_fonts_guide) characteristics, by specifying the four letter axis names of the characteristics you want to vary, along with their values.
Try it
------
Syntax
------
```
/\* Use the default settings \*/
font-variation-settings: normal;
/\* Set values for variable font axis names \*/
font-variation-settings: "XHGT" 0.7;
/\* Global values \*/
font-variation-settings: inherit;
font-variation-settings: initial;
font-variation-settings: revert;
font-variation-settings: revert-layer;
font-variation-settings: unset;
```
### Values
This property's value can take one of two forms:
`normal` Text is laid out using default settings.
`<string> <number>` When rendering text, the list of variable font axis names is passed to the text layout engine to enable or disable font features. Each setting is always one or more pairs consisting of a [`<string>`](string) of 4 ASCII characters followed by a [`<number>`](number) indicating the axis value to set. If the `<string>` has more or fewer characters or contains characters outside the U+20 - U+7E codepoint range, the whole property is invalid. The `<number>` can be fractional or negative, depending on the value range available in your font, as defined by the font designer.
Description
-----------
This property is a low-level mechanism designed to set variable font features where no other way to enable or access those features exist. You should only use it when no basic properties exist to set those features (e.g. [`font-weight`](font-weight), [`font-style`](font-style)).
Font characteristics set using `font-variation-settings` will always override those set using the corresponding basic font properties, e.g. `font-weight`, no matter where they appear in the cascade. In some browsers, this is currently only true when the `@font-face` declaration includes a `font-weight` range.
### Registered and custom axes
Variable font axes come in two types: **registered** and **custom**.
Registered axes are the most commonly encountered — common enough that the authors of the specification felt they were worth standardizing. Note that this doesn't mean that the author has to include all of these in their font.
Here are the registered axes along with their corresponding CSS properties:
| Axis Tag | CSS Property |
| --- | --- |
| "wght" | [`font-weight`](font-weight) |
| "wdth" | [`font-stretch`](font-stretch) |
| "slnt" (slant) | [`font-style`](font-style): `oblique + angle` |
| "ital" | [`font-style`](font-style): `italic` |
| "opsz" | [`font-optical-sizing`](font-optical-sizing) |
Custom axes can be anything the font designer wants to vary in their font, for example ascender or descender heights, the size of serifs, or anything else they can imagine. Any axis can be used as long as it is given a unique 4-character axis. Some will end up becoming more common, and may even become registered over time.
**Note:** Registered axis tags are identified using lower-case tags, whereas custom axes should be given upper-case tags. Note that font designers aren't forced to follow this practice in any way, and some won't. The important takeaway here is that axis tags are case-sensitive.
To use variable fonts on your operating system, you need to make sure that it is up to date. For example Linux OSes need the latest Linux Freetype version, and macOS before 10.13 does not support variable fonts. If your operating system is not up to date, you will not be able to use variable fonts in web pages or the Firefox Developer Tools.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | a transform |
Formal syntax
-------------
```
font-variation-settings =
normal [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [<string>](string) [<number>](number) []](value_definition_syntax#brackets)[#](value_definition_syntax#hash_mark)
```
Examples
--------
You can find a number of other variable fonts examples at our [Variable fonts guide](css_fonts/variable_fonts_guide), [v-fonts.com](https://v-fonts.com/), and [axis-praxis.org](https://www.axis-praxis.org/).
### Weight (wght)
The following live example's CSS can be edited to allow you to play with font weight values.
### Slant (slnt)
The following live example's CSS can be edited to allow you to play with font slant/oblique values.
Specifications
--------------
| Specification |
| --- |
| [CSS Fonts Module Level 4 # font-variation-settings-def](https://w3c.github.io/csswg-drafts/css-fonts/#font-variation-settings-def) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `font-variation-settings` | 62 | 17 | 62 | No | 49 | 11
Requires macOS 10.13 High Sierra or later. | 62 | 62 | 62 | 46 | 11
Requires iOS 11 or later. | 8.0 |
See also
--------
* [Variable fonts guide](css_fonts/variable_fonts_guide)
* [OpenType Font Variations Overview](https://docs.microsoft.com/typography/opentype/spec/otvaroverview)
* [OpenType Design-Variation Axis Tag Registry](https://docs.microsoft.com/typography/opentype/spec/dvaraxisreg)
css column-count column-count
============
The `column-count` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property breaks an element's content into the specified number of columns.
Try it
------
Syntax
------
```
/\* Keyword value \*/
column-count: auto;
/\* <integer> value \*/
column-count: 3;
/\* Global values \*/
column-count: inherit;
column-count: initial;
column-count: revert;
column-count: revert-layer;
column-count: unset;
```
### Values
`auto` The number of columns is determined by other CSS properties, such as [`column-width`](column-width).
[`<integer>`](integer) Is a strictly positive [`<integer>`](integer) describing the ideal number of columns into which the content of the element will be flowed. If the [`column-width`](column-width) is also set to a non-`auto` value, it merely indicates the maximum allowed number of columns.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | Block containers except table wrapper boxes |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | an [integer](integer#interpolation) |
Formal syntax
-------------
```
column-count =
auto [|](value_definition_syntax#single_bar)
[<integer [1,∞]>](integer)
```
Examples
--------
### Splitting a paragraph across three columns
#### HTML
```
<p class="content-box">
This is a bunch of text split into three columns using the CSS `column-count`
property. The text is equally distributed over the columns.
</p>
```
#### CSS
```
.content-box {
column-count: 3;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Multi-column Layout Module Level 1 # cc](https://w3c.github.io/csswg-drafts/css-multicol/#cc) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `column-count` | 50
1 | 12
12 | 52
1.5-74
Before version 37, multiple columns didn't work with `display: table-caption` elements. | 10 | 15
11.1 | 9
3 | 50
≤37 | 50
18 | 52
4
Before version 37, multiple columns didn't work with `display: table-caption` elements. | 14
11.1 | 9
1 | 5.0
1.0 |
See also
--------
* [Multiple-column Layout](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Multiple-column_Layout) (Learn Layout)
* [Basic Concepts of Multicol](css_columns/basic_concepts_of_multicol)
css contain-intrinsic-height contain-intrinsic-height
========================
The `contain-intrinsic-length` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the height of an element that a browser can use for layout when the element is subject to [size containment](css_containment#size_containment).
Syntax
------
```
/\* Keyword values \*/
contain-intrinsic-height: none;
/\* <length> values \*/
contain-intrinsic-height: 1000px;
contain-intrinsic-height: 10rem;
/\* auto <length> \*/
contain-intrinsic-height: auto 300px;
/\* Global values \*/
contain-intrinsic-height: inherit;
contain-intrinsic-height: initial;
contain-intrinsic-height: revert;
contain-intrinsic-height: revert-layer;
contain-intrinsic-height: unset;
```
### Values
The following values may be specified for an element.
`none` The element has no intrinsic height.
`<length>` The element has the specified height ([`<length>`](length)).
`auto <length>` A remembered value of the "normally rendered" element height if one exists and the element is skipping its contents (for example, when it is offscreen); otherwise the specified `<length>`.
Description
-----------
The property is commonly applied alongside elements that can trigger size containment, such as [`contain: size`](contain) and [`content-visibility`](content-visibility), and may also be set using the [`contain-intrinsic-size`](contain-intrinsic-size) [shorthand property](shorthand_properties).
Size containment allows a user agent to layout an element as though it had a fixed size, preventing unnecessary reflows by avoiding the re-rendering of child elements to determine the actual size (thereby improving user experience). By default, size containment treats elements as though they had no contents, and may collapse the layout in the same way as if the contents had no height (or width). The `contain-intrinsic-height` property allows authors to specify an appropriate value to be used as the height for layout.
The `auto <length>` value allows the height of the element to be stored if the element is ever "normally rendered" (with its child elements), and then used instead of the specified height when the element is skipping its contents. This allows offscreen elements with [`content-visibility: auto`](content-visibility) to benefit from size containment without developers having to be as precise in their estimates of element size. The remembered value is not used if the child elements are being rendered (if size containment is enabled, the `<length>` will be used).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | elements for which size containment can apply |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified, with <length>s values computed |
| Animation type | by computed value type |
Formal syntax
-------------
```
contain-intrinsic-height =
none [|](value_definition_syntax#single_bar)
[<length>](length) [|](value_definition_syntax#single_bar)
auto [<length>](length)
```
Examples
--------
In addition to the example below, the [`contain-intrinsic-size`](contain-intrinsic-size) page contains a live example that demonstrates the effect of modifying the intrinsic width and height.
### Setting the intrinsic height
The HTML below defines an element "contained\_element" that will be subject to size constraint, and which contains a child element.
```
<div id="contained\_element">
<div class="child\_element"></div>
</div>
```
The CSS below sets the [`content-visibility`](content-visibility) of `contained_element` to `auto`, so if the element is hidden it will be size constrained. The width and height that are used when it is size constrained are set at the same time using `contain-intrinsic-width` and `contain-intrinsic-height`, respectively.
```
#contained\_element {
border: 2px solid green;
width: 151px;
content-visibility: auto;
contain-intrinsic-width: 152px;
contain-intrinsic-height: 52px;
}
.child\_element {
border: 1px solid red;
background: blue;
height: 50px;
width: 150px;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Box Sizing Module Level 4 # propdef-contain-intrinsic-height](https://w3c.github.io/csswg-drafts/css-sizing-4/#propdef-contain-intrinsic-height) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `contain-intrinsic-height` | 83 | 83 | 107 | No | 69 | No | 83 | 83 | 107 | 59 | No | 13.0 |
See also
--------
* [content-visibility: the new CSS property that boosts your rendering performance](https://web.dev/content-visibility/) (web.dev)
* [`contain-intrinsic-size`](contain-intrinsic-size)
* [`contain-intrinsic-width`](contain-intrinsic-width)
* [`contain-intrinsic-block-size`](contain-intrinsic-block-size)
* [`contain-intrinsic-inline-size`](contain-intrinsic-inline-size)
css border-inline border-inline
=============
The `border-inline` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property is a [shorthand property](shorthand_properties) for setting the individual logical inline border property values in a single place in the style sheet.
Try it
------
The physical borders to which `border-inline` maps depends on the element's writing mode, directionality, and text orientation. It corresponds to the [`border-top`](border-top) and [`border-bottom`](border-bottom) or [`border-right`](border-right), and [`border-left`](border-left) properties, depending on the values defined for [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation).
The borders in the other dimension can be set with [`border-block`](border-block), which sets [`border-block-start`](border-block-start), and [`border-block-end`](border-block-end).
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`border-inline-color`](border-inline-color)
* [`border-inline-style`](border-inline-style)
* [`border-inline-width`](border-inline-width)
Syntax
------
```
border-inline: 1px;
border-inline: 2px dotted;
border-inline: medium dashed blue;
/\* Global values \*/
border-inline: inherit;
border-inline: initial;
border-inline: revert;
border-inline: revert-layer;
border-inline: unset;
```
### Values
The `border-inline` is specified with one or more of the following, in any order:
`<'border-width'>` The width of the border. See [`border-width`](border-width).
`<'border-style'>` The line style of the border. See [`border-style`](border-style).
`<'color'>` The color of the border. See [`color`](color).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`border-top-width`](border-top-width): `medium`
* [`border-top-style`](border-top-style): `none`
* [`border-top-color`](border-top-color): `currentcolor`
|
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`border-top-width`](border-top-width): the absolute length or `0` if [`border-top-style`](border-top-style) is `none` or `hidden`
* [`border-top-style`](border-top-style): as specified
* [`border-top-color`](border-top-color): computed color
|
| Animation type | discrete |
Formal syntax
-------------
```
border-inline =
<'border-block-start'>
```
Examples
--------
### Border with vertical text
#### HTML
```
<div>
<p class="exampleText">Example text</p>
</div>
```
#### CSS
```
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-rl;
border-inline: 5px dashed blue;
}
```
#### Results
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # propdef-border-inline](https://w3c.github.io/csswg-drafts/css-logical/#propdef-border-inline) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-inline` | 87 | 87 | 66 | No | 73 | 14.1 | 87 | 87 | 66 | 62 | 14.5 | 14.0 |
See also
--------
* [CSS Logical Properties and Values](css_logical_properties)
* This property maps to one of the physical border properties: [`border-top`](border-top), [`border-right`](border-right), [`border-bottom`](border-bottom), or [`border-left`](border-left).
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)
| programming_docs |
css <angle> <angle>
=======
The `<angle>` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [data type](css_types) represents an angle value expressed in degrees, gradians, radians, or turns. It is used, for example, in [`<gradient>`](gradient)s and in some [`transform`](transform) functions.
Try it
------
Syntax
------
The `<angle>` data type consists of a [`<number>`](number) followed by one of the units listed below. As with all dimensions, there is no space between the unit literal and the number. The angle unit is optional after the number `0`.
Optionally, it may be preceded by a single `+` or `-` sign. Positive numbers represent clockwise angles, while negative numbers represent counterclockwise angles. For static properties of a given unit, any angle can be represented by various equivalent values. For example, `90deg` equals `-270deg`, and `1turn` equals `4turn`. For dynamic properties, like when applying an [`animation`](animation) or [`transition`](transition), the effect will nevertheless be different.
### Units
`deg` Represents an angle in [degrees](https://en.wikipedia.org/wiki/Degree_%28angle%29). One full circle is `360deg`. Examples: `0deg`, `90deg`, `14.23deg`.
`grad` Represents an angle in [gradians](https://en.wikipedia.org/wiki/Gradian). One full circle is `400grad`. Examples: `0grad`, `100grad`, `38.8grad`.
`rad` Represents an angle in [radians](https://en.wikipedia.org/wiki/Radian). One full circle is 2π radians which approximates to `6.2832rad`. `1rad` is 180/π degrees. Examples: `0rad`, `1.0708rad`, `6.2832rad`.
`turn` Represents an angle in a number of turns. One full circle is `1turn`. Examples: `0turn`, `0.25turn`, `1.2turn`.
Examples
--------
### Setting a clockwise right angle
| | |
| --- | --- |
| | `90deg = 100grad = 0.25turn ≈ 1.5708rad` |
### Setting a flat angle
| | |
| --- | --- |
| | `180deg = 200grad = 0.5turn ≈ 3.1416rad` |
### Setting a counterclockwise right angle
| | |
| --- | --- |
| | `-90deg = -100grad = -0.25turn ≈ -1.5708rad` |
### Setting a null angle
| | |
| --- | --- |
| | `0 = 0deg = 0grad = 0turn = 0rad` |
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 4 # angles](https://w3c.github.io/csswg-drafts/css-values/#angles) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `angle` | 2 | 12 | 3.6 | 9 | 15 | 4 | 2 | 18 | 4 | 14 | 3.2 | 1.0 |
| `deg` | 2 | 12 | 3.6 | 9 | 15 | 4 | 2 | 18 | 4 | 14 | 3.2 | 1.0 |
| `grad` | 2 | 12 | 3.6 | 9 | 15 | 4 | 2 | 18 | 4 | 14 | 3.2 | 1.0 |
| `rad` | 2 | 12 | 3.6 | 9 | 15 | 4 | 2 | 18 | 4 | 14 | 3.2 | 1.0 |
| `turn` | 2 | 12 | 13 | 9 | 15 | 4 | 2 | 18 | 14 | 14 | 3.2 | 1.0 |
See also
--------
* [CSS data types](css_types)
* The [`<gradient>`](gradient) type
* CSS rotation transforms: [`rotate()`](transform-function/rotate), [`rotate3d()`](transform-function/rotate3d), [`rotateX()`](transform-function/rotatex), [`rotateY()`](transform-function/rotatey), and [`rotateZ()`](transform-function/rotatez)
* [CSS transforms](css_transforms)
* [Using CSS transforms](css_transforms/using_css_transforms)
* [Using CSS gradients](css_images/using_css_gradients)
css @namespace @namespace
==========
`@namespace` is an <at-rule> that defines [XML namespaces](https://developer.mozilla.org/en-US/docs/Namespaces) to be used in a [CSS](https://developer.mozilla.org/en-US/docs/Glossary/CSS) [style sheet](https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet).
Try it
------
Syntax
------
```
/\* Default namespace \*/
@namespace url(XML-namespace-URL);
@namespace "XML-namespace-URL";
/\* Prefixed namespace \*/
@namespace prefix url(XML-namespace-URL);
@namespace prefix "XML-namespace-URL";
```
Description
-----------
The defined namespaces can be used to restrict the [universal](universal_selectors), [type](type_selectors), and [attribute](attribute_selectors) [selectors](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors) to only select elements within that namespace. The `@namespace` rule is generally only useful when dealing with documents containing multiple namespaces—such as HTML with inline SVG or MathML, or XML that mixes multiple vocabularies.
Any `@namespace` rules must follow all [`@charset`](@charset) and [`@import`](@import) rules, and precede all other at-rules and [style declarations](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration) in a style sheet.
`@namespace` can be used to define the **default namespace** for the style sheet. When a default namespace is defined, all universal and type selectors (but not attribute selectors, see note below) apply only to elements in that namespace.
The `@namespace` rule can also be used to define a **namespace prefix**. When a universal, type, or attribute selector is prefixed with a namespace prefix, then that selector only matches if the namespace *and* name of the element or attribute matches.
In [HTML5](https://developer.mozilla.org/en-US/docs/Glossary/HTML5), known [foreign elements](https://html.spec.whatwg.org/#foreign-elements) will automatically be assigned namespaces. This means that HTML elements will act as though they are in the XHTML namespace (`http://www.w3.org/1999/xhtml`), even if there is no `xmlns` attribute anywhere in the document, and the [<svg>](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg) and [<math>](https://developer.mozilla.org/en-US/docs/Web/MathML/Element/math) elements will be assigned their proper namespaces (`http://www.w3.org/2000/svg` and `http://www.w3.org/1998/Math/MathML`).
**Note:** In XML, unless a prefix is defined directly on an attribute (*e.g.*, `xlink:href`), that attribute has no namespace. In other words, attributes do not inherit the namespace of the element they're on. To match this behavior, the default namespace in CSS does not apply to attribute selectors.
Formal syntax
-------------
```
@namespace =
@namespace <namespace-prefix>[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) [<string>](string) [|](value_definition_syntax#single_bar) <url> []](value_definition_syntax#brackets) ;
<namespace-prefix> =
[<ident>](ident)
<url> =
url( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) ) [|](value_definition_syntax#single_bar)
src( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) )
```
Examples
--------
### Specifying default and prefixed namespaces
```
@namespace url(http://www.w3.org/1999/xhtml);
@namespace svg url(http://www.w3.org/2000/svg);
/\* This matches all XHTML <a> elements, as XHTML is the default unprefixed namespace \*/
a {
}
/\* This matches all SVG <a> elements \*/
svg|a {
}
/\* This matches both XHTML and SVG <a> elements \*/
\*|a {
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Namespaces Module Level 3 # declaration](https://w3c.github.io/csswg-drafts/css-namespaces/#declaration) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `@namespace` | 1 | 12 | 1 | 9 | 8 | 1 | 37 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [Namespaces crash course](https://developer.mozilla.org/en-US/docs/Web/SVG/Namespaces_Crash_Course)
css CSS Writing Modes CSS Writing Modes
=================
**CSS Writing Modes** is a CSS module that defines various international writing modes, such as left-to-right (e.g. used by Latin and Indic scripts), right-to-left (e.g. used by Hebrew or Arabic scripts), bidirectional (used when mixing left-to-right and right-to-left scripts) and vertical (e.g. used by some Asian scripts).
Reference
---------
### Properties
* [`direction`](direction)
* `glyph-orientation-horizontal`
* [`text-combine-upright`](text-combine-upright)
* [`text-orientation`](text-orientation)
* [`unicode-bidi`](unicode-bidi)
* [`writing-mode`](writing-mode)
Specifications
--------------
| Specification |
| --- |
| [CSS Writing Modes Level 4](https://drafts.csswg.org/css-writing-modes/) |
css -moz-outline-radius-bottomright -moz-outline-radius-bottomright
===============================
**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the [compatibility table](#browser_compatibility) at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
In Mozilla applications, the `-moz-outline-radius-bottomright` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property can be used to round the bottom-right corner of an element's [`outline`](outline).
Syntax
------
The value of `-moz-outline-radius-bottomright` is either a CSS [`<length>`](length) or a <percentage> of the corresponding dimensions of the border box. The [`calc()`](calc) function may be used as well.
### Values
`<length>` The radius of the circle defining the curvature of the bottom and right edges of the element, specified as a CSS [`<length>`](length).
`<percentage>` The radius of the circle defining the rounding of the bottom-right corner of the element, specified as the [percentages](percentage) of the bottom and right sides of the border box.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| Percentages | refer to the corresponding dimension of the border box |
| [Computed value](computed_value) | as specified |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
-moz-outline-radius-bottomright =
<outline-radius>
```
Examples
--------
### HTML
```
<p>Look at this paragraph's bottom-right corner.</p>
```
### CSS
```
p {
margin: 5px;
border: solid cyan;
outline: dotted red;
-moz-outline-radius-bottomright: 2em;
}
```
### Result
**Note:** The example above will not display the desired effect if you are viewing this in a browser other than Firefox.
Specifications
--------------
Not part of any standard.
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `-moz-outline-radius-bottomright` | No | No | 1-88
From Firefox 88, [outline](https://developer.mozilla.org/docs/Web/CSS/outline) now follows the shape created by [border-radius](https://developer.mozilla.org/docs/Web/CSS/border-radius) automatically, so this property is no longer needed (see [bug 1694146](https://bugzil.la/1694146)). | No | No | No | No | No | 4-88
From Firefox 88, [outline](https://developer.mozilla.org/docs/Web/CSS/outline) now follows the shape created by [border-radius](https://developer.mozilla.org/docs/Web/CSS/border-radius) automatically, so this property is no longer needed (see [bug 1694146](https://bugzil.la/1694146)). | No | No | No |
See also
--------
* See the [`-moz-outline-radius`](-moz-outline-radius) property for more information.
css contain-intrinsic-width contain-intrinsic-width
=======================
The `contain-intrinsic-width` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the width of an element that a browser will use for layout when the element is subject to [size containment](css_containment#size_containment).
Syntax
------
```
/\* Keyword values \*/
contain-intrinsic-width: none;
/\* <length> values \*/
contain-intrinsic-width: 1000px;
contain-intrinsic-width: 10rem;
/\* auto <length> \*/
contain-intrinsic-width: auto 300px;
/\* Global values \*/
contain-intrinsic-width: inherit;
contain-intrinsic-width: initial;
contain-intrinsic-width: revert;
contain-intrinsic-width: revert-layer;
contain-intrinsic-width: unset;
```
### Values
The following values may be specified for an element.
`none` The element has no intrinsic width.
`<length>` The element has the specified width ([`<length>`](length)).
`auto <length>` A remembered value of the "normally rendered" element width if one exists and the element is skipping its contents (for example, when it is offscreen); otherwise the specified `<length>`.
Description
-----------
The property is commonly applied alongside elements that can trigger size containment, such as [`contain: size`](contain) and [`content-visibility`](content-visibility), and may also be set using the [`contain-intrinsic-size`](contain-intrinsic-size) [shorthand property](shorthand_properties).
Size containment allows a user agent to layout an element as though it had a fixed size, preventing unnecessary reflows by avoiding the re-rendering of child elements to determine the actual size (thereby improving user experience). By default, size containment treats elements as though they had no contents, and may collapse the layout in the same way as if the contents had no width or height. The `contain-intrinsic-width` property allows authors to specify an appropriate value to be used as the width for layout.
The `auto <length>` value allows the width of the element to be stored if the element is ever "normally rendered" (with its child elements), and then used instead of the specified width when the element is skipping its contents. This allows offscreen elements with [`content-visibility: auto`](content-visibility) to benefit from size containment without developers having to be as precise in their estimates of element size. The remembered value is not used if the child elements are being rendered (if size containment is enabled, the `<length>` will be used).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | elements for which size containment can apply |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified, with <length>s values computed |
| Animation type | by computed value type |
Formal syntax
-------------
```
contain-intrinsic-width =
none [|](value_definition_syntax#single_bar)
[<length>](length) [|](value_definition_syntax#single_bar)
auto [<length>](length)
```
Examples
--------
In addition to the example below, the [`contain-intrinsic-size`](contain-intrinsic-size) page contains a live example that demonstrates the effect of modifying the intrinsic width and height.
### Setting the intrinsic width
The HTML below defines an element "contained\_element" that will be subject to size constraint, and which contains a child element.
```
<div id="contained\_element">
<div class="child\_element"></div>
</div>
```
The CSS below sets the [`content-visibility`](content-visibility) of `contained_element` to `auto`, so if the element is hidden it will be size constrained. The width and height that are used when it is size constrained are set at the same time using `contain-intrinsic-width` and `contain-intrinsic-height`, respectively.
```
#contained\_element {
border: 2px solid green;
width: 151px;
content-visibility: auto;
contain-intrinsic-width: 152px;
contain-intrinsic-height: 52px;
}
.child\_element {
border: 1px solid red;
background: blue;
height: 50px;
width: 150px;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Box Sizing Module Level 4 # propdef-contain-intrinsic-width](https://w3c.github.io/csswg-drafts/css-sizing-4/#propdef-contain-intrinsic-width) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `contain-intrinsic-width` | 83 | 83 | 107 | No | 69 | No | 83 | 83 | 107 | 59 | No | 13.0 |
See also
--------
* [content-visibility: the new CSS property that boosts your rendering performance](https://web.dev/content-visibility/) (web.dev)
* [`contain-intrinsic-size`](contain-intrinsic-size)
* [`contain-intrinsic-height`](contain-intrinsic-height)
* [`contain-intrinsic-block-size`](contain-intrinsic-block-size)
* [`contain-intrinsic-inline-size`](contain-intrinsic-inline-size)
css CSS Transitions CSS Transitions
===============
**CSS Transitions** is a module of CSS that lets you create gradual transitions between the values of specific CSS properties. The behavior of these transitions can be controlled by specifying their timing function, duration, and other attributes.
Reference
---------
### Properties
* [`transition`](transition)
* [`transition-delay`](transition-delay)
* [`transition-duration`](transition-duration)
* [`transition-property`](transition-property)
* [`transition-timing-function`](transition-timing-function)
Guides
------
[Using CSS transitions](css_transitions/using_css_transitions) Step-by-step tutorial about how to create transitions using CSS. This article describes each relevant CSS property and explains how they interact with each other.
Specifications
--------------
| Specification |
| --- |
| [CSS Transitions](https://drafts.csswg.org/css-transitions/) |
See also
--------
* Related to CSS Transitions, [CSS Animations](css_animations) provide finer control over animated properties.
css minmax() minmax()
========
The `minmax()` [CSS function](css_functions) defines a size range greater than or equal to *min* and less than or equal to *max*. It is used with [CSS Grids](css_grid_layout).
Try it
------
Syntax
------
```
/\* <inflexible-breadth>, <track-breadth> values \*/
minmax(200px, 1fr)
minmax(400px, 50%)
minmax(30%, 300px)
minmax(100px, max-content)
minmax(min-content, 400px)
minmax(max-content, auto)
minmax(auto, 300px)
minmax(min-content, auto)
/\* <fixed-breadth>, <track-breadth> values \*/
minmax(200px, 1fr)
minmax(30%, 300px)
minmax(400px, 50%)
minmax(50%, min-content)
minmax(300px, max-content)
minmax(200px, auto)
/\* <inflexible-breadth>, <fixed-breadth> values \*/
minmax(400px, 50%)
minmax(30%, 300px)
minmax(min-content, 200px)
minmax(max-content, 200px)
minmax(auto, 300px)
```
A function taking two parameters, *min* and *max*.
Each parameter can be a `<length>`, a `<percentage>`, a `<flex>` value, or one of the keyword values `max-content`, `min-content`, or `auto`.
If *max* < *min*, then *max* is ignored and `minmax(min,max)` is treated as *min*. As a maximum, a [`<flex>`](flex_value) value sets the flex factor of a grid track; it is invalid as a minimum.
### Values
[`<length>`](length) A non-negative length.
[`<percentage>`](percentage) A non-negative percentage relative to the inline size of the grid container in column grid tracks, and the block size of the grid container in row grid tracks. If the size of the grid container depends on the size of its tracks, then the `<percentage>` must be treated as `auto`. The [user agent](https://developer.mozilla.org/en-US/docs/Glossary/User_agent) may adjust the intrinsic size contributions of the track to the size of the grid container and increase the final size of the track by the minimum amount that would result in honoring the percentage.
[`<flex>`](flex_value) A non-negative dimension with the unit `fr` specifying the track's flex factor. Each `<flex>`-sized track takes a share of the remaining space in proportion to its flex factor.
`max-content` Represents the largest max-content contribution of the grid items occupying the grid track.
`min-content` Represents the largest min-content contribution of the grid items occupying the grid track.
`auto` As a maximum, identical to `max-content`. As a minimum it represents the largest minimum size (as specified by [`min-width`](min-width)/[`min-height`](min-height)) of the grid items occupying the grid track.
### Formal syntax
Error: could not find syntax for this item### CSS properties
`minmax()` function can be used within:
* [`grid-template-columns`](grid-template-columns)
* [`grid-template-rows`](grid-template-rows)
* [`grid-auto-columns`](grid-auto-columns)
* [`grid-auto-rows`](grid-auto-rows)
Examples
--------
### CSS
```
#container {
display: grid;
grid-template-columns: minmax(min-content, 300px) minmax(200px, 1fr) 150px;
grid-gap: 5px;
box-sizing: border-box;
height: 200px;
width: 100%;
background-color: #8cffa0;
padding: 10px;
}
#container > div {
background-color: #8ca0ff;
padding: 5px;
}
```
### HTML
```
<div id="container">
<div>Item as wide as the content, but at most 300 pixels.</div>
<div>Item with flexible width but a minimum of 200 pixels.</div>
<div>Inflexible item of 150 pixels width.</div>
</div>
```
### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Grid Layout Module Level 2 # valdef-grid-template-columns-minmax](https://w3c.github.io/csswg-drafts/css-grid/#valdef-grid-template-columns-minmax) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `minmax` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
See also
--------
* Grid Layout Guide: *[Basic concepts of grid layout - track sizing with minmax()](css_grid_layout/basic_concepts_of_grid_layout#track_sizing_and_minmax)*
* [CSS grids, logical values and writing modes](css_grid_layout/css_grid_logical_values_and_writing_modes)
* Video tutorial: *[Introducing minmax()](https://gridbyexample.com/video/series-minmax/)*
| programming_docs |
css word-spacing word-spacing
============
The `word-spacing` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the length of space between words and between tags.
Try it
------
Syntax
------
```
/\* Keyword value \*/
word-spacing: normal;
/\* <length> values \*/
word-spacing: 3px;
word-spacing: 0.3em;
/\* Global values \*/
word-spacing: inherit;
word-spacing: initial;
word-spacing: revert;
word-spacing: revert-layer;
word-spacing: unset;
```
### Values
`normal` The normal inter-word spacing, as defined by the current font and/or the browser.
[`<length>`](length) Specifies extra spacing in addition to the intrinsic inter-word spacing defined by the font.
Examples
--------
### HTML
```
<div id="mozdiv1">Lorem ipsum dolor sit amet.</div>
<div id="mozdiv2">Lorem ipsum dolor sit amet.</div>
```
### CSS
```
#mozdiv1 {
word-spacing: 15px;
}
#mozdiv2 {
word-spacing: 5em;
}
```
Accessibility concerns
----------------------
A large positive or negative `word-spacing` value will make the sentences the styling is applied to unreadable. For text styled with a very large positive value, the words will be so far apart that it will no longer appear to be a sentence. For text styled with a large negative value, the words will overlap each other to the point where the beginning and end of each word is unrecognizable.
Legible `word-spacing` must be determined on a case-by-case basis, as different font families have different character widths. There is no one value that can ensure all font families automatically maintain their legibility.
* [MDN Understanding WCAG, Guideline 1.4 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background)
* [Understanding Success Criterion 1.4.8 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-visual-presentation.html)
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | yes |
| Percentages | refer to the width of the affected glyph |
| [Computed value](computed_value) | absolute [`<length>`](length) |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
word-spacing =
normal [|](value_definition_syntax#single_bar)
[<length>](length)
```
Specifications
--------------
| Specification |
| --- |
| [CSS Text Module Level 3 # word-spacing-property](https://w3c.github.io/csswg-drafts/css-text/#word-spacing-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `word-spacing` | 1 | 12 | 1 | 6 | 3.5 | 1 | 4.4 | 18 | 4 | 14 | 1 | 1.0 |
| `percentages` | No | No | 45 | No | No | 7 | No | No | 45 | No | 7 | No |
| `svg` | 1 | 12 | 72 | 9 | 7 | 5.1 | ≤37 | 18 | No | 14 | 5 | 1.0 |
See also
--------
* [`letter-spacing`](letter-spacing)
css border-bottom-right-radius border-bottom-right-radius
==========================
The `border-bottom-right-radius` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property rounds the bottom-right corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner.
Try it
------
The rounding can be a circle or an ellipse, or if one of the value is `0` no rounding is done and the corner is square.
A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the [`background-clip`](background-clip) property.
**Note:** If the value of this property is not set in a [`border-radius`](border-radius) shorthand property that is applied to the element after the `border-bottom-right-radius` CSS property, the value of this property is then reset to its initial value by the [shorthand property](shorthand_properties).
Syntax
------
```
/\* The corner is a circle \*/
/\* border-bottom-right-radius: radius \*/
border-bottom-right-radius: 3px;
/\* Percentage values \*/
border-bottom-right-radius: 20%; /\* corner of a circle if box is a square or else corner of a rectangle \*/
border-bottom-right-radius: 20% 20%; /\* same as above \*/ /\* 20% of horizontal(width) and vertical(height) \*/
border-bottom-right-radius: 20% 10%; /\* 20% of horizontal(width) and 10% of vertical(height) \*/
/\*The corner is an ellipse \*/
/\* border-bottom-right-radius: horizontal vertical \*/
border-bottom-right-radius: 0.5em 1em;
/\* Global values \*/
border-bottom-right-radius: inherit;
border-bottom-right-radius: initial;
border-bottom-right-radius: revert;
border-bottom-right-radius: revert-layer;
border-bottom-right-radius: unset;
```
With one value:
* the value is a [`<length>`](length) or a [`<percentage>`](percentage) denoting the radius of the circle to use for the border in that corner.
With two values:
* the first value is a [`<length>`](length) or a [`<percentage>`](percentage) denoting the horizontal semi-major axis of the ellipse to use for the border in that corner.
* the second value is a [`<length>`](length) or a [`<percentage>`](percentage) denoting the vertical semi-major axis of the ellipse to use for the border in that corner.
### Values
`<length-percentage>` Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS [`<length>`](length) data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements; but User Agents are not required to apply to `table` and `inline-table` elements when [`border-collapse`](border-collapse) is `collapse`. The behavior on internal table elements is undefined for the moment.. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| Percentages | refer to the corresponding dimension of the border box |
| [Computed value](computed_value) | two absolute [`<length>`](length)s or [`<percentage>`](percentage)s |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
border-bottom-right-radius =
[<length-percentage [0,∞]>](length-percentage)[{1,2}](value_definition_syntax#curly_braces)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Arc of a circle
A single `<length>` value produces an arc of a circle.
```
div {
border-bottom-right-radius: 40px;
background-color: lightgreen;
border: solid 1px black;
width: 100px;
height: 100px;
}
```
### Arc of an ellipse
Two different `<length>` values produce an arc of an ellipse.
```
div {
border-bottom-right-radius: 40px 20px;
background-color: lightgreen;
border: solid 1px black;
width: 100px;
height: 100px;
}
```
### Square element with percentage radius
A square element with a single `<percentage>` value produces an arc of a circle.
```
div {
border-bottom-right-radius: 40%;
background-color: lightgreen;
border: solid 1px black;
width: 100px;
height: 100px;
}
```
### Non-square element with percentage radius
A non-square element with a single `<percentage>` value produces an arc of an ellipse.
```
div {
border-bottom-right-radius: 40%;
background-color: lightgreen;
border: solid 1px black;
width: 200px;
height: 100px;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # border-radius](https://w3c.github.io/csswg-drafts/css-backgrounds/#border-radius) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-bottom-right-radius` | 4
1 | 12
12 | 49
4
Before Firefox 50, border styles of rounded corners were always rendered as if `border-style` was solid. This has been fixed in Firefox 50.
1-12 | 9 | 15
10.5 | 5
3 | ≤37
≤37 | 18
18 | 49
4
Before Firefox 50, border styles of rounded corners were always rendered as if `border-style` was solid. This has been fixed in Firefox 50.
4-14 | 14
11 | 4.2
1 | 1.0
1.0 |
| `elliptical_corners` | 1 | 12 | 3.5 | 9 | 10.5 | 3 | ≤37 | 18 | 4 | 14 | 1 | 1.0 |
| `percentages` | 4 | 12 | 4
1-4
Before Firefox 4, the [`<percentage>`](https://developer.mozilla.org/docs/Web/CSS/percentage) was relative to the width of the box even when specifying the radius for a height. This implied that `-moz-border-radius-bottomright` was always drawing an arc of circle, and never an ellipse, when followed by a single value. | 9 | 10.5 | 5 | ≤37 | 18 | 4 | 14 | 4.2 | 1.0 |
See also
--------
* [`border-radius`](border-radius) shorthand property
* [`border-top-right-radius`](border-top-right-radius), [`border-bottom-left-radius`](border-bottom-left-radius), and [`border-top-left-radius`](border-top-left-radius)
css border-block-end border-block-end
================
The `border-block-end` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property is a [shorthand property](shorthand_properties) for setting the individual logical block-end border property values in a single place in the style sheet.
Try it
------
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`border-block-end-color`](border-block-end-color)
* [`border-block-end-style`](border-block-end-style)
* [`border-block-end-width`](border-block-end-width)
Syntax
------
```
border-block-end: 1px;
border-block-end: 2px dotted;
border-block-end: medium dashed blue;
/\* Global values \*/
border-block-end: inherit;
border-block-end: initial;
border-block-end: revert;
border-block-end: revert-layer;
border-block-end: unset;
```
`border-block-end` can be used to set the values for one or more of [`border-block-end-width`](border-block-end-width), [`border-block-end-style`](border-block-end-style), and [`border-block-end-color`](border-block-end-color). The physical border to which it maps depends on the element's writing mode, directionality, and text orientation. It corresponds to the [`border-top`](border-top), [`border-right`](border-right), [`border-bottom`](border-bottom), or [`border-left`](border-left) property depending on the values defined for [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation).
Related properties are [`border-block-start`](border-block-start), [`border-inline-start`](border-inline-start), and [`border-inline-end`](border-inline-end), which define the other borders of the element.
### Values
The `border-block-end` is specified with one or more of the following, in any order:
`<'border-width'>` The width of the border. See [`border-width`](border-width).
`<'border-style'>` The line style of the border. See [`border-style`](border-style).
`<'color'>` The color of the border. See [`color`](color).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`border-top-width`](border-top-width): `medium`
* [`border-top-style`](border-top-style): `none`
* [`border-top-color`](border-top-color): `currentcolor`
|
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`border-top-width`](border-top-width): the absolute length or `0` if [`border-top-style`](border-top-style) is `none` or `hidden`
* [`border-top-style`](border-top-style): as specified
* [`border-top-color`](border-top-color): computed color
|
| Animation type | as each of the properties of the shorthand:* [`border-block-end-color`](border-block-end-color): a [color](color_value#interpolation)
* [`border-block-end-style`](border-block-end-style): discrete
* [`border-block-end-width`](border-block-end-width): a [length](length#interpolation)
|
Formal syntax
-------------
```
border-block-end =
<'border-top-width'> [||](value_definition_syntax#double_bar)
<'border-top-style'> [||](value_definition_syntax#double_bar)
[<color>](color_value)
```
Examples
--------
### Border with vertical text
#### HTML
```
<div>
<p class="exampleText">Example text</p>
</div>
```
#### CSS
```
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-rl;
border-block-end: 5px dashed blue;
}
```
#### Results
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # border-shorthands](https://w3c.github.io/csswg-drafts/css-logical/#border-shorthands) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-block-end` | 69 | 79 | 41 | No | 56 | 12.1 | 69 | 69 | 41 | 48 | 12.2 | 10.0 |
See also
--------
* [CSS Logical Properties and Values](css_logical_properties)
* This property maps to one of the physical border properties: [`border-top`](border-top), [`border-right`](border-right), [`border-bottom`](border-bottom), or [`border-left`](border-left).
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)
css caret-color caret-color
===========
The `caret-color` CSS property sets the color of the **insertion caret**, the visible marker where the next character typed will be inserted. This is sometimes referred to as the **text input cursor**. The caret appears in elements such as [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) or those with the [`contenteditable`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#contenteditable) attribute. The caret is typically a thin vertical line that flashes to help make it more noticeable. By default, it is black, but its color can be altered with this property.
Try it
------
Note that the insertion caret is only one type of caret. For example, many browsers have a "navigation caret," which acts similarly to an insertion caret but can be moved around in non-editable text. On the other hand, the mouse cursor image shown when hovering over text where the [`cursor`](cursor) property is `auto`, or when hovering over an element where the `cursor` property is `text` or `vertical-text`, though it sometimes looks like a caret, is not a caret (it's a cursor).
Syntax
------
```
/\* Keyword values \*/
caret-color: auto;
caret-color: transparent;
caret-color: currentcolor;
/\* <color> values \*/
caret-color: red;
caret-color: #5729e9;
caret-color: rgb(0 200 0);
caret-color: hsl(228deg 4% 24% / 0.8);
/\* Global values \*/
caret-color: inherit;
caret-color: initial;
caret-color: revert;
caret-color: revert-layer;
caret-color: unset;
```
### Values
`auto` The user agent selects an appropriate color for the caret. This is generally [`currentcolor`](color_value#currentcolor_keyword), but the user agent may choose a different color to ensure good visibility and contrast with the surrounding content, taking into account the value of `currentcolor`, the background, shadows, and other factors.
**Note:** While user agents may use `currentcolor` (which is usually animatable) for the `auto` value, `auto` is not interpolated in transitions and animations.
[`<color>`](color_value) The color of the caret.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | all elements |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | `auto` is computed as specified and `<color>` values are computed as defined for the [`color`](color) property. |
| Animation type | a [color](color_value#interpolation) |
Formal syntax
-------------
```
caret-color =
auto [|](value_definition_syntax#single_bar)
[<color>](color_value)
```
Examples
--------
### Setting a custom caret color
#### HTML
```
<input value="This field uses a default caret." size="64" />
<input class="custom" value="I have a custom caret color!" size="64" />
<p contenteditable class="custom">
This paragraph can be edited, and its caret has a custom color as well!
</p>
```
#### CSS
```
input {
caret-color: auto;
display: block;
margin-bottom: 0.5em;
}
input.custom {
caret-color: red;
}
p.custom {
caret-color: green;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Basic User Interface Module Level 4 # caret-color](https://w3c.github.io/csswg-drafts/css-ui/#caret-color) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `caret-color` | 57 | 79 | 53 | No | 44 | 11.1 | 57 | 57 | 53 | 43 | 11.3
While the property is recognized, implementation is incomplete. The color of the caret does not always match the color set for the element in focus. See [bug 177489](https://webkit.org/b/177489). | 7.0 |
See also
--------
* The [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) element
* The HTML [`contenteditable`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#contenteditable) attribute, which can be used to make any element's text editable
* [Making content editable](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contenteditable)
* [Applying color to HTML elements using CSS](css_colors/applying_color)
* The [`<color>`](color_value) data type
* Other color-related properties: [`color`](color), [`background-color`](background-color), [`border-color`](border-color), [`outline-color`](outline-color), [`text-decoration-color`](text-decoration-color), [`text-emphasis-color`](text-emphasis-color), [`text-shadow`](text-shadow), [`caret-color`](caret-color), and [`column-rule-color`](column-rule-color)
css scroll-margin-top scroll-margin-top
=================
The `scroll-margin-top` property defines the top margin of the scroll snap area that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets.
Try it
------
Syntax
------
```
/\* <length> values \*/
scroll-margin-top: 10px;
scroll-margin-top: 1em;
/\* Global values \*/
scroll-margin-top: inherit;
scroll-margin-top: initial;
scroll-margin-top: revert;
scroll-margin-top: revert-layer;
scroll-margin-top: unset;
```
### Values
`<length>` An outset from the top edge of the scroll container.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-margin-top =
[<length>](length)
```
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # margin-longhands-physical](https://w3c.github.io/csswg-drafts/css-scroll-snap/#margin-longhands-physical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-margin-top` | 69 | 79 | 68 | No | 56 | 14.1
11
Before version 14.1, scroll margin is not applied for scrolls to fragment target or `scrollIntoView()`, see [bug 189265](https://webkit.org/b/189265). | 69 | 69 | 68 | 48 | 14.5
11
Before version 14.5, scroll margin is not applied for scrolls to fragment target or `scrollIntoView()`, see [bug 189265](https://webkit.org/b/189265). | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
| programming_docs |
css scroll-margin-inline-end scroll-margin-inline-end
========================
The `scroll-margin-inline-end` property defines the margin of the scroll snap area at the end of the inline dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets.
Try it
------
Syntax
------
```
/\* <length> values \*/
scroll-margin-inline-end: 10px;
scroll-margin-inline-end: 1em;
/\* Global values \*/
scroll-margin-inline-end: inherit;
scroll-margin-inline-end: initial;
scroll-margin-inline-end: revert;
scroll-margin-inline-end: revert-layer;
scroll-margin-inline-end: unset;
```
### Values
`<length>` An outset from the inline end edge of the scroll container.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-margin-inline-end =
[<length>](length)
```
Examples
--------
### Simple demonstration
This example implements something very similar to the interactive example above, except that here we'll explain to you how it's implemented.
The aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the right of each block.
#### HTML
The HTML that represents the blocks is very simple:
```
<div class="scroller">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
```
#### CSS
Let's walk through the CSS. The outer container is styled like this:
```
.scroller {
text-align: left;
width: 250px;
height: 250px;
overflow-x: scroll;
display: flex;
box-sizing: border-box;
border: 1px solid #000;
scroll-snap-type: x mandatory;
}
```
The main parts relevant to the scroll snapping are `overflow-x: scroll`, which makes sure the contents will scroll and not be hidden, and `scroll-snap-type: x mandatory`, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point.
The child elements are styled as follows:
```
.scroller > div {
flex: 0 0 250px;
width: 250px;
background-color: #663399;
color: #fff;
font-size: 30px;
display: flex;
align-items: center;
justify-content: center;
scroll-snap-align: end;
}
.scroller > div:nth-child(2n) {
background-color: #fff;
color: #663399;
}
```
The most relevant part here is `scroll-snap-align: end`, which specifies that the right-hand edges (the "ends" along the x axis, in our case) are the designated snap points.
Last of all we specify the scroll margin values, a different one for the second and third child elements:
```
.scroller > div:nth-child(2) {
scroll-margin-inline-end: 1rem;
}
.scroller > div:nth-child(3) {
scroll-margin-inline-end: 2rem;
}
```
This means that when scrolling past the middle child elements, the scrolling will snap to `1rem` outside the inline end edge of the second `<div>`, and `2rems` outside the inline end edge of the third `<div>`.
#### Result
Try it for yourself:
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # margin-longhands-logical](https://w3c.github.io/csswg-drafts/css-scroll-snap/#margin-longhands-logical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-margin-inline-end` | 69 | 79 | 68 | No | 56 | 14.1 | 69 | 69 | 68 | 48 | 14.5 | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
css font-optical-sizing font-optical-sizing
===================
The `font-optical-sizing` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets whether text rendering is optimized for viewing at different sizes.
Try it
------
Syntax
------
```
/\* keyword values \*/
font-optical-sizing: none;
font-optical-sizing: auto; /\* default \*/
/\* Global values \*/
font-optical-sizing: inherit;
font-optical-sizing: initial;
font-optical-sizing: revert;
font-optical-sizing: revert-layer;
font-optical-sizing: unset;
```
### Values
none The browser will not modify the shape of glyphs for optimal viewing.
auto The browser will modify the shape of glyphs for optimal viewing.
Description
-----------
Optical sizing is enabled by default for fonts that have an optical size variation axis. The optical size variation axis is represented by `opsz` in [`font-variation-settings`](font-variation-settings).
When optical sizing is used, small text sizes are often rendered with thicker strokes and larger serifs, whereas larger text is often rendered more delicately with more contrast between thicker and thinner strokes.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
font-optical-sizing =
auto [|](value_definition_syntax#single_bar)
none
```
Examples
--------
### Disabling optical sizing
```
<p class="optical-sizing">
This paragraph is optically sized. This is the default across browsers.
</p>
<p class="no-optical-sizing">
This paragraph is not optically sized. You should see a difference in
supporting browsers.
</p>
```
```
@font-face {
src: url("AmstelvarAlpha-VF.ttf");
font-family: "Amstelvar";
font-style: normal;
}
p {
font-size: 36px;
font-family: Amstelvar;
}
.no-optical-sizing {
font-optical-sizing: none;
}
```
**Note:** The font referenced above — which includes optical sizing and is freely-licensed — is good for testing. You can [download it on GitHub](https://github.com/googlefonts/amstelvar/releases).
Specifications
--------------
| Specification |
| --- |
| [CSS Fonts Module Level 4 # font-optical-sizing-def](https://w3c.github.io/csswg-drafts/css-fonts/#font-optical-sizing-def) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `font-optical-sizing` | 79 | 17 | 62 | No | 66 | 11 | 79 | 79 | 62 | No | 11 | 12.0 |
See also
--------
* [`font-size`](font-size)
* [`font-size-adjust`](font-size-adjust)
* [Fundamental text and font styling](https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_text/Fundamentals)
css border-image-source border-image-source
===================
The `border-image-source` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the source image used to create an element's [border image](border-image).
Try it
------
The [`border-image-slice`](border-image-slice) property is used to divide the source image into regions, which are then dynamically applied to the final border image.
Syntax
------
```
/\* Keyword value \*/
border-image-source: none;
/\* <image> values \*/
border-image-source: url(image.jpg);
border-image-source: linear-gradient(to top, red, yellow);
/\* Global values \*/
border-image-source: inherit;
border-image-source: initial;
border-image-source: revert;
border-image-source: revert-layer;
border-image-source: unset;
```
### Values
`none` No border image is used. The appearance defined by [`border-style`](border-style) is displayed instead.
[`<image>`](image) Image reference to use for the border.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements, except internal table elements when [`border-collapse`](border-collapse) is `collapse`. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | `none` or the image with its URI made absolute |
| Animation type | discrete |
Formal syntax
-------------
```
border-image-source =
none [|](value_definition_syntax#single_bar)
<image>
<image> =
<url> [|](value_definition_syntax#single_bar)
[<gradient>](gradient)
<url> =
url( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) ) [|](value_definition_syntax#single_bar)
src( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) )
```
Examples
--------
### Basic example
```
.box {
border-image-source: url("image.png");
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # the-border-image-source](https://w3c.github.io/csswg-drafts/css-backgrounds/#the-border-image-source) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-image-source` | 15 | 12 | 15 | 11 | 15 | 6 | 4.4 | 18 | 15 | 14 | 6 | 1.0 |
See also
--------
* [`border`](border)
* [`outline`](outline)
* [`box-shadow`](box-shadow)
* [`background-image`](background-image)
* [`url()`](url) function
css ::after ::after
=======
In CSS, `::after` creates a [pseudo-element](pseudo-elements) that is the last child of the selected element. It is often used to add cosmetic content to an element with the [`content`](content) property. It is inline by default.
Try it
------
**Note:** The pseudo-elements generated by `::before` and `::after` are [contained by the element's formatting box](https://www.w3.org/TR/CSS2/generate.html#before-after-content), and thus don't apply to *[replaced elements](replaced_element)* such as [`<img>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img), or to [`<br>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br) elements.
Syntax
------
```
::after
```
**Note:** CSS introduced the `::after` notation (with two colons) to distinguish <pseudo-classes> from <pseudo-elements>. For backward compatibility, browsers also accept `:after`, introduced earlier.
Examples
--------
### Simple usage
Let's create two classes: one for boring paragraphs and one for exciting ones. We can use these classes to add pseudo-elements to the end of paragraphs.
#### HTML
```
<p class="boring-text">Here is some plain old boring text.</p>
<p>Here is some normal text that is neither boring nor exciting.</p>
<p class="exciting-text">Contributing to MDN is easy and fun.</p>
```
#### CSS
```
.exciting-text::after {
content: " <- EXCITING!";
color: green;
}
.boring-text::after {
content: " <- BORING";
color: red;
}
```
#### Result
### Decorative example
We can style text or images in the [`content`](content) property almost any way we want.
#### HTML
```
<span class="ribbon">Look at the orange box after this text. </span>
```
#### CSS
```
.ribbon {
background-color: #5bc8f7;
}
.ribbon::after {
content: "This is a fancy orange box.";
background-color: #ffba10;
border-color: black;
border-style: dotted;
}
```
#### Result
### Tooltips
This example uses `::after`, in conjunction with the [`attr()`](attr) CSS expression and a `data-descr` [custom data attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*), to create tooltips. No JavaScript is required!
We can also support keyboard users with this technique, by adding a `tabindex` of `0` to make each `span` keyboard focusable, and using a CSS `:focus` selector. This shows how flexible `::before` and `::after` can be, though for the most accessible experience a semantic disclosure widget created in some other way (such as with [details and summary](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details) elements) is likely to be more appropriate.
#### HTML
```
<p>
Here we have some
<span tabindex="0" data-descr="collection of words and punctuation">
text
</span>
with a few
<span tabindex="0" data-descr="small popups that appear when hovering">
tooltips
</span>.
</p>
```
#### CSS
```
span[data-descr] {
position: relative;
text-decoration: underline;
color: #00f;
cursor: help;
}
span[data-descr]:hover::after,
span[data-descr]:focus::after {
content: attr(data-descr);
position: absolute;
left: 0;
top: 24px;
min-width: 200px;
border: 1px #aaaaaa solid;
border-radius: 10px;
background-color: #ffffcc;
padding: 12px;
color: #000000;
font-size: 14px;
z-index: 1;
}
```
#### Result
Accessibility concerns
----------------------
Using an `::after` pseudo-element to add content is discouraged, as it is not reliably accessible to screen readers.
Specifications
--------------
| Specification |
| --- |
| [CSS Pseudo-Elements Module Level 4 # generated-content](https://w3c.github.io/csswg-drafts/css-pseudo/#generated-content) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `::after` | 1
1 | 12
12 | 1.5
["Before Firefox 57, Firefox had a bug where `::after` pseudo-elements were still generated, even if the [`content`](https://developer.mozilla.org/docs/Web/CSS/content) property value were set to `normal` or `none`.", "Before Firefox 3.5, only the CSS level 2 behavior of `:after` was supported, which disallowed [`position`](https://developer.mozilla.org/docs/Web/CSS/position), [`float`](https://developer.mozilla.org/docs/Web/CSS/float), `list-style-*` and some `display` properties."]
1 | 9
8 | 7
4 | 4
4 | ≤37
≤37 | 18
18 | 4
["Before Firefox 57, Firefox had a bug where `::after` pseudo-elements were still generated, even if the [`content`](https://developer.mozilla.org/docs/Web/CSS/content) property value were set to `normal` or `none`.", "Before Firefox 3.5, only the CSS level 2 behavior of `:after` was supported, which disallowed [`position`](https://developer.mozilla.org/docs/Web/CSS/position), [`float`](https://developer.mozilla.org/docs/Web/CSS/float), `list-style-*` and some `display` properties."]
4 | 10.1
10.1 | 3.2
3.2 | 1.0
1.0 |
| `animation_and_transition_support` | 26 | 12 | 4 | No | 15 | No | 4.4 | 26 | 4 | 14 | No | 1.5 |
See also
--------
* [`::before`](::before)
* [`content`](content)
css Used value Used value
==========
The **used value** of a [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property is its value after all calculations have been performed on the [computed value](computed_value).
After the [user agent](https://developer.mozilla.org/en-US/docs/Glossary/User_agent) has finished its calculations, every CSS property has a used value. The used values of dimensions (e.g., [`width`](width), [`line-height`](line-height)) are in pixels. The used values of shorthand properties (e.g., [`background`](background)) are consistent with those of their component properties (e.g., [`background-color`](background-color) or [`background-size`](background-size)) and with [`position`](position) and [`float`](float).
**Note:** The [`getComputedStyle()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle) DOM API returns the [resolved value](resolved_value), which may either be the [computed value](computed_value) or the [used value](used_value), depending on the property.
Example
-------
This example computes and displays the used `width` value of three elements (updates on resize):
### HTML
```
<div id="no-width">
<p>No explicit width.</p>
<p class="show-used-width">..</p>
<div id="width-50">
<p>Explicit width: 50%.</p>
<p class="show-used-width">..</p>
<div id="width-inherit">
<p>Explicit width: inherit.</p>
<p class="show-used-width">..</p>
</div>
</div>
</div>
```
### CSS
```
#no-width {
width: auto;
}
#width-50 {
width: 50%;
}
#width-inherit {
width: inherit;
}
/\* Make results easier to see \*/
div {
border: 1px solid red;
padding: 8px;
}
```
### JavaScript
```
function updateUsedWidth(id) {
const div = document.getElementById(id);
const par = div.querySelector('.show-used-width');
const wid = window.getComputedStyle(div)["width"];
par.textContent = `Used width: ${wid}.`;
}
function updateAllUsedWidths() {
updateUsedWidth("no-width");
updateUsedWidth("width-50");
updateUsedWidth("width-inherit");
}
updateAllUsedWidths();
window.addEventListener('resize', updateAllUsedWidths);
```
### Result
Difference from computed value
------------------------------
CSS 2.0 defined only *computed value* as the last step in a property's calculation. Then, CSS 2.1 introduced the distinct definition of used value. An element could then explicitly inherit a width/height of a parent, whose computed value is a percentage. For CSS properties that don't depend on layout (e.g., `display`, `font-size`, or `line-height`), the computed values and used values are the same. The following are the CSS 2.1 properties that do depend on layout, so they have a different computed value and used value: (taken from [CSS 2.1 Changes: Specified, computed, and actual values](https://www.w3.org/TR/CSS2/changes.html#q21.36)):
* `background-position`
* `bottom`, `left`, `right`, `top`
* `height`, `width`
* `margin-bottom`, `margin-left`, `margin-right`, `margin-top`
* `min-height`, `min-width`
* `padding-bottom`, `padding-left`, `padding-right`, `padding-top`
* `text-indent`
Specifications
--------------
| Specification |
| --- |
| [Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification # used-value](https://www.w3.org/TR/CSS22/cascade.html#used-value) |
See also
--------
* [`window.getComputedStyle`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle)
* CSS key concepts:
+ [CSS syntax](syntax)
+ [Comments](comments)
+ [Specificity](specificity)
+ [Inheritance](inheritance)
+ [Box model](css_box_model/introduction_to_the_css_box_model)
+ [Layout modes](layout_mode)
+ [Visual formatting models](visual_formatting_model)
+ [Margin collapsing](css_box_model/mastering_margin_collapsing)
+ Values
- [Initial values](initial_value)
- [Computed values](computed_value)
- [Used values](used_value)
- [Actual values](actual_value)
+ [Value definition syntax](value_definition_syntax)
+ [Shorthand properties](shorthand_properties)
+ [Replaced elements](replaced_element)
css place-self place-self
==========
The `place-self` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [shorthand property](shorthand_properties) allows you to align an individual item in both the block and inline directions at once (i.e. the [`align-self`](align-self) and [`justify-self`](justify-self) properties) in a relevant layout system such as [Grid](css_grid_layout) or [Flexbox](css_flexible_box_layout). If the second value is not present, the first value is also used for it.
Try it
------
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`align-self`](align-self)
* [`justify-self`](justify-self)
Syntax
------
```
/\* Keyword values \*/
place-self: auto center;
place-self: normal start;
/\* Positional alignment \*/
place-self: center normal;
place-self: start auto;
place-self: end normal;
place-self: self-start auto;
place-self: self-end normal;
place-self: flex-start auto;
place-self: flex-end normal;
place-self: left auto;
place-self: right normal;
/\* Baseline alignment \*/
place-self: baseline normal;
place-self: first baseline auto;
place-self: last baseline normal;
place-self: stretch auto;
/\* Global values \*/
place-self: inherit;
place-self: initial;
place-self: revert;
place-self: revert-layer;
place-self: unset;
```
### Values
`auto` Computes to the parent's [`align-items`](align-items) value.
`normal` The effect of this keyword is dependent of the layout mode we are in:
* In absolutely-positioned layouts, the keyword behaves like `start` on *replaced* absolutely-positioned boxes, and as `stretch` on *all other* absolutely-positioned boxes.
* In static position of absolutely-positioned layouts, the keyword behaves as `stretch`.
* For flex items, the keyword behaves as `stretch`.
* For grid items, this keyword leads to a behavior similar to the one of `stretch`, except for boxes with an aspect ratio or an intrinsic sizes where it behaves like `start`.
* The property doesn't apply to block-level boxes, and to table cells.
`self-start` Aligns the items to be flush with the edge of the alignment container corresponding to the item's start side in the cross axis.
`self-end` Aligns the items to be flush with the edge of the alignment container corresponding to the item's end side in the cross axis.
`flex-start` The cross-start margin edge of the flex item is flushed with the cross-start edge of the line.
`flex-end` The cross-end margin edge of the flex item is flushed with the cross-end edge of the line.
`center` The flex item's margin box is centered within the line on the cross-axis. If the cross-size of the item is larger than the flex container, it will overflow equally in both directions.
`baseline`, `first baseline`. `last baseline`
Specifies participation in first- or last-baseline alignment: aligns the alignment baseline of the box's first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. The fallback alignment for `first baseline` is `start`, the one for `last baseline` is `end`.
`stretch` If the combined size of the items along the cross axis is less than the size of the alignment container and the item is `auto`-sized, its size is increased equally (not proportionally), while still respecting the constraints imposed by [`max-height`](max-height)/[`max-width`](max-width) (or equivalent functionality), so that the combined size of all `auto`-sized items exactly fills the alignment container along the cross axis.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`align-self`](align-self): `auto`
* [`justify-self`](justify-self): `auto`
|
| Applies to | block-level boxes, absolutely-positioned boxes, and grid items |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`align-self`](align-self): `auto` computes to itself on absolutely-positioned elements, and to the computed value of [`align-items`](align-items) on the parent (minus any legacy keywords) on all other boxes, or `start` if the box has no parent. Its behavior depends on the layout model, as described for [`justify-self`](justify-self). Otherwise the specified value.
* [`justify-self`](justify-self): as specified
|
| Animation type | discrete |
Formal syntax
-------------
```
place-self =
<'align-self'> <'justify-self'>[?](value_definition_syntax#question_mark)
```
Examples
--------
### Simple demonstration
In the following example we have a simple 2 x 2 grid layout. Initially the grid container has [`justify-items`](justify-items) and [`align-items`](align-items) values of `stretch` — the defaults — which causes the grid items to stretch across the entire width of their cells.
The second, third, and fourth grid items are then given different values of `place-self`, to show how these override the default placements. These values cause the grid items to span only as wide/tall as their content width/height, and align in different positions across their cells, in the block and inline directions.
#### HTML
```
<article class="container">
<span>First</span>
<span>Second</span>
<span>Third</span>
<span>Fourth</span>
</article>
```
#### CSS
```
html {
font-family: helvetica, arial, sans-serif;
letter-spacing: 1px;
}
article {
background-color: red;
display: grid;
grid-template-columns: 1fr 1fr;
grid-auto-rows: 80px;
grid-gap: 10px;
margin: 20px;
width: 300px;
}
span:nth-child(2) {
place-self: start center;
}
span:nth-child(3) {
place-self: center start;
}
span:nth-child(4) {
place-self: end;
}
article span {
background-color: black;
color: white;
margin: 1px;
text-align: center;
}
article,
span {
padding: 10px;
border-radius: 7px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Box Alignment Module Level 3 # place-self-property](https://w3c.github.io/csswg-drafts/css-align/#place-self-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `place-self` | 59 | 79 | 45 | No | 46 | 11 | 59 | 59 | 45 | 43 | 11 | 7.0 |
| `flex_context` | 59 | 79 | 45 | No | 46 | 11 | 59 | 59 | 45 | 43 | 11 | 7.0 |
| `grid_context` | 59 | 79 | 45 | No | 46 | 11 | 59 | 59 | 45 | 43 | 11 | 7.0 |
See also
--------
* CSS Flexbox Guide: *[Basic Concepts of Flexbox](css_flexible_box_layout/basic_concepts_of_flexbox)*
* CSS Flexbox Guide: *[Aligning items in a flex container](css_flexible_box_layout/aligning_items_in_a_flex_container)*
* CSS Grid Guide: *[Box alignment in CSS Grid layouts](css_grid_layout/box_alignment_in_css_grid_layout)*
* [CSS Box Alignment](css_box_alignment)
* The [`align-self`](align-self) property
* The [`justify-self`](justify-self) property
| programming_docs |
css scroll-padding-top scroll-padding-top
==================
The `scroll-padding-top` property defines offsets for the top of the *optimal viewing region* of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or to put more breathing room between a targeted element and the edges of the scrollport.
Try it
------
Syntax
------
```
/\* Keyword values \*/
scroll-padding-top: auto;
/\* <length> values \*/
scroll-padding-top: 10px;
scroll-padding-top: 1em;
scroll-padding-top: 10%;
/\* Global values \*/
scroll-padding-top: inherit;
scroll-padding-top: initial;
scroll-padding-top: revert;
scroll-padding-top: revert-layer;
scroll-padding-top: unset;
```
### Values
`[`<length-percentage>`](length-percentage)` An inwards offset from the top edge of the scrollport, as a valid length or a percentage.
`auto` The offset is determined by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | scroll containers |
| [Inherited](inheritance) | no |
| Percentages | relative to the scroll container's scrollport |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-padding-top =
auto [|](value_definition_syntax#single_bar)
[<length-percentage [0,∞]>](length-percentage)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # padding-longhands-physical](https://w3c.github.io/csswg-drafts/css-scroll-snap/#padding-longhands-physical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-padding-top` | 69 | 79 | 68 | No | 56 | 14.1
11-14.1
Scroll padding is not applied for scrolls to fragment target or `scrollIntoView()`, see [bug 179379](https://webkit.org/b/179379). | 69 | 69 | 68 | 48 | 14.5
11-14.5
Scroll padding is not applied for scrolls to fragment target or `scrollIntoView()`, see [bug 179379](https://webkit.org/b/179379). | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
css font-variant-position font-variant-position
=====================
The `font-variant-position` CSS property controls the use of alternate, smaller glyphs that are positioned as superscript or subscript.
The glyphs are positioned relative to the baseline of the font, which remains unchanged. These glyphs are typically used in [`<sub>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub) and [`<sup>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup) elements.
```
/\* Keyword values \*/
font-variant-position: normal;
font-variant-position: sub;
font-variant-position: super;
/\* Global values \*/
font-variant-position: inherit;
font-variant-position: initial;
font-variant-position: revert;
font-variant-position: revert-layer;
font-variant-position: unset;
```
When the usage of these alternate glyphs is activated, if one character in the run doesn't have such a typographically-enhanced glyph, the whole set of characters of the run is rendered using a fallback method, synthesizing these glyphs.
These alternate glyphs share the same em-box and the same baseline as the rest of the font. They are merely graphically enhanced, and have no effect on the line-height and other box characteristics.
Syntax
------
The `font-variant-position` property is specified as one of the keyword values listed below.
### Values
`normal` Deactivates alternate superscript and subscript glyphs.
`sub` Activates subscript alternate glyphs. If, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs.
`super` Activates superscript alternate glyphs. If, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
font-variant-position =
normal [|](value_definition_syntax#single_bar)
sub [|](value_definition_syntax#single_bar)
super
```
Examples
--------
### Setting superscript and subscript forms
#### HTML
```
<p class="normal">Normal!</p>
<p class="super">Super!</p>
<p class="sub">Sub!</p>
```
#### CSS
```
p {
display: inline;
}
.normal {
font-variant-position: normal;
}
.super {
font-variant-position: super;
}
.sub {
font-variant-position: sub;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Fonts Module Level 4 # font-variant-position-prop](https://w3c.github.io/csswg-drafts/css-fonts/#font-variant-position-prop) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `font-variant-position` | No
See [bug 1212668](https://crbug.com/1212668). | No
See [bug 1212668](https://crbug.com/1212668). | 34 | No | No
See [bug 1212668](https://crbug.com/1212668). | 9.1 | No
See [bug 1212668](https://crbug.com/1212668). | No
See [bug 1212668](https://crbug.com/1212668). | 34 | No
See [bug 1212668](https://crbug.com/1212668). | 9.3 | No
See [bug 1212668](https://crbug.com/1212668). |
See also
--------
* [`font-variant`](font-variant)
* [`font-variant-alternates`](font-variant-alternates)
* [`font-variant-caps`](font-variant-caps)
* [`font-variant-east-asian`](font-variant-east-asian)
* [`font-variant-emoji`](font-variant-emoji)
* [`font-variant-ligatures`](font-variant-ligatures)
* [`font-variant-numeric`](font-variant-numeric)
css inline-size inline-size
===========
The `inline-size` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the horizontal or vertical size of an element's block, depending on its writing mode. It corresponds to either the [`width`](width) or the [`height`](height) property, depending on the value of [`writing-mode`](writing-mode).
If the writing mode is vertically oriented, the value of `inline-size` relates to the height of the element; otherwise, it relates to the width of the element. A related property is [`block-size`](block-size), which defines the other dimension of the element.
Try it
------
Syntax
------
```
/\* <length> values \*/
inline-size: 300px;
inline-size: 25em;
/\* <percentage> values \*/
inline-size: 75%;
/\* Keyword values \*/
inline-size: max-content;
inline-size: min-content;
inline-size: fit-content(20em);
inline-size: auto;
/\* Global values \*/
inline-size: inherit;
inline-size: initial;
inline-size: revert;
inline-size: revert-layer;
inline-size: unset;
```
### Values
The `inline-size` property takes the same values as the [`width`](width) and [`height`](height) properties.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | same as [`width`](width) and [`height`](height) |
| [Inherited](inheritance) | no |
| Percentages | inline-size of containing block |
| [Computed value](computed_value) | same as [`width`](width) and [`height`](height) |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
inline-size =
<'width'>
```
Examples
--------
### Setting inline size in pixels
#### HTML
```
<p class="exampleText">Example text</p>
```
#### CSS
```
.exampleText {
writing-mode: vertical-rl;
background-color: yellow;
inline-size: 110px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # dimension-properties](https://w3c.github.io/csswg-drafts/css-logical/#dimension-properties) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `inline-size` | 57 | 79 | 41 | No | 44 | 12.1 | 57 | 57 | 41 | 43 | 12.2 | 5.0 |
| `fit-content` | 57 | 79 | 41 | No | 44 | 12.1 | 57 | 57 | 41 | 43 | 12.2 | 5.0 |
| `fit-content_function` | No | No | 91 | No | No | No | No | No | No | No | No | No |
| `max-content` | 57 | 79 | 66
41 | No | 44 | 12.1 | 57 | 57 | 66
41 | 43 | 12.2 | 5.0 |
| `min-content` | 57 | 79 | 66
41 | No | 44 | 12.1 | 57 | 57 | 66
41 | 43 | 12.2 | 5.0 |
See also
--------
* The mapped physical properties: [`width`](width) and [`height`](height)
* [`writing-mode`](writing-mode)
css border-bottom-left-radius border-bottom-left-radius
=========================
The `border-bottom-left-radius` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property rounds the bottom-left corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner.
Try it
------
The rounding can be a circle or an ellipse, or if one of the value is `0` no rounding is done and the corner is square.
A background, being an image or a color, is clipped at the border, even a rounded one; the exact location of the clipping is defined by the value of the [`background-clip`](background-clip) property.
**Note:** If the value of this property is not set in a [`border-radius`](border-radius) shorthand property that is applied to the element after the `border-bottom-left-radius` CSS property, the value of this property is then reset to its initial value by the [shorthand property](shorthand_properties).
Syntax
------
```
/\* the corner is a circle \*/
/\* border-bottom-left-radius: radius \*/
border-bottom-left-radius: 3px;
/\* Percentage values \*/
/\* circle if box is a square or ellipse if box is a rectangle \*/
border-bottom-left-radius: 20%;
/\* same as above: 20% of horizontal(width) and vertical(height) \*/
border-bottom-left-radius: 20% 20%;
/\* 20% of horizontal(width) and 10% of vertical(height) \*/
border-bottom-left-radius: 20% 10%;
/\* the corner is an ellipse \*/
/\* border-bottom-left-radius: horizontal vertical \*/
border-bottom-left-radius: 0.5em 1em;
/\* Global values \*/
border-bottom-left-radius: inherit;
border-bottom-left-radius: initial;
border-bottom-left-radius: revert;
border-bottom-left-radius: revert-layer;
border-bottom-left-radius: unset;
```
With one value:
* the value is a [`<length>`](length) or a [`<percentage>`](percentage) denoting the radius of the circle to use for the border in that corner.
With two values:
* the first value is a [`<length>`](length) or a [`<percentage>`](percentage) denoting the horizontal semi-major axis of the ellipse to use for the border in that corner.
* the second value is a [`<length>`](length) or a [`<percentage>`](percentage) denoting the vertical semi-major axis of the ellipse to use for the border in that corner.
### Values
`<length-percentage>` Denotes the size of the circle radius or the semi-major and semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS [`<length>`](length) data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements; but User Agents are not required to apply to `table` and `inline-table` elements when [`border-collapse`](border-collapse) is `collapse`. The behavior on internal table elements is undefined for the moment.. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| Percentages | refer to the corresponding dimension of the border box |
| [Computed value](computed_value) | two absolute [`<length>`](length)s or [`<percentage>`](percentage)s |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
border-bottom-left-radius =
[<length-percentage [0,∞]>](length-percentage)[{1,2}](value_definition_syntax#curly_braces)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Arc of a circle
A single `<length>` value produces an arc of a circle.
```
div {
border-bottom-left-radius: 40px;
background-color: lightgreen;
border: solid 1px black;
width: 100px;
height: 100px;
}
```
### Arc of an ellipse
Two different `<length>` values produce an arc of an ellipse.
```
div {
border-bottom-left-radius: 40px 20px;
background-color: lightgreen;
border: solid 1px black;
width: 100px;
height: 100px;
}
```
### Square element with percentage radius
A square element with a single `<percentage>` value produces an arc of a circle.
```
div {
border-bottom-left-radius: 40%;
background-color: lightgreen;
border: solid 1px black;
width: 100px;
height: 100px;
}
```
### Non-square element with percentage radius
A non-square element with a single `<percentage>` value produces an arc of an ellipse.
```
div {
border-bottom-left-radius: 40%;
background-color: lightgreen;
border: solid 1px black;
width: 200px;
height: 100px;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # border-radius](https://w3c.github.io/csswg-drafts/css-backgrounds/#border-radius) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-bottom-left-radius` | 4
1 | 12
12 | 49
4
Before Firefox 50, border styles of rounded corners were always rendered as if `border-style` was solid. This has been fixed in Firefox 50.
1-12 | 9 | 15
10.5 | 5
3 | ≤37
≤37 | 18
18 | 49
4
Before Firefox 50, border styles of rounded corners were always rendered as if `border-style` was solid. This has been fixed in Firefox 50.
4-14 | 14
11 | 4.2
1 | 1.0
1.0 |
| `elliptical_corners` | 1 | 12 | 3.5 | 9 | 10.5 | 3 | ≤37 | 18 | 4 | 14 | 1 | 1.0 |
| `percentages` | 4 | 12 | 4
1-4
Before Firefox 4, the [`<percentage>`](https://developer.mozilla.org/docs/Web/CSS/percentage) was relative to the width of the box even when specifying the radius for a height. This implied that `-moz-border-radius-bottomright` was always drawing an arc of circle, and never an ellipse, when followed by a single value. | 9 | 10.5 | 5 | ≤37 | 18 | 4 | 14 | 4.2 | 1.0 |
See also
--------
* [`border-radius`](border-radius) shorthand property
* [`border-top-right-radius`](border-top-right-radius), [`border-bottom-right-radius`](border-bottom-right-radius), and [`border-top-left-radius`](border-top-left-radius)
css flex flex
====
The `flex` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [shorthand property](shorthand_properties) sets how a flex *item* will grow or shrink to fit the space available in its flex container.
Try it
------
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`flex-grow`](flex-grow)
* [`flex-shrink`](flex-shrink)
* [`flex-basis`](flex-basis)
Syntax
------
```
/\* Keyword values \*/
flex: auto;
flex: initial;
flex: none;
/\* One value, unitless number: flex-grow
flex-basis is then equal to 0. \*/
flex: 2;
/\* One value, width/height: flex-basis \*/
flex: 10em;
flex: 30%;
flex: min-content;
/\* Two values: flex-grow | flex-basis \*/
flex: 1 30px;
/\* Two values: flex-grow | flex-shrink \*/
flex: 2 2;
/\* Three values: flex-grow | flex-shrink | flex-basis \*/
flex: 2 2 10%;
/\* Global values \*/
flex: inherit;
flex: initial;
flex: revert;
flex: revert-layer;
flex: unset;
```
The `flex` property may be specified using one, two, or three values.
* **One-value syntax:** the value must be one of:
+ a valid value for [`<flex-grow>`](flex-grow): then the shorthand expands to `flex: <flex-grow> 1 0`.
+ a valid value for [`<flex-basis>`](flex-basis): then the shorthand expands to `flex: 1 1 <flex-basis>`.
+ the keyword `none` or one of the global keywords.
* **Two-value syntax:**
+ The first value must be a valid value for [`flex-grow`](flex-grow).
+ The second value must be one of:
- a valid value for [`flex-shrink`](flex-shrink): then the shorthand expands to `flex: <flex-grow> <flex-shrink> 0`.
- a valid value for [`flex-basis`](flex-basis): then the shorthand expands to `flex: <flex-grow> 1 <flex-basis>`.
* **Three-value syntax:** the values must be in the following order:
1. a valid value for [`flex-grow`](flex-grow).
2. a valid value for [`flex-shrink`](flex-shrink).
3. a valid value for [`flex-basis`](flex-basis).
### Values
`initial` The item is sized according to its `width` and `height` properties. It shrinks to its minimum size to fit the container, but does not grow to absorb any extra free space in the flex container. This is equivalent to setting "`flex: 0 1 auto`".
`auto` The item is sized according to its `width` and `height` properties, but grows to absorb any extra free space in the flex container, and shrinks to its minimum size to fit the container. This is equivalent to setting "`flex: 1 1 auto`".
`none` The item is sized according to its `width` and `height` properties. It is fully inflexible: it neither shrinks nor grows in relation to the flex container. This is equivalent to setting "`flex: 0 0 auto`".
`<'flex-grow'>` Defines the [`flex-grow`](flex-grow) of the flex item. Negative values are considered invalid. Defaults to `1` when omitted. (initial is `0`)
`<'flex-shrink'>` Defines the [`flex-shrink`](flex-shrink) of the flex item. Negative values are considered invalid. Defaults to `1` when omitted. (initial is `1`)
`<'flex-basis'>` Defines the [`flex-basis`](flex-basis) of the flex item. A preferred size of `0` must have a unit to avoid being interpreted as a flexibility. Defaults to `0` when omitted. (initial is `auto`)
Description
-----------
For most purposes, authors should set `flex` to one of the following values: `auto`, `initial`, `none`, or a positive unitless number. To see the effect of these values, try resizing the flex containers below:
By default flex items don't shrink below their minimum content size. To change this, set the item's [`min-width`](min-width) or [`min-height`](min-height).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`flex-grow`](flex-grow): `0`
* [`flex-shrink`](flex-shrink): `1`
* [`flex-basis`](flex-basis): `auto`
|
| Applies to | flex items, including in-flow pseudo-elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`flex-grow`](flex-grow): as specified
* [`flex-shrink`](flex-shrink): as specified
* [`flex-basis`](flex-basis): as specified, but with relative lengths converted into absolute lengths
|
| Animation type | as each of the properties of the shorthand:* [`flex-grow`](flex-grow): a [number](number#interpolation)
* [`flex-shrink`](flex-shrink): a [number](number#interpolation)
* [`flex-basis`](flex-basis): a [length](length#interpolation), [percentage](percentage#interpolation) or calc();
|
Formal syntax
-------------
```
flex =
none [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) <'flex-grow'> <'flex-shrink'>[?](value_definition_syntax#question_mark) [||](value_definition_syntax#double_bar) <'flex-basis'> []](value_definition_syntax#brackets)
```
Examples
--------
### Setting flex: auto
#### HTML
```
<div id="flex-container">
<div class="flex-item" id="flex">Flex box (click to toggle raw box)</div>
<div class="raw-item" id="raw">Raw box</div>
</div>
```
#### CSS
```
#flex-container {
display: flex;
flex-direction: row;
}
#flex-container > .flex-item {
flex: auto;
}
#flex-container > .raw-item {
width: 5rem;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Flexible Box Layout Module Level 1 # flex-property](https://w3c.github.io/csswg-drafts/css-flexbox/#flex-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `flex` | 29
21 | 12
12 | 49
20
["Since Firefox 28, multi-line flexbox is supported.", "Before Firefox 32, Firefox wasn't able to animate values starting or stopping at `0`.", "Until Firefox 61, flex items that are sized according to their content are sized using [`fit-content`, not `max-content`](https://w3c.github.io/csswg-drafts/css-sizing-3/#column-sizing)."] | 11
["Internet Explorer 11 ignores uses of [`calc()`](https://developer.mozilla.org/docs/Web/CSS/calc) in the `flex-basis` part of the `flex` syntax. This can be worked around by using the longhand properties instead of the shorthand. See [Flexbug #8](https://github.com/philipwalton/flexbugs#8-flex-basis-doesnt-support-calc) for more info.", "Internet Explorer 11 considers a unitless value in the `flex-basis` part to be syntactically invalid (and will thus be ignored). A workaround is to always include a unit in the `flex-basis` part of the `flex` shorthand value. See [Flexbug #4](https://github.com/philipwalton/flexbugs#4-flex-shorthand-declarations-with-unitless-flex-basis-values-are-ignored) for more info."]
10
["Internet Explorer 10 and 11 ignore uses of [`calc()`](https://developer.mozilla.org/docs/Web/CSS/calc) in the `flex-basis` part of the `flex` syntax. This can be worked around by using the longhand properties instead of the shorthand. See [Flexbug #8](https://github.com/philipwalton/flexbugs#8-flex-basis-doesnt-support-calc) for more info.", "Internet Explorer 10 and 11 consider a unitless value in the `flex-basis` part to be syntactically invalid (and will thus be ignored). A workaround is to always include a unit in the `flex-basis` part of the `flex` shorthand value. See [Flexbug #4](https://github.com/philipwalton/flexbugs#4-flex-shorthand-declarations-with-unitless-flex-basis-values-are-ignored) for more info."] | 12.1 | 9
7 | ≤37
4.4 | 29
25 | 49
20
["Since Firefox 28, multi-line flexbox is supported.", "Before Firefox 32, Firefox wasn't able to animate values starting or stopping at `0`.", "Until Firefox 61, flex items that are sized according to their content are sized using [fit-content, not max-content](https://w3c.github.io/csswg-drafts/css-sizing-3/#column-sizing)."] | 12.1 | 9
7 | 2.0
1.5 |
See also
--------
* CSS Flexbox Guide: *[Basic Concepts of Flexbox](css_flexible_box_layout/basic_concepts_of_flexbox)*
* CSS Flexbox Guide: *[Controlling Ratios of flex items along the main axis](css_flexible_box_layout/controlling_ratios_of_flex_items_along_the_main_ax)*
| programming_docs |
css right right
=====
The `right` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property participates in specifying the horizontal position of a [positioned element](position). It has no effect on non-positioned elements.
Try it
------
Syntax
------
```
/\* <length> values \*/
right: 3px;
right: 2.4em;
/\* <percentage>s of the width of the containing block \*/
right: 10%;
/\* Keyword value \*/
right: auto;
/\* Global values \*/
right: inherit;
right: initial;
right: revert;
right: revert-layer;
right: unset;
```
### Values
[`<length>`](length) A negative, null, or positive [`<length>`](length) that represents:
* for *absolutely positioned elements*, the distance to the right edge of the containing block.
* for *relatively positioned elements*, the distance that the element is moved to the left of its normal position.
[`<percentage>`](percentage) A [`<percentage>`](percentage) of the containing block's width.
`auto` Specifies that:
* for *absolutely positioned elements*, the position of the element is based on the [`left`](left) property, while `width: auto` is treated as a width based on the content; or if `left` is also `auto`, the element is positioned where it should horizontally be positioned if it were a static element.
* for *relatively positioned elements*, the distance of the element from its normal position is based on the [`left`](left) property; or if `left` is also `auto`, the element is not moved horizontally at all.
`inherit` Specifies that the value is the same as the computed value from its parent element (which might not be its containing block). This computed value is then handled as if it were a [`<length>`](length), [`<percentage>`](percentage), or the `auto` keyword.
Description
-----------
The effect of `right` depends on how the element is positioned (i.e., the value of the [`position`](position) property):
* When `position` is set to `absolute` or `fixed`, the `right` property specifies the distance between the element's outer margin of right edge and the inner border of the right edge of its containing block.
* When `position` is set to `relative`, the `right` property specifies the distance the element's right edge is moved to the left from its normal position.
* When `position` is set to `sticky`, the `right` property is used to compute the sticky-constraint rectangle.
* When `position` is set to `static`, the `right` property has *no effect*.
When both [`left`](left) and `right` are defined, if not prevented from doing so by other properties, the element will stretch to satisfy both. If the element cannot stretch to satisfy both — for example, if a `width` is declared — the position of the element is *over-constrained*. When this is the case, the `left` value has precedence when the container is left-to-right; the `right` value has precedence when the container is right-to-left.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | positioned elements |
| [Inherited](inheritance) | no |
| Percentages | refer to the width of the containing block |
| [Computed value](computed_value) | if specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, `auto` |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
right =
auto [|](value_definition_syntax#single_bar)
<length-percentage>
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Absolute and relative positioning using right
#### HTML
```
<div id="relative">Relatively positioned</div>
<div id="absolute">Absolutely positioned</div>
```
#### CSS
```
#relative {
width: 100px;
height: 100px;
background-color: #ffc7e4;
position: relative;
top: 20px;
left: 20px;
}
#absolute {
width: 100px;
height: 100px;
background-color: #ffd7c2;
position: absolute;
bottom: 10px;
right: 20px;
}
```
#### Result
### Declaring both left and right
When both `left` and `right` are declared, the element will stretch to meet both, unless other constraints prevent it from doing so. If the element will not stretch or shrink to meet both. When the position of the element is *overspecified*, the precedence is based on the container's direction: The `left` will take precedence if the container's direction is left-to-right. The `right` will take precedence if the container's direction is right-to-left.
#### HTML
```
<div id="parent">
Parent
<div id="noWidth">No width</div>
<div id="width">width: 100px</div>
</div>
```
#### CSS
```
div {
outline: 1px solid #cccccc;
}
#parent {
width: 200px;
height: 200px;
background-color: #ffc7e4;
position: relative;
}
/\* declare both a left and a right \*/
#width,
#noWidth {
background-color: #c2ffd7;
position: absolute;
left: 0;
right: 0;
}
/\* declare a width \*/
#width {
width: 100px;
top: 60px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Positioned Layout Module Level 3 # insets](https://w3c.github.io/csswg-drafts/css-position/#insets) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `right` | 1 | 12 | 1 | 5.5 | 5 | 1 | 4.4 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [`inset`](inset), the shorthand for all related properties: [`top`](top), [`bottom`](bottom), [`left`](left), and [`right`](right)
* The mapped logical properties: [`inset-block-start`](inset-block-start), [`inset-block-end`](inset-block-end), [`inset-inline-start`](inset-inline-start), and [`inset-inline-end`](inset-inline-end) and the shorthands [`inset-block`](inset-block) and [`inset-inline`](inset-inline)
* [`position`](position)
css math-shift math-shift
==========
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `math-shift` property indicates whether superscripts inside MathML formulas should be raised by a normal or compact shift.
Syntax
------
```
/\* Keyword values \*/
math-shift: normal;
math-shift: compact;
/\* Global values \*/
math-shift: inherit;
math-shift: initial;
math-shift: revert;
math-shift: revert-layer;
math-shift: unset;
```
### Values
`normal` The initial value, indicates normal rendering. Superscripts in MathML formulas use the [superscriptShiftUp](https://w3c.github.io/mathml-core/#dfn-superscriptshiftup) parameter from the OpenType MATH table.
`compact` Indicates compact rendering. Superscripts in MathML formulas use the [superscriptShiftUpCramped](https://w3c.github.io/mathml-core/#dfn-superscriptshiftupcramped) parameter from the OpenType MATH table, which is generally smaller.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | all elements |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | Not animatable |
Formal syntax
-------------
```
math-shift =
normal [|](value_definition_syntax#single_bar)
compact
```
Examples
--------
### CSS
```
math {
math-shift: compact;
}
```
### MathML
The following MathML displays two versions of "x squared" using the Latin Modern Math font. Browser implementing the `math-shift` property should raise the superscripts using slightly different shifts.
```
<math style="font-size: 64pt;">
<msup style="math-shift: normal">
<mi>x</mi>
<mn>2</mn>
</msup>
<msup style="math-shift: compact">
<mi>x</mi>
<mn>2</mn>
</msup>
</math>
```
Specifications
--------------
| Specification |
| --- |
| [MathML Core # the-math-shift](https://w3c.github.io/mathml-core/#the-math-shift) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `math-shift` | 87 | 87 | No | No | 73 | No | No | 87 | No | No | No | No |
See also
--------
* [`math-depth`](math-depth)
* [`font-size`](font-size)
css scroll-margin scroll-margin
=============
The `scroll-margin` [shorthand property](shorthand_properties) sets all of the scroll margins of an element at once, assigning values much like the [`margin`](margin) property does for margins of an element.
Try it
------
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`scroll-margin-bottom`](scroll-margin-bottom)
* [`scroll-margin-left`](scroll-margin-left)
* [`scroll-margin-right`](scroll-margin-right)
* [`scroll-margin-top`](scroll-margin-top)
Syntax
------
```
/\* <length> values \*/
scroll-margin: 10px;
scroll-margin: 1em 0.5em 1em 1em;
/\* Global values \*/
scroll-margin: inherit;
scroll-margin: initial;
scroll-margin: revert;
scroll-margin: revert-layer;
scroll-margin: unset;
```
### Values
[`<length>`](length) An outset from the corresponding edge of the scroll container.
Description
-----------
You can see the effect of `scroll-margin` by scrolling to a point partway between two of the "pages" of the example's content. The value specified for `scroll-margin` determines how much of the page that's primarily outside the snapport should remain visible.
Thus, the `scroll-margin` values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`scroll-margin-bottom`](scroll-margin-bottom): `0`
* [`scroll-margin-left`](scroll-margin-left): `0`
* [`scroll-margin-right`](scroll-margin-right): `0`
* [`scroll-margin-top`](scroll-margin-top): `0`
|
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`scroll-margin-bottom`](scroll-margin-bottom): as specified
* [`scroll-margin-left`](scroll-margin-left): as specified
* [`scroll-margin-right`](scroll-margin-right): as specified
* [`scroll-margin-top`](scroll-margin-top): as specified
|
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-margin =
[<length>](length)[{1,4}](value_definition_syntax#curly_braces)
```
Examples
--------
### Simple demonstration
This example implements something very similar to the interactive example above, except that here we'll explain to you how it's implemented.
The aim here is to create four horizontally-scrolling blocks, the second and third of which snap into place, near but not quite at the left of each block.
#### HTML
The HTML that represents the blocks is very simple:
```
<div class="scroller">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
```
#### CSS
Let's walk through the CSS. The outer container is styled like this:
```
.scroller {
text-align: left;
width: 250px;
height: 250px;
overflow-x: scroll;
display: flex;
box-sizing: border-box;
border: 1px solid #000;
scroll-snap-type: x mandatory;
}
```
The main parts relevant to the scroll snapping are `overflow-x: scroll`, which makes sure the contents will scroll and not be hidden, and `scroll-snap-type: x mandatory`, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point.
The child elements are styled as follows:
```
.scroller > div {
flex: 0 0 250px;
width: 250px;
background-color: #663399;
color: #fff;
font-size: 30px;
display: flex;
align-items: center;
justify-content: center;
scroll-snap-align: start;
}
.scroller > div:nth-child(2n) {
background-color: #fff;
color: #663399;
}
```
The most relevant part here is `scroll-snap-align: start`, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap points.
Last of all we specify the scroll margin-values, a different one for the second and third child elements:
```
.scroller > div:nth-child(2) {
scroll-margin: 1rem;
}
.scroller > div:nth-child(3) {
scroll-margin: 2rem;
}
```
This means that when scrolling past the middle child elements, the scrolling will snap to `1rem` outside the left edge of the second `<div>`, and `2rems` outside the left edge of the third `<div>`.
**Note:** Here we are setting `scroll-margin` on all sides at once, but only the start edge is really relevant. It would work just as well here to only set a scroll margin on that one edge, for example with `scroll-margin-inline-start: 1rem`, or `scroll-margin: 0 0 0 1rem`.
#### Result
Try it for yourself:
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # scroll-margin](https://w3c.github.io/csswg-drafts/css-scroll-snap/#scroll-margin) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-margin` | 69 | 79 | 90
68-90
The `scroll-margin` property can cause an element's visibility to be incorrectly calculated for `element.focus()`. See [bug 1708303](https://bugzil.la/1708303). | No | 56 | 14.1
11
Before version 14.1, scroll margin is not applied for scrolls to fragment target or `scrollIntoView()`, see [bug 189265](https://webkit.org/b/189265). | 69 | 69 | 90
68-90
The `scroll-margin` property can cause an element's visibility to be incorrectly calculated for `element.focus()`. See [bug 1708303](https://bugzil.la/1708303). | 48 | 14.5
11
Before version 14.5, scroll margin is not applied for scrolls to fragment target or `scrollIntoView()`, see [bug 189265](https://webkit.org/b/189265). | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
css counters() counters()
==========
The `counters()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) enables nested counters, returning a concatenated string representing the current values of the named counters, if there are any. The `counters()` function has two forms: `counters(name, string)` or `counters(name, string, style)`. It is generally used with <pseudo-elements>, but can be used, theoretically, anywhere a [`<string>`](string) value is supported. The generated text is the value of all counters with the given name, from outermost to innermost, separated by the specified string. The counters are rendered in the style indicated, defaulting to `decimal` if no style is specified.
Try it
------
Syntax
------
```
/\* Simple usage - style defaults to decimal \*/
counters(countername, '-');
/\* changing the counter display \*/
counters(countername, '.', upper-roman)
```
A [counter](css_counter_styles/using_css_counters) has no visible effect by itself. The `counters()` function (and [`counter()`](counter) function) is what makes it useful by returning developer defined content.
### Values
[`<custom-ident>`](custom-ident) A name identifying the counters, which is the same case-sensitive name used for the [`counter-reset`](counter-reset) and [`counter-increment`](counter-increment). The name cannot start with two dashes and can't be `none`, `unset`, `initial`, or `inherit`.
`<counter-style>` A counter style name or [`symbols()`](@counter-style/symbols) function, where a counter style name is a numeric, alphabetic, or symbolic simple predefined counter style, a complex longhand east Asian or Ethiopic predefined counter style, or other [predefined counter style](css_counter_styles). If omitted, the counter-style defaults to decimal
[`<string>`](string) Any number of text characters. Non-Latin characters must be encoded using their Unicode escape sequences: for example, `\000A9` represents the copyright symbol.
### Formal syntax
```
<counters()> =
counters( [<counter-name>](counter-name) , [<string>](string) , <counter-style>[?](value_definition_syntax#question_mark) )
<counter-style> =
[<counter-style-name>](counter-style-name) [|](value_definition_syntax#single_bar)
<symbols()>
<symbols()> =
symbols( <symbols-type>[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) [<string>](string) [|](value_definition_syntax#single_bar) <image> []](value_definition_syntax#brackets)[+](value_definition_syntax#plus) )
<symbols-type> =
cyclic [|](value_definition_syntax#single_bar)
numeric [|](value_definition_syntax#single_bar)
alphabetic [|](value_definition_syntax#single_bar)
symbolic [|](value_definition_syntax#single_bar)
fixed
<image> =
<url> [|](value_definition_syntax#single_bar)
[<gradient>](gradient)
<url> =
url( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) ) [|](value_definition_syntax#single_bar)
src( [<string>](string) [<url-modifier>](url-modifier)[\*](value_definition_syntax#asterisk) )
```
Examples
--------
### default value compared to upper Roman
#### HTML
```
<ol>
<li>
<ol>
<li></li>
<li></li>
<li></li>
</ol>
</li>
<li></li>
<li></li>
<li>
<ol>
<li></li>
<li>
<ol>
<li></li>
<li></li>
<li></li>
</ol>
</li>
</ol>
</li>
</ol>
```
#### CSS
```
ol {
counter-reset: listCounter;
}
li {
counter-increment: listCounter;
}
li::marker {
content: counters(listCounter, ".", upper-roman) ") ";
}
li::before {
content: counters(listCounter, ".") " == " counters(
listCounter,
".",
lower-roman
);
}
```
#### Result
### decimal-leading-zero compared to lower-alpha
#### HTML
```
<ol>
<li>
<ol>
<li></li>
<li></li>
<li></li>
</ol>
</li>
<li></li>
<li></li>
<li>
<ol>
<li></li>
<li>
<ol>
<li></li>
<li></li>
<li></li>
</ol>
</li>
</ol>
</li>
</ol>
```
#### CSS
```
ol {
counter-reset: count;
}
li {
counter-increment: count;
}
li::marker {
content: counters(count, ".", upper-alpha) ") ";
}
li::before {
content: counters(count, ".", decimal-leading-zero) " == " counters(
count,
".",
lower-alpha
);
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Lists and Counters Module Level 3 # counter-functions](https://w3c.github.io/csswg-drafts/css-lists/#counter-functions) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `counters` | 1 | 12 | 1.5 | 8 | 10 | 3 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
See also
--------
* [Using CSS Counters](css_counter_styles/using_css_counters)
* [`counter-set`](counter-set)
* [`counter-reset`](counter-reset)
* [`counter-increment`](counter-increment)
* [`@counter-style`](@counter-style)
* CSS [`counter()`](counter) function
* [`::marker`](::marker)
| programming_docs |
css ::cue ::cue
=====
The `::cue` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-element](pseudo-elements) matches [WebVTT](https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API) cues within a selected element. This can be used to [style captions and other cues](https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API#styling_webtt_cues) in media with VTT tracks.
Try it
------
The properties are applied to the entire set of cues as if they were a single unit. The only exception is that `background` and its longhand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media.
Syntax
------
```
::cue | ::cue( <selector> )
```
Permitted properties
--------------------
Rules whose selectors include this element may only use the following CSS properties:
* [`background`](background)
* [`background-attachment`](background-attachment)
* [`background-clip`](background-clip)
* [`background-color`](background-color)
* [`background-image`](background-image)
* [`background-origin`](background-origin)
* [`background-position`](background-position)
* [`background-repeat`](background-repeat)
* [`background-size`](background-size)
* [`color`](color)
* [`font`](font)
* [`font-family`](font-family)
* [`font-size`](font-size)
* [`font-stretch`](font-stretch)
* [`font-style`](font-style)
* [`font-variant`](font-variant)
* [`font-weight`](font-weight)
* [`line-height`](line-height)
* [`opacity`](opacity)
* [`outline`](outline)
* [`outline-color`](outline-color)
* [`outline-style`](outline-style)
* [`outline-width`](outline-width)
* [`ruby-position`](ruby-position)
* [`text-combine-upright`](text-combine-upright)
* [`text-decoration`](text-decoration)
* [`text-decoration-color`](text-decoration-color)
* [`text-decoration-line`](text-decoration-line)
* [`text-decoration-style`](text-decoration-style)
* [`text-decoration-thickness`](text-decoration-thickness)
* [`text-shadow`](text-shadow)
* [`visibility`](visibility)
* [`white-space`](white-space)
Examples
--------
### Styling WebVTT cues as white-on-black
The following CSS sets the cue style so that the text is white and the background is a translucent black box.
```
::cue {
color: #fff;
background-color: rgba(0, 0, 0, 0.6);
}
```
Specifications
--------------
| Specification |
| --- |
| [WebVTT: The Web Video Text Tracks Format # the-cue-pseudo-element](https://w3c.github.io/webvtt/#the-cue-pseudo-element) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `::cue` | 26 | 79 | 55
From Firefox 69, only allowed properties apply to the `::cue` pseudo-element with no argument. See [Permitted properties](https://developer.mozilla.org/docs/Web/CSS/::cue#Permitted_properties) for a list of the allowed properties. | No | 15 | 7 | 4.4 | 26 | 55 | 14 | 7 | 1.5 |
| `selector_argument` | 26 | 79 | No | No | 15 | 7 | 4.4 | 26 | No | 14 | 7 | 1.5 |
See also
--------
* [Web Video Tracks Format (WebVTT)](https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API)
* [`<track>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track), [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video)
css outline-width outline-width
=============
The [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) `outline-width` property sets the thickness of an element's outline. An outline is a line that is drawn around an element, outside the [`border`](border).
Try it
------
It is often more convenient to use the shorthand property [`outline`](outline) when defining the appearance of an outline.
Syntax
------
```
/\* Keyword values \*/
outline-width: thin;
outline-width: medium;
outline-width: thick;
/\* <length> values \*/
outline-width: 1px;
outline-width: 0.1em;
/\* Global values \*/
outline-width: inherit;
outline-width: initial;
outline-width: revert;
outline-width: revert-layer;
outline-width: unset;
```
The `outline-width` property is specified as any one of the values listed below.
### Values
[`<length>`](length) The width of the outline specified as a `<length>`.
`thin` Depends on the user agent. Typically equivalent to `1px` in desktop browsers (including Firefox).
`medium` Depends on the user agent. Typically equivalent to `3px` in desktop browsers (including Firefox).
`thick` Depends on the user agent. Typically equivalent to `5px` in desktop browsers (including Firefox).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `medium` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | an absolute length; if the keyword `none` is specified, the computed value is `0` |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
outline-width =
<line-width>
<line-width> =
[<length [0,∞]>](length) [|](value_definition_syntax#single_bar)
thin [|](value_definition_syntax#single_bar)
medium [|](value_definition_syntax#single_bar)
thick
```
Examples
--------
### Setting an element's outline width
#### HTML
```
<span id="thin">thin</span>
<span id="medium">medium</span>
<span id="thick">thick</span>
<span id="twopixels">2px</span>
<span id="oneex">1ex</span>
<span id="em">1.2em</span>
```
#### CSS
```
span {
outline-style: solid;
display: inline-block;
margin: 20px;
}
#thin {
outline-width: thin;
}
#medium {
outline-width: medium;
}
#thick {
outline-width: thick;
}
#twopixels {
outline-width: 2px;
}
#oneex {
outline-width: 1ex;
}
#em {
outline-width: 1.2em;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Basic User Interface Module Level 4 # outline-width](https://w3c.github.io/csswg-drafts/css-ui/#outline-width) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `outline-width` | 1 | 12 | 1.5
Before Firefox 88, an outline does not follow the shape of `border-radius`.
1-3.6 | 8 | 7 | 1.2 | 37 | 18 | 4
Before Firefox 88, an outline does not follow the shape of `border-radius`. | 14 | 1 | 1.0 |
See also
--------
* [`outline`](outline)
* [`outline-color`](outline-color)
* [`outline-style`](outline-style)
css min-block-size min-block-size
==============
The `min-block-size` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the minimum horizontal or vertical size of an element's block, depending on its writing mode. It corresponds to either the [`min-width`](min-width) or the [`min-height`](min-height) property, depending on the value of [`writing-mode`](writing-mode).
If the writing mode is vertically oriented, the value of `min-block-size` relates to the minimum width of the element; otherwise, it relates to the minimum height of the element. A related property is [`min-inline-size`](min-inline-size), which defines the other dimension of the element.
Try it
------
Syntax
------
```
/\* <length> values \*/
min-block-size: 100px;
min-block-size: 5em;
/\* <percentage> values \*/
min-block-size: 10%;
/\* Keyword values \*/
min-block-size: max-content;
min-block-size: min-content;
min-block-size: fit-content(20em);
/\* Global values \*/
min-block-size: inherit;
min-block-size: initial;
min-block-size: revert;
min-block-size: revert-layer;
min-block-size: unset;
```
### Values
The `min-block-size` property takes the same values as the [`min-width`](min-width) and [`min-height`](min-height) properties.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | same as [`width`](width) and [`height`](height) |
| [Inherited](inheritance) | no |
| Percentages | block-size of containing block |
| [Computed value](computed_value) | same as [`min-width`](min-width) and [`min-height`](min-height) |
| Animation type | a [length](length#interpolation), [percentage](percentage#interpolation) or calc(); |
Formal syntax
-------------
```
min-block-size =
<'min-width'>
```
Examples
--------
### Setting minimum block size for vertical text
#### HTML
```
<p class="exampleText">Example text</p>
```
#### CSS
```
.exampleText {
writing-mode: vertical-rl;
background-color: yellow;
min-block-size: 200px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # propdef-min-block-size](https://w3c.github.io/csswg-drafts/css-logical/#propdef-min-block-size) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `min-block-size` | 57 | 79 | 41 | No | 44 | 12.1 | 57 | 57 | 41 | 43 | 12.2 | 7.0 |
| `fit-content` | 57 | 79 | No | No | 44 | 12.1 | 57 | 57 | No | 43 | 12.2 | 7.0 |
| `fit-content_function` | No | No | 91 | No | No | No | No | No | No | No | No | No |
| `max-content` | 57 | 79 | 66
41 | No | 44 | 12.1 | 57 | 57 | 66
41 | 43 | 12.2 | 7.0 |
| `min-content` | 57 | 79 | 66
41 | No | 44 | 12.1 | 57 | 57 | 66
41 | 43 | 12.2 | 7.0 |
See also
--------
* The mapped physical properties: [`min-width`](min-width) and [`min-height`](min-height)
* [`writing-mode`](writing-mode)
css object-position object-position
===============
The `object-position` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property specifies the alignment of the selected [replaced element](replaced_element)'s contents within the element's box. Areas of the box which aren't covered by the replaced element's object will show the element's background.
You can adjust how the replaced element's object's intrinsic size (that is, its natural size) is adjusted to fit within the element's box using the [`object-fit`](object-fit) property.
Try it
------
Syntax
------
```
/\* Keyword values \*/
object-position: top;
object-position: bottom;
object-position: left;
object-position: right;
object-position: center;
/\* <percentage> values \*/
object-position: 25% 75%;
/\* <length> values \*/
object-position: 0 0;
object-position: 1cm 2cm;
object-position: 10ch 8em;
/\* Edge offsets values \*/
object-position: bottom 10px right 20px;
object-position: right 3em bottom 10px;
object-position: top 0 right 10px;
/\* Global values \*/
object-position: inherit;
object-position: initial;
object-position: revert;
object-position: revert-layer;
object-position: unset;
```
### Values
[`<position>`](position_value) From one to four values that define the 2D position of the element. Relative or absolute offsets can be used.
**Note:** The position can be set so that the replaced element is drawn outside its box.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `50% 50%` |
| Applies to | replaced elements |
| [Inherited](inheritance) | yes |
| Percentages | refer to width and height of element itself |
| [Computed value](computed_value) | as specified |
| Animation type | repeatable list of simple list of length, percentage, or calc |
Formal syntax
-------------
```
object-position =
<position>
<position> =
[[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) right []](value_definition_syntax#brackets) [||](value_definition_syntax#double_bar) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) bottom []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) right [|](value_definition_syntax#single_bar) <length-percentage> []](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) bottom [|](value_definition_syntax#single_bar) <length-percentage> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) right []](value_definition_syntax#brackets) <length-percentage> []](value_definition_syntax#brackets) [&&](value_definition_syntax#double_ampersand) [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) bottom []](value_definition_syntax#brackets) <length-percentage> []](value_definition_syntax#brackets)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Positioning image content
#### HTML
Here we see HTML that includes two [`<img>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) elements, each displaying the MDN logo.
```
<img id="object-position-1" src="mdn.svg" alt="MDN Logo" />
<img id="object-position-2" src="mdn.svg" alt="MDN Logo" />
```
#### CSS
The CSS includes default styling for the `<img>` element itself, as well as separate styles for each of the two images.
```
img {
width: 300px;
height: 250px;
border: 1px solid black;
background-color: silver;
margin-right: 1em;
object-fit: none;
}
#object-position-1 {
object-position: 10px;
}
#object-position-2 {
object-position: 100% 10%;
}
```
The first image is positioned with its left edge inset 10 pixels from the left edge of the element's box. The second image is positioned with its right edge flush against the right edge of the element's box and is located 10% of the way down the height of the element's box.
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Images Module Level 3 # the-object-position](https://w3c.github.io/csswg-drafts/css-images/#the-object-position) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `object-position` | 32 | 79
16-79
Only supported for `<img>` elements. | 36 | No | 19
11.6-15 | 10 | 4.4.3 | 32 | 36 | 19
12-14 | 10 | 2.0 |
See also
--------
* Other image-related CSS properties: [`object-fit`](object-fit), [`image-orientation`](image-orientation), [`image-rendering`](image-rendering), [`image-resolution`](image-resolution).
css @font-face @font-face
==========
The `@font-face` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) <at-rule> specifies a custom font with which to display text; the font can be loaded from either a remote server or a locally-installed font on the user's own computer.
Syntax
------
```
@font-face {
font-family: "Trickster";
src: local("Trickster"),
url("trickster-COLRv1.otf") format("opentype") tech(color-COLRv1), url("trickster-outline.otf")
format("opentype"), url("trickster-outline.woff") format("woff");
}
```
### Descriptors
[`ascent-override`](@font-face/ascent-override) Defines the ascent metric for the font.
[`descent-override`](@font-face/descent-override) Defines the descent metric for the font.
[`font-display`](@font-face/font-display) Determines how a font face is displayed based on whether and when it is downloaded and ready to use.
[`font-family`](@font-face/font-family) Specifies a name that will be used as the font face value for font properties.
[`font-stretch`](@font-face/font-stretch) A [`font-stretch`](font-stretch) value. Accepts two values to specify a range that is supported by a font-face, for example `font-stretch: 50% 200%;`
[`font-style`](@font-face/font-style) A [`font-style`](font-style) value. Accepts two values to specify a range that is supported by a font-face, for example `font-style: oblique 20deg 50deg;`
[`font-weight`](@font-face/font-weight) A [`font-weight`](font-weight) value. Accepts two values to specify a range that is supported by a font-face, for example `font-weight: 100 400;`
**Note:** The font-variant descriptor was removed from the specification in 2018. The [`font-variant`](font-variant) value property is supported, but there is no descriptor equivalent.
[`font-feature-settings`](font-feature-settings) Allows control over advanced typographic features in OpenType fonts.
[`font-variation-settings`](@font-face/font-variation-settings) Allows low-level control over OpenType or TrueType font variations, by specifying the four letter axis names of the features to vary, along with their variation values.
[`line-gap-override`](@font-face/line-gap-override) Defines the line gap metric for the font.
[`size-adjust`](@font-face/size-adjust) Defines a multiplier for glyph outlines and metrics associated with this font. This makes it easier to harmonize the designs of various fonts when rendered at the same font size.
[`src`](@font-face/src) Specifies font resources.
A comma-separated list representing the resource fallback order, where each resource is specified using `url()` or `local()`. The first resource in the list that loads successfully will be used and subsequent items are ignored. If multiple `src` descriptors are set, only the last declared rule that is able to load a resource is applied.
**Note:** Items that the browser considers invalid are ignored. Some browsers will ignore the whole descriptor if any item is invalid, even if only one item is invalid. This may affect design of your fallbacks.
The `url()` can be followed by `format()` and `tech()`, like this:
```
src: local("Trickster"),
url("trickster-COLRv1.otf") format("opentype") tech(color-COLRv1), url("trickster-outline.otf")
format("opentype"), url("trickster-outline.woff") format("woff");
```
`url()`: Specifies the URL of a font file, like any other `url()` in CSS. If the font file is a container for multiple fonts, a fragment identifier is included to indicate which sub-font should be used, as follows:
```
src: url(collection.otc#WhichFont); /\* WhichFont is the PostScript name of a font in the font file \*/
src: url(fonts.svg#WhichFont); /\* WhichFont is the element id of a font in the SVG Font file \*/
```
`local()`: Specifies the font name should the font be available on the user's device. Quoting the font name is optional.
**Note:** The [Local Font Access API](https://developer.mozilla.org/en-US/docs/Web/API/Local_Font_Access_API) can be used to access the user's locally installed font data — this includes higher-level details such as names, styles, and families, as well as the raw bytes of the underlying font files.
`format()`: **Optional**. Specifies the font format. If the value is not supported or invalid, the browser may not download the resource, potentially saving bandwidth. If omitted, the browser will always download the resource and then detect the format. The preferred value type is a *keyword*, which can also be given as a *string* (within quotes) for backward compatibility reasons.
The following table shows the valid values and their corresponding font formats. There are a few other possible values, see next paragraph.
| Keyword | Font Format | Common extensions |
| --- | --- | --- |
| `woff2` | WOFF 2.0 | .woff2 |
| `woff` | WOFF 1.0 | .woff |
| `opentype` | OpenType | .otf, .ttf |
| `truetype` | TrueType | .ttf |
| `collection` | OpenType Collection | .otc, .ttc |
| `embedded-opentype` | Embedded OpenType | .eot |
| `svg` | SVG Font (deprecated) | .svg, .svgz |
**Note:** The values `opentype` and `truetype` are completely equivalent, regardless of whether the font file uses cubic bezier curves (within CFF/CFF2 table) or quadratic bezier curves (within glyph table).
`tech()`: **Optional**. Experimental Value is one of the following *keywords*: `variations`, `palettes`, `incremental`, `features-opentype`, `features-aat`, `features-graphite`, `color-COLRv0`, `color-COLRv1`, `color-SVG`, `color-sbix`, `color-CBDT`.
The following table shows several old unnormalized `format()` values and their new equivalent syntax:
| Old syntax | Equivalent syntax |
| --- | --- |
| `format("woff2-variations")` | `format(woff2) tech(variations)` |
| `format("woff-variations")` | `format(woff) tech(variations)` |
| `format("opentype-variations")` | `format(opentype) tech(variations)` |
| `format("truetype-variations")` | `format(truetype) tech(variations)` |
**Note:** `format(svg)` stands for [SVG fonts](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_fonts), and `tech(color-SVG)` stands for [OpenType fonts with SVG table](https://learn.microsoft.com/en-us/typography/opentype/spec/svg) (also called OpenType-SVG color fonts), which are completely different.
[`unicode-range`](@font-face/unicode-range) The range of Unicode code points to be used from the font.
Description
-----------
It's common to use both `url()` and `local()` together, so that the user's installed copy of the font is used if available, falling back to downloading a copy of the font if it's not found on the user's device.
If the `local()` function is provided, specifying a font name to look for on the user's device, and if the [user agent](https://developer.mozilla.org/en-US/docs/Glossary/User_agent) finds a match, that local font is used. Otherwise, the font resource specified using the `url()` function is downloaded and used.
Browsers attempt to load resources in their list declaration order, so usually `local()` should be written before `url()`. Both functions are optional, so a rule block containing only one or more `local()` without `url()` is possible. If a more specific fonts with `format()` or `tech()` values are desired, these should be listed *before* versions that don't have these values, as the less-specific variant would otherwise be tried and used first.
By allowing authors to provide their own fonts, `@font-face` makes it possible to design content without being limited to the so-called "web-safe" fonts (that is, the fonts which are so common that they're considered to be universally available). The ability to specify the name of a locally-installed font to look for and use makes it possible to customize the font beyond the basics while making it possible to do so without relying on an Internet connection.
The `@font-face` at-rule may be used not only at the top level of a CSS, but also inside any [CSS conditional-group at-rule](at-rule#conditional_group_rules).
### Font MIME Types
| Format | MIME type |
| --- | --- |
| TrueType | `font/ttf` |
| OpenType | `font/otf` |
| Web Open Font Format | `font/woff` |
| Web Open Font Format 2 | `font/woff2` |
### Notes
* Web fonts are subject to the same domain restriction (font files must be on the same domain as the page using them), unless [HTTP access controls](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) are used to relax this restriction.
* `@font-face` cannot be declared within a CSS selector. For example, the following will not work:
```
.className {
@font-face {
font-family: "MyHelvetica";
src: local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"),
url("MgOpenModernaBold.ttf");
font-weight: bold;
}
}
```
Formal syntax
-------------
```
@font-face =
@font-face { [<declaration-list>](declaration-list) }
```
Examples
--------
### Specifying a downloadable font
This example specifies a downloadable font to use, applying it to the entire body of the document:
```
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Web Font Sample</title>
<style media="screen, print">
@font-face {
font-family: "Bitstream Vera Serif Bold";
src: url("https://mdn.github.io/css-examples/web-fonts/VeraSeBd.ttf");
}
body {
font-family: "Bitstream Vera Serif Bold", serif;
}
</style>
</head>
<body>
This is Bitstream Vera Serif Bold.
</body>
</html>
```
The output of this example code looks like so:
### Specifying local font alternatives
In this example, the user's local copy of "Helvetica Neue Bold" is used; if the user does not have that font installed (two different names are tried), then the downloadable font named "MgOpenModernaBold.ttf" is used instead:
```
@font-face {
font-family: "MyHelvetica";
src: local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"),
url("MgOpenModernaBold.ttf");
font-weight: bold;
}
```
### Fallbacks on older browsers
Browsers should use a `@font-face` with a single `src` descriptor listing possible sources for the font. Since the browser will use the first resource that it is able to load, items should be specified in the order that you'd most like them to be used.
Generally this means that local files should appear before remote files, and that resources with `format()` or `tech()` constraints should appear before resources that don't have them (otherwise the less-constrained version would always be selected). For example:
```
@font-face {
font-family: "MgOpenModernaBold";
src: url("MgOpenModernaBoldIncr.otf") format("opentype") tech(incremental), url("MgOpenModernaBold.otf") format(opentype);
}
```
A browser that does not support `tech()` above should drop the first item and attempt to load the second resource.
Some browsers do not yet [drop invalid items](#browser_compatibility), and instead fail the whole `src` descriptor if any value is invalid. If working with these browsers you can specify multiple `src` descriptors as fallbacks. Note that multiple `src` descriptors are attempted in reverse-order, so at the end we have our normal descriptor with all the items.
```
@font-face {
font-family: "MgOpenModernaBold";
src: url("MgOpenModernaBold.otf") format(opentype);
src: url("MgOpenModernaBoldIncr.otf") format("opentype") tech(incremental);
src: url("MgOpenModernaBoldIncr.otf") format("opentype") tech(incremental), url("MgOpenModernaBold.otf") format(opentype);
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Fonts Module Level 4 # font-face-rule](https://w3c.github.io/csswg-drafts/css-fonts/#font-face-rule) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `OpenType_CBDT_CBLC` | 66 | 79 | No | No | 53 | No | 66 | 66 | No | 47 | No | 9.0 |
| `OpenType_COLRv0` | 53 | 79 | 31 | No | 40 | 11.1 | 53 | 53 | 31 | 41 | 11.3 | 6.0 |
| `OpenType_COLRv1` | 98 | 98 | 105 | No | 84 | No | 98 | 98 | No | 68 | No | 18.0 |
| `OpenType_SBIX` | 66 | 79 | No | No | 53 | 9.1 | 66 | 66 | No | 47 | 9.3 | 9.0 |
| `OpenType_SVG` | No | No | 31 | No | No | 12.1 | No | No | 31 | No | 12.2 | No |
| `SVG_fonts` | 1-38 | No | No | No | 15-25 | 3.1 | ≤37-38 | 18-38 | No | 14-25 | 3 | 1.0-3.0 |
| `WOFF` | 6 | 12 | 3.5 | 9 | 11.1 | 5.1 | 4.4 | 18 | 4 | 11.1 | 5 | 1.0 |
| `WOFF_2` | 36 | 14 | 39 | No | 23 | 10
Supported only on macOS 10.12 (Sierra) and later. | 37 | 36 | 39 | 24 | 10 | 3.0 |
| `@font-face` | 1 | 12 | 3.5 | 4 | 10 | 3.1 | ≤37 | 18 | 4 | 10.1 | 2 | 1.0 |
| `ascent-override` | 87 | 87 | 89 | No | 73 | No | 87 | 87 | 89 | 62 | No | 14.0 |
| `descent-override` | 87 | 87 | 89 | No | 73 | No | 87 | 87 | 89 | 62 | No | 14.0 |
| `font-display` | 60 | 79 | 58 | No | 47 | 11.1 | 60 | 60 | 58 | 44 | 11.3 | 11.0 |
| `font-family` | 4 | 12 | 3.5 | 6 | 10 | 3.1 | 2.2 | 18 | 4 | 10.1 | 2 | 1.0 |
| `font-feature-settings` | No | No | 34
The [ISO/IEC CD 14496-22 3rd edition](https://mpeg.chiariglione.org/standards/mpeg-4/open-font-format/text-isoiec-cd-14496-22-3rd-edition) suggests using the `ssty` feature to provide glyph variants more suitable for use in scripts (for example primes used as superscripts). Starting with Firefox 29, this is done automatically by the [MathML](https://developer.mozilla.org/docs/Web/MathML) rendering engine. The ISO/IEC CD 14496-22 3rd edition also suggests applying the `dtls` feature to letters when placing mathematical accents to get dotless forms (for example dotless i, j with a hat). Starting with Firefox 35, this is done automatically by the MathML rendering engine. You can override the default values determined by the MathML rendering engine with CSS.
15
From Firefox 4 to Firefox 14 (inclusive), Firefox supported an older, slightly different syntax. See [OpenType Font Feature support in Firefox 4](https://hacks.mozilla.org/2010/11/firefox-4-font-feature-support/). | No | No | No | No | No | 34
The [ISO/IEC CD 14496-22 3rd edition](https://mpeg.chiariglione.org/standards/mpeg-4/open-font-format/text-isoiec-cd-14496-22-3rd-edition) suggests using the `ssty` feature to provide glyph variants more suitable for use in scripts (for example primes used as superscripts). Starting with Firefox 29, this is done automatically by the [MathML](https://developer.mozilla.org/docs/Web/MathML) rendering engine. The ISO/IEC CD 14496-22 3rd edition also suggests applying the `dtls` feature to letters when placing mathematical accents to get dotless forms (for example dotless i, j with a hat). Starting with Firefox 35, this is done automatically by the MathML rendering engine. You can override the default values determined by the MathML rendering engine with CSS.
15
From Firefox 4 to Firefox 14 (inclusive), Firefox supported an older, slightly different syntax. See [OpenType Font Feature support in Firefox 4](https://hacks.mozilla.org/2010/11/firefox-4-font-feature-support/). | No | No | No |
| `font-stretch` | 62 | 17 | 62 | No | 49 | 10.1 | 62 | 62 | 62 | 41 | 10.3 | 6.0 |
| `font-style` | 4 | 12 | 3.5 | 4 | 10 | 3.1 | ≤37 | 18 | 4 | 10.1 | 2 | 1.0 |
| `font-variant` | 4 | 12 | 3.5 | 4 | 10 | 3.1 | ≤37 | 18 | 4 | 10.1 | 2 | 1.0 |
| `font-variation-settings` | No | No | 62 | No | No | No | No | No | 62 | No | No | No |
| `font-weight` | 4 | 12 | 3.5 | 4 | 10 | 3.1 | ≤37 | 18 | 4 | 10.1 | 2 | 1.0 |
| `line-gap-override` | 87 | 87 | 89 | No | 73 | No | 87 | 87 | 89 | 62 | No | 14.0 |
| `size-adjust` | 92 | 92 | 92 | No | 78 | No | 92 | 92 | 92 | No | No | 16.0 |
| `src` | 4 | 12 | 3.5 | 6 | 10 | 3.1 | 2.2 | 18 | 4 | 10.1 | 2 | 1.0 |
| `unicode-range` | 1 | 12 | 36 | 9 | 15 | 3.1 | ≤37 | 18 | 36 | 14 | 3 | 1.0 |
See also
--------
* [About WOFF](https://developer.mozilla.org/en-US/docs/Web/Guide/WOFF)
* [FontSquirrel @font-face generator](https://www.fontsquirrel.com/tools/webfont-generator)
* [Beautiful fonts with @font-face](https://hacks.mozilla.org/2009/06/beautiful-fonts-with-font-face/)
* [Font Library](https://fontlibrary.org/)
| programming_docs |
css paint-order paint-order
===========
The `paint-order` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property lets you control the order in which the fill and stroke (and painting markers) of text content and shapes are drawn.
Syntax
------
```
/\* Normal \*/
paint-order: normal;
/\* Single values \*/
paint-order: stroke; /\* draw the stroke first, then fill and markers \*/
paint-order: markers; /\* draw the markers first, then fill and stroke \*/
/\* Multiple values \*/
paint-order: stroke fill; /\* draw the stroke first, then the fill, then the markers \*/
paint-order: markers stroke fill; /\* draw markers, then stroke, then fill \*/
/\* Global values \*/
paint-order: inherit;
paint-order: initial;
paint-order: revert;
paint-order: unset;
```
If no value is specified, the default paint order is `fill`, `stroke`, `markers`.
When one value is specified, that one is painted first, followed by the other two in their default order relative to one another. When two values are specified, they will be painted in the order they are specified in, followed by the unspecified one.
**Note:** In the case of this property, markers are only appropriate when drawing SVG shapes involving the use of the `marker-*` properties (e.g. [`marker-start`](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/marker-start)) and [`<marker>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker) element. They do not apply to HTML text, so in that case, you can only determine the order of `stroke` and `fill`.
### Values
`normal` Paint the different items in normal paint order.
`stroke`, `fill`, `markers` Specify some or all of these values in the order you want them to be painted in.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | text elements |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
paint-order =
normal [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) fill [||](value_definition_syntax#double_bar) stroke [||](value_definition_syntax#double_bar) markers []](value_definition_syntax#brackets)
```
Examples
--------
### Reversing the paint order of stroke and fill
#### SVG
```
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200">
<text x="10" y="75">stroke in front</text>
<text x="10" y="150" class="stroke-behind">stroke behind</text>
</svg>
```
#### CSS
```
text {
font-family: sans-serif;
font-size: 50px;
font-weight: bold;
fill: black;
stroke: red;
stroke-width: 4px;
}
.stroke-behind {
paint-order: stroke fill;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Scalable Vector Graphics (SVG) 2 # PaintOrder](https://svgwg.org/svg2-draft/painting.html#PaintOrder) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `paint-order` | 35 | 17 | 60 | No | 22 | 8 | 37 | 35 | 60 | 22 | 8 | 3.0 |
See also
--------
* [CSS Tricks: paint-order](https://css-tricks.com/almanac/properties/p/paint-order/)
css fit-content fit-content
===========
The `fit-content` behaves as `fit-content(stretch)`. In practice this means that the box will use the available space, but never more than [`max-content`](max-content).
When used as laid out box size for [`width`](width), [`height`](height), [`min-width`](min-width), [`min-height`](min-height), [`max-width`](max-width) and [`max-height`](max-height) the maximum and minimum sizes refer to the content size.
**Note:** The CSS Sizing specification also defines the [`fit-content()`](fit-content_function) function. This page details the keyword.
Syntax
------
```
width: fit-content;
block-size: fit-content;
```
Examples
--------
### Using fit-content for box sizing
#### HTML
```
<div class="container">
<div class="item">Item</div>
<div class="item">Item with more text in it.</div>
<div class="item">
Item with more text in it, hopefully we have added enough text so the text
will start to wrap.
</div>
</div>
```
#### CSS
```
.container {
border: 2px solid #ccc;
padding: 10px;
width: 20em;
}
.item {
width: -moz-fit-content;
width: fit-content;
background-color: #8ca0ff;
padding: 5px;
margin-bottom: 1em;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Box Sizing Module Level 4 # valdef-width-fit-content](https://w3c.github.io/csswg-drafts/css-sizing-4/#valdef-width-fit-content) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `fit-content` | 46
22
1-48 | 79
79 | 94
3 | No | 33
15
15-35 | 11
7
2 | 46
4.4
4.4-48 | 46
25
18-48 | 94
4 | 33
14
14-35 | 11
7
1 | 5.0
1.5
1.0-5.0 |
See also
--------
* Related sizing keywords: [`min-content`](min-content), [`max-content`](max-content)
css border-inline-style border-inline-style
===================
The `border-inline-style` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines the style of the logical inline borders of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. It corresponds to the [`border-top-style`](border-top-style) and [`border-bottom-style`](border-bottom-style), or [`border-left-style`](border-left-style) and [`border-right-style`](border-right-style) properties depending on the values defined for [`writing-mode`](writing-mode), [`direction`](direction), and [`text-orientation`](text-orientation).
Try it
------
The border style in the other dimension can be set with [`border-block-style`](border-block-style), which sets [`border-block-start-style`](border-block-start-style), and [`border-block-end-style`](border-block-end-style).
Syntax
------
```
/\* <'border-style'> values \*/
border-inline-style: dashed;
border-inline-style: dotted;
border-inline-style: groove;
/\* Global values \*/
border-inline-style: inherit;
border-inline-style: initial;
border-inline-style: revert;
border-inline-style: revert-layer;
border-inline-style: unset;
```
### Values
`<'border-style'>` The line style of the border. See [`border-style`](border-style).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
border-inline-style =
<'border-top-style'>[{1,2}](value_definition_syntax#curly_braces)
```
Examples
--------
### HTML Content
```
<div>
<p class="exampleText">Example text</p>
</div>
```
### CSS Content
```
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-lr;
border: 5px solid blue;
border-inline-style: dashed;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Logical Properties and Values Level 1 # propdef-border-inline-style](https://w3c.github.io/csswg-drafts/css-logical/#propdef-border-inline-style) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-inline-style` | 87 | 87 | 66 | No | 73 | 14.1 | 87 | 87 | 66 | 62 | 14.5 | 14.0 |
See also
--------
* [CSS Logical Properties and Values](css_logical_properties)
* This property maps to one of the physical border properties: [`border-top-style`](border-top-style), [`border-right-style`](border-right-style), [`border-bottom-style`](border-bottom-style), or [`border-left-style`](border-left-style).
* [`writing-mode`](writing-mode), [`direction`](direction), [`text-orientation`](text-orientation)
css mix-blend-mode mix-blend-mode
==============
The `mix-blend-mode` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets how an element's content should blend with the content of the element's parent and the element's background.
Try it
------
Syntax
------
```
/\* Keyword values \*/
mix-blend-mode: normal;
mix-blend-mode: multiply;
mix-blend-mode: screen;
mix-blend-mode: overlay;
mix-blend-mode: darken;
mix-blend-mode: lighten;
mix-blend-mode: color-dodge;
mix-blend-mode: color-burn;
mix-blend-mode: hard-light;
mix-blend-mode: soft-light;
mix-blend-mode: difference;
mix-blend-mode: exclusion;
mix-blend-mode: hue;
mix-blend-mode: saturation;
mix-blend-mode: color;
mix-blend-mode: luminosity;
/\* Global values \*/
mix-blend-mode: inherit;
mix-blend-mode: initial;
mix-blend-mode: revert;
mix-blend-mode: revert-layer;
mix-blend-mode: unset;
```
### Values
[`<blend-mode>`](blend-mode) The blending mode that should be applied.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `normal` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
| Creates [stacking context](css_positioning/understanding_z_index/the_stacking_context) | yes |
Formal syntax
-------------
```
mix-blend-mode =
<blend-mode> [|](value_definition_syntax#single_bar)
plus-darker [|](value_definition_syntax#single_bar)
plus-lighter
<blend-mode> =
normal [|](value_definition_syntax#single_bar)
multiply [|](value_definition_syntax#single_bar)
screen [|](value_definition_syntax#single_bar)
overlay [|](value_definition_syntax#single_bar)
darken [|](value_definition_syntax#single_bar)
lighten [|](value_definition_syntax#single_bar)
color-dodge [|](value_definition_syntax#single_bar)
color-burn [|](value_definition_syntax#single_bar)
hard-light [|](value_definition_syntax#single_bar)
soft-light [|](value_definition_syntax#single_bar)
difference [|](value_definition_syntax#single_bar)
exclusion [|](value_definition_syntax#single_bar)
hue [|](value_definition_syntax#single_bar)
saturation [|](value_definition_syntax#single_bar)
color [|](value_definition_syntax#single_bar)
luminosity
```
Examples
--------
### Effect of different mix-blend-mode values
### Using mix-blend-mode with HTML
#### HTML
```
<div class="isolate">
<div class="circle circle-1"></div>
<div class="circle circle-2"></div>
<div class="circle circle-3"></div>
</div>
```
#### CSS
```
.circle {
width: 80px;
height: 80px;
border-radius: 50%;
mix-blend-mode: screen;
position: absolute;
}
.circle-1 {
background: red;
}
.circle-2 {
background: lightgreen;
left: 40px;
}
.circle-3 {
background: blue;
left: 20px;
top: 40px;
}
.isolate {
isolation: isolate; /\* Without isolation, the background color will be taken into account \*/
position: relative;
}
```
#### Result
### Using mix-blend-mode with SVG
#### SVG
```
<svg>
<g class="isolate">
<circle cx="40" cy="40" r="40" fill="red" />
<circle cx="80" cy="40" r="40" fill="lightgreen" />
<circle cx="60" cy="80" r="40" fill="blue" />
</g>
</svg>
```
#### CSS
```
circle {
mix-blend-mode: screen;
}
.isolate {
isolation: isolate;
} /\* Without isolation, the background color will be taken into account \*/
```
#### Result
### Using mix-blend-mode with text
This example uses `mix-blend-mode` to blend text color with the background color of its parent element.
#### HTML
```
<div class="container">
<p>Mostly Harmless</p>
<p class="multiply">Mostly Harmless</p>
<p class="screen">Mostly Harmless</p>
<p class="hard-light">Mostly Harmless</p>
</div>
```
#### CSS
```
@import url("https://fonts.googleapis.com/css2?family=Rubik+Moonrocks&display=swap");
.container {
background-color: blue;
}
p {
font: 4rem "Rubik Moonrocks", cursive;
font-weight: bold;
color: orange;
padding: 0.5rem;
margin: 0;
}
.multiply {
mix-blend-mode: multiply;
}
.screen {
mix-blend-mode: screen;
}
.hard-light {
mix-blend-mode: hard-light;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Compositing and Blending Level 1 # mix-blend-mode](https://drafts.fxtf.org/compositing/#mix-blend-mode) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `mix-blend-mode` | 41 | 79 | 32 | No | 28 | 8 | 41 | 41 | 32 | 28 | 8 | 4.0 |
| `plus-lighter` | 100 | 100 | 99 | No | No | 9.1 | 100 | 100 | 99 | No | 9.3 | 19.0 |
| `svg` | 41 | 79 | 32 | No | 28 | No | No | No | 32 | No | No | No |
See also
--------
* [`<blend-mode>`](blend-mode)
* [`background-blend-mode`](background-blend-mode)
css Attribute selectors Attribute selectors
===================
The CSS **attribute selector** matches elements based on the presence or value of a given attribute.
```
/\* <a> elements with a title attribute \*/
a[title] {
color: purple;
}
/\* <a> elements with an href matching "https://example.org" \*/
a[href="https://example.org"]
{
color: green;
}
/\* <a> elements with an href containing "example" \*/
a[href\*="example"] {
font-size: 2em;
}
/\* <a> elements with an href ending ".org" \*/
a[href$=".org"] {
font-style: italic;
}
/\* <a> elements whose class attribute contains the word "logo" \*/
a[class~="logo"] {
padding: 2px;
}
```
Syntax
------
`[attr]` Represents elements with an attribute name of *attr*.
`[attr=value]` Represents elements with an attribute name of *attr* whose value is exactly *value*.
`[attr~=value]` Represents elements with an attribute name of *attr* whose value is a whitespace-separated list of words, one of which is exactly *value*.
`[attr|=value]` Represents elements with an attribute name of *attr* whose value can be exactly *value* or can begin with *value* immediately followed by a hyphen, `-` (U+002D). It is often used for language subcode matches.
`[attr^=value]` Represents elements with an attribute name of *attr* whose value is prefixed (preceded) by *value*.
`[attr$=value]` Represents elements with an attribute name of *attr* whose value is suffixed (followed) by *value*.
`[attr*=value]` Represents elements with an attribute name of *attr* whose value contains at least one occurrence of *value* within the string.
`[attr operator value i]` Adding an `i` (or `I`) before the closing bracket causes the value to be compared case-insensitively (for characters within the ASCII range).
`[attr operator value s]` Experimental
Adding an `s` (or `S`) before the closing bracket causes the value to be compared case-sensitively (for characters within the ASCII range).
Examples
--------
### Links
#### CSS
```
a {
color: blue;
}
/\* Internal links, beginning with "#" \*/
a[href^="#"] {
background-color: gold;
}
/\* Links with "example" anywhere in the URL \*/
a[href\*="example"] {
background-color: silver;
}
/\* Links with "insensitive" anywhere in the URL,
regardless of capitalization \*/
a[href\*="insensitive" i] {
color: cyan;
}
/\* Links with "cAsE" anywhere in the URL,
with matching capitalization \*/
a[href\*="cAsE" s] {
color: pink;
}
/\* Links that end in ".org" \*/
a[href$=".org"] {
color: red;
}
/\* Links that start with "https" and end in ".org" \*/
a[href^="https"][href$=".org"] {
color: green;
}
```
#### HTML
```
<ul>
<li><a href="#internal">Internal link</a></li>
<li><a href="http://example.com">Example link</a></li>
<li><a href="#InSensitive">Insensitive internal link</a></li>
<li><a href="http://example.org">Example org link</a></li>
<li><a href="https://example.org">Example https org link</a></li>
</ul>
```
#### Result
### Languages
#### CSS
```
/\* All divs with a `lang` attribute are bold. \*/
div[lang] {
font-weight: bold;
}
/\* All divs without a `lang` attribute are italicized. \*/
div:not([lang]) {
font-style: italic;
}
/\* All divs in US English are blue. \*/
div[lang~="en-us"] {
color: blue;
}
/\* All divs in Portuguese are green. \*/
div[lang="pt"] {
color: green;
}
/\* All divs in Chinese are red, whether
simplified (zh-CN) or traditional (zh-TW). \*/
div[lang|="zh"] {
color: red;
}
/\* All divs with a Traditional Chinese
`data-lang` are purple. \*/
/\* Note: You could also use hyphenated attributes
without double quotes \*/
div[data-lang="zh-TW"] {
color: purple;
}
```
#### HTML
```
<div lang="en-us en-gb en-au en-nz">Hello World!</div>
<div lang="pt">Olá Mundo!</div>
<div lang="zh-CN">世界您好!</div>
<div lang="zh-TW">世界您好!</div>
<div data-lang="zh-TW">世界您好!</div>
```
#### Result
### HTML ordered lists
The HTML specification requires the [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type) attribute to be matched case-insensitively because it is primarily used in the [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) element. Note that if the modifiers are not supported by the user agent, then the selector will not match.
#### CSS
```
/\* Case-sensitivity depends on document language \*/
ol[type="a"] {
list-style-type: lower-alpha;
background: red;
}
ol[type="b" s] {
list-style-type: lower-alpha;
background: lime;
}
ol[type="B" s] {
list-style-type: upper-alpha;
background: grey;
}
ol[type="c" i] {
list-style-type: upper-alpha;
background: green;
}
```
#### HTML
```
<ol type="A">
<li>
Red background for case-insensitive matching (default for the type selector)
</li>
</ol>
<ol type="b">
<li>Lime background if `s` modifier is supported (case-sensitive match)</li>
</ol>
<ol type="B">
<li>Grey background if `s` modifier is supported (case-sensitive match)</li>
</ol>
<ol type="C">
<li>
Green background if `i` modifier is supported (case-insensitive match)
</li>
</ol>
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # attribute-selectors](https://w3c.github.io/csswg-drafts/selectors/#attribute-selectors) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `Attribute_selectors` | 1 | 12 | 1 | 7 | 9 | 3 | ≤37 | 18 | 4 | 14 | 1 | 1.0 |
| `case_insensitive_modifier` | 49 | 79 | 47 | No | 36 | 9 | 49 | 49 | 47 | 36 | 9 | 5.0 |
| `case_sensitive_modifier` | No
See [bug 1041095](https://crbug.com/1041095). | No
See [bug 1041095](https://crbug.com/1041095). | 66 | No | No
See [bug 1041095](https://crbug.com/1041095). | No | No
See [bug 1041095](https://crbug.com/1041095). | No
See [bug 1041095](https://crbug.com/1041095). | 66 | No
See [bug 1041095](https://crbug.com/1041095). | No | No
See [bug 1041095](https://crbug.com/1041095). |
See also
--------
* [`attr()`](attr)
* Selecting a single element: [`Document.querySelector()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector), [`DocumentFragment.querySelector()`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelector), or [`Element.querySelector()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector)
* Selecting all matching elements: [`Document.querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll), [`DocumentFragment.querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelectorAll), or [`Element.querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll)
| programming_docs |
css font-kerning font-kerning
============
The `font-kerning` CSS property sets the use of the kerning information stored in a font.
Try it
------
*Kerning* defines how letters are spaced. In *well-kerned* fonts, this feature makes character spacing more uniform and pleasant to read than it would otherwise be.
In the image below, for instance, the examples on the left do not use kerning, while the ones on the right do:
Syntax
------
```
font-kerning: auto;
font-kerning: normal;
font-kerning: none;
/\* Global values \*/
font-kerning: inherit;
font-kerning: initial;
font-kerning: revert;
font-kerning: revert-layer;
font-kerning: unset;
```
### Values
`auto` The browser determines whether font kerning should be used or not. For example, some browsers will disable kerning on small fonts, since applying it could harm the readability of text.
`normal` Font kerning information stored in the font must be applied.
`none` Font kerning information stored in the font is disabled.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
font-kerning =
auto [|](value_definition_syntax#single_bar)
normal [|](value_definition_syntax#single_bar)
none
```
Examples
--------
### Enabling and disabling kerning
#### HTML
```
<div id="kern"></div>
<div id="nokern"></div>
<textarea id="input">AV T. ij</textarea>
```
#### CSS
```
div {
font-size: 2rem;
font-family: serif;
}
#nokern {
font-kerning: none;
}
#kern {
font-kerning: normal;
}
```
#### JavaScript
```
const input = document.getElementById('input');
const kern = document.getElementById('kern');
const nokern = document.getElementById('nokern');
input.addEventListener('keyup', () => {
kern.textContent = input.value; /\* Update content \*/
nokern.textContent = input.value;
});
kern.textContent = input.value; /\* Initialize content \*/
nokern.textContent = input.value;
```
Specifications
--------------
| Specification |
| --- |
| [CSS Fonts Module Level 4 # font-kerning-prop](https://w3c.github.io/csswg-drafts/css-fonts/#font-kerning-prop) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `font-kerning` | 33
29-33 | 79 | 32 | No | 20
16-20 | 9
6 | 4.4.3
4.4-4.4.3 | 33
29-33 | 32 | 20
16-20 | 9
6 | 2.0
1.0-2.0 |
See also
--------
* [`font-variant`](font-variant), [`font-variant-position`](font-variant-position), [`font-variant-east-asian`](font-variant-east-asian), [`font-variant-caps`](font-variant-caps), [`font-variant-ligatures`](font-variant-ligatures), [`font-variant-numeric`](font-variant-numeric), [`font-variant-alternates`](font-variant-alternates), [`font-synthesis`](font-synthesis), [`letter-spacing`](letter-spacing)
css font-size font-size
=========
The `font-size` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the size of the font. Changing the font size also updates the sizes of the font size-relative [`<length>`](length) units, such as `em`, `ex`, and so forth.
Try it
------
Syntax
------
```
/\* <absolute-size> values \*/
font-size: xx-small;
font-size: x-small;
font-size: small;
font-size: medium;
font-size: large;
font-size: x-large;
font-size: xx-large;
font-size: xxx-large;
/\* <relative-size> values \*/
font-size: smaller;
font-size: larger;
/\* <length> values \*/
font-size: 12px;
font-size: 0.8em;
/\* <percentage> values \*/
font-size: 80%;
/\* math value \*/
font-size: math;
/\* Global values \*/
font-size: inherit;
font-size: initial;
font-size: revert;
font-size: revert-layer;
font-size: unset;
```
The `font-size` property is specified in one of the following ways:
* As one of the absolute-size, relative-size or `math` keywords
* As a `<length>` or a `<percentage>`, relative to the element's font size.
### Values
`xx-small`, `x-small`, `small`, `medium`, `large`, `x-large`, `xx-large`, `xxx-large`
Absolute-size keywords, based on the user's default font size (which is `medium`).
`larger`, `smaller`
Relative-size keywords. The font will be larger or smaller relative to the parent element's font size, roughly by the ratio used to separate the absolute-size keywords above.
[`<length>`](length) A positive [`<length>`](length) value. For most font-relative units (such as `em` and `ex`), the font size is relative to the parent element's font size.
For font-relative units that are root-based (such as `rem`), the font size is relative to the size of the font used by the [`<html>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html) (root) element.
[`<percentage>`](percentage) A positive [`<percentage>`](percentage) value, relative to the parent element's font size.
**Note:** To maximize accessibility, it is generally best to use values that are relative to the user's default font size.
* `math` Experimental Special [mathematical scaling rules](https://w3c.github.io/mathml-core/#the-math-script-level-property) must be applied when determining the computed value of the `font-size` property.
Description
-----------
There are several ways to specify the font size, including keywords or numerical values for pixels or ems. Choose the appropriate method based on the needs of the particular web page.
### Keywords
Keywords are a good way to set the size of fonts on the web. By setting a keyword font size on the [`<body>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body) element, you can set relative font-sizing everywhere else on the page, giving you the ability to easily scale the font up or down on the entire page accordingly.
### Pixels
Setting the font size in pixel values (`px`) is a good choice when you need pixel accuracy. A px value is static. This is an OS-independent and cross-browser way of literally telling the browsers to render the letters at exactly the number of pixels in height that you specified. The results may vary slightly across browsers, as they may use different algorithms to achieve a similar effect.
Font sizing settings can also be used in combination. For example, if a parent element is set to `16px` and its child element is set to `larger`, the child element displays larger than the parent element on the page.
**Note:** Defining font sizes in `px` is *[not accessible](https://en.wikipedia.org/wiki/Web_accessibility)*, because the user cannot change the font size in some browsers. For example, users with limited vision may wish to set the font size much larger than the size chosen by a web designer. Avoid using them for font sizes if you wish to create an inclusive design.
### Ems
Using an `em` value creates a dynamic or computed font size (historically the `em` unit was derived from the width of a capital "M" in a given typeface.). The numeric value acts as a multiplier of the `font-size` property of the element on which it is used. Consider this example:
```
p {
font-size: 2em;
}
```
In this case, the font size of `<p>` elements will be double the computed `font-size` inherited by `<p>` elements. By extension, a `font-size` of `1em` equals the computed `font-size` of the element on which it is used.
If a `font-size` has not been set on any of the `<p>`'s ancestors, then `1em` will equal the default browser `font-size`, which is usually `16px`. So, by default `1em` is equivalent to `16px`, and `2em` is equivalent to `32px`. If you were to set a `font-size` of 20px on the `<body>` element say, then `1em` on the `<p>` elements would instead be equivalent to `20px`, and `2em` would be equivalent to `40px`.
In order to calculate the `em` equivalent for any pixel value required, you can use this formula:
```
em = desired element pixel value / parent element font-size in pixels
```
For example, suppose the `font-size` of the `<body>` of the page is set to `16px`. If the font-size you want is `12px`, then you should specify `0.75em` (because 12/16 = 0.75). Similarly, if you want a font size of `10px`, then specify `0.625em` (10/16 = 0.625); for `22px`, specify `1.375em` (22/16).
The `em` is a very useful unit in CSS since it automatically adapts its length relative to the font that the reader chooses to use.
One important fact to keep in mind: em values compound. Take the following HTML and CSS:
```
html {
font-size: 100%;
}
span {
font-size: 1.6em;
}
```
```
<div>
<span>Outer <span>inner</span> outer</span>
</div>
```
The result is:
Assuming that the browser's default `font-size` is 16px, the words "outer" would be rendered at 25.6px, but the word "inner" would be rendered at 40.96px. This is because the inner [`<span>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span)'s `font-size` is 1.6em which is relative to its parent's `font-size`, which is in turn relative to its parent's `font-size`. This is often called **compounding**.
### Rems
`rem` values were invented in order to sidestep the compounding problem. `rem` values are relative to the root `html` element, not the parent element. In other words, it lets you specify a font size in a relative fashion without being affected by the size of the parent, thereby eliminating compounding.
The CSS below is nearly identical to the previous example. The only exception is that the unit has been changed to `rem`.
```
html {
font-size: 100%;
}
span {
font-size: 1.6rem;
}
```
Then we apply this CSS to the same HTML, which looks like this:
```
<span>Outer <span>inner</span> outer</span>
```
In this example, the words "outer inner outer" are all displayed at 25.6px (assuming that the browser's `font-size` has been left at the default value of 16px).
### Ex
Like the `em` unit, an element's `font-size` set using the `ex` unit is computed or dynamic. It behaves in exactly the same way, except that when setting the `font-size` property using `ex` units, the `font-size` equals the x-height of the [first available font](https://www.w3.org/TR/css-fonts-3/#first-available-font) used on the page. The number value multiplies the element's inherited `font-size` and the `font-size` compounds relatively.
See the W3C Editor's Draft for a more detailed description of [font-relative length units](https://drafts.csswg.org/css-values-4/#font-relative-length) such as `ex`.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `medium` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | yes |
| Percentages | refer to the parent element's font size |
| [Computed value](computed_value) | as specified, but with relative lengths converted into absolute lengths |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
font-size =
[<absolute-size>](absolute-size) [|](value_definition_syntax#single_bar)
[<relative-size>](relative-size) [|](value_definition_syntax#single_bar)
[<length-percentage [0,∞]>](length-percentage) [|](value_definition_syntax#single_bar)
math
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Setting font sizes
#### CSS
```
.small {
font-size: xx-small;
}
.larger {
font-size: larger;
}
.point {
font-size: 24pt;
}
.percent {
font-size: 200%;
}
```
#### HTML
```
<h1 class="small">Small H1</h1>
<h1 class="larger">Larger H1</h1>
<h1 class="point">24 point H1</h1>
<h1 class="percent">200% H1</h1>
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Fonts Module Level 4 # font-size-prop](https://w3c.github.io/csswg-drafts/css-fonts/#font-size-prop) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `font-size` | 1 | 12 | 1 | 5.5 | 7 | 1 | ≤37 | 18 | 4 | 10.1 | 1 | 1.0 |
| `math` | 87 | 87 | No | No | 73 | No | 4 | 87 | No | No | No | No |
| `rem_values` | 31 | 12 | 31
["Before Firefox 57, animations using em units are not affected by changes to the `font-size` of the animated element's parent ([bug 1254424](https://bugzil.la/1254424)).", "Before Firefox 57, some language settings' inherited `font-size` is smaller than expected ([bug 1391341](https://bugzil.la/1391341))."] | 9 | 28 | 7 | 4 | 42 | 31 | 28 | 7 | 4.0 |
| `xxx-large` | 79 | 79 | 70 | No | No | preview | 79 | 79 | No | No | No | 12.0 |
See also
--------
* [`font-size-adjust`](font-size-adjust)
* [`font-style`](font-style)
* [`font-weight`](font-weight)
* [`math-depth`](math-depth)
* [`math-style`](math-style)
* [Fundamental text and font styling](https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_text/Fundamentals)
css mask-type mask-type
=========
The `mask-type` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets whether an SVG [`<mask>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/mask) element is used as a *luminance* or an *alpha* mask. It applies to the `<mask>` element itself.
```
/\* Keyword values \*/
mask-type: luminance;
mask-type: alpha;
/\* Global values \*/
mask-type: inherit;
mask-type: initial;
mask-type: revert;
mask-type: revert-layer;
mask-type: unset;
```
This property may be overridden by the [`mask-mode`](mask-mode) property, which has the same effect but applies to the element where the mask is used. Alpha masks will generally be faster to render.
Syntax
------
The `mask-type` property is specified as one of the keyword values listed below.
### Values
`luminance` Is a keyword indicating that the associated mask image is a luminance mask, i.e., that its [relative luminance](https://en.wikipedia.org/wiki/Luminance_%28relative%29) values must be used when applying it.
`alpha` Is a keyword indicating that the associated mask image is an alpha mask, i.e., that its [alpha channel](https://en.wikipedia.org/wiki/Alpha_compositing) values must be used when applying it.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `luminance` |
| Applies to | [`<mask>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/mask) elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
mask-type =
luminance [|](value_definition_syntax#single_bar)
alpha
```
Examples
--------
### Setting an alpha mask
#### HTML
```
<div class="redsquare"></div>
<svg
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="0"
height="0">
<defs>
<mask id="m" maskContentUnits="objectBoundingBox" style="mask-type:alpha">
<rect
x=".1"
y=".1"
width=".8"
height=".8"
fill="red"
fill-opacity="0.7" />
</mask>
</defs>
</svg>
```
#### CSS
```
.redsquare {
height: 100px;
width: 100px;
background-color: rgb(128, 128, 128);
border: solid 1px black;
mask: url("#m");
}
```
#### Result
### Setting a luminance mask
#### HTML
```
<div class="redsquare"></div>
<svg
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="0"
height="0">
<defs>
<mask
id="m"
maskContentUnits="objectBoundingBox"
style="mask-type:luminance">
<rect
x=".1"
y=".1"
width=".8"
height=".8"
fill="red"
fill-opacity="0.7" />
</mask>
</defs>
</svg>
```
#### CSS
```
.redsquare {
height: 100px;
width: 100px;
background-color: rgb(128, 128, 128);
border: solid 1px black;
mask: url("#m");
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Masking Module Level 1 # the-mask-type](https://drafts.fxtf.org/css-masking/#the-mask-type) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `mask-type` | 24 | 79 | 35 | No | 15 | 7 | 37 | 25 | 35 | 14 | 7 | 1.5 |
See also
--------
* Other mask-related properties: [`mask`](mask), [`mask-mode`](mask-mode)
css scroll-margin-block-start scroll-margin-block-start
=========================
The `scroll-margin-block-start` property defines the margin of the scroll snap area at the start of the block dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets.
Try it
------
Syntax
------
```
/\* <length> values \*/
scroll-margin-block-start: 10px;
scroll-margin-block-start: 1em;
/\* Global values \*/
scroll-margin-block-start: inherit;
scroll-margin-block-start: initial;
scroll-margin-block-start: revert;
scroll-margin-block-start: revert-layer;
scroll-margin-block-start: unset;
```
### Values
`<length>` An outset from the block start edge of the scroll container.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-margin-block-start =
[<length>](length)
```
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # margin-longhands-logical](https://w3c.github.io/csswg-drafts/css-scroll-snap/#margin-longhands-logical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-margin-block-start` | 69 | 79 | 68 | No | 56 | 14.1 | 69 | 69 | 68 | 48 | 14.5 | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
css attr() attr()
======
**Note:** The `attr()` function can be used with any CSS property, but support for properties other than [`content`](content) is experimental, and support for the type-or-unit parameter is sparse.
The `attr()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) is used to retrieve the value of an attribute of the selected element and use it in the stylesheet. It can also be used on <pseudo-elements>, in which case the value of the attribute on the pseudo-element's originating element is returned.
Try it
------
Syntax
------
```
/\* Simple usage \*/
attr(data-count);
attr(title);
/\* With type \*/
attr(src url);
attr(data-count number);
attr(data-width px);
/\* With fallback \*/
attr(data-count number, 0);
attr(src url, "");
attr(data-width px, inherit);
attr(data-something, "default");
```
### Values
`attribute-name` The name of an attribute on the HTML element referenced in the CSS.
`<type-or-unit>` Experimental
A keyword representing either the type of the attribute's value, or its unit, as in HTML some attributes have implicit units. If the use of `<type-or-unit>` as a value for the given attribute is invalid, the `attr()` expression will be invalid too. If omitted, it defaults to `string`. The list of valid values are:
`string` The attribute value is treated as a CSS [`<string>`](string). It is NOT reparsed, and in particular the characters are used as-is instead of CSS escapes being turned into different characters.
Default value: an empty string.
`color` Experimental
The attribute value is parsed as a hash (3- or 6-value hash) or a keyword. It must be a valid CSS [`<string>`](string) value. Leading and trailing spaces are stripped.
Default value: `currentcolor`.
`url` Experimental
The attribute value is parsed as a string that is used inside a CSS `url()` function. Relative URL are resolved relatively to the original document, not relatively to the style sheet. Leading and trailing spaces are stripped.
Default value: the URL `about:invalid` that points to a non-existent document with a generic error condition.
`integer` Experimental
The attribute value is parsed as a CSS [`<integer>`](integer). If it is not valid, that is not an integer or out of the range accepted by the CSS property, the default value is used. Leading and trailing spaces are stripped.
Default value: `0`, or, if `0` is not a valid value for the property, the property's minimum value.
`number` Experimental
The attribute value is parsed as a CSS [`<number>`](number). If it is not valid, that is not a number or out of the range accepted by the CSS property, the default value is used. Leading and trailing spaces are stripped.
Default value: `0`, or, if `0` is not a valid value for the property, the property's minimum value.
`length` Experimental
The attribute value is parsed as a CSS [`<length>`](length) dimension, that is including the unit (e.g. `12.5em`). If it is not valid, that is not a length or out of the range accepted by the CSS property, the default value is used. If the given unit is a relative length, `attr()` computes it to an absolute length. Leading and trailing spaces are stripped.
Default value: `0`, or, if `0` is not a valid value for the property, the property's minimum value.
`em`, `ex`, `px`, `rem`, `vw`, `vh`, `vmin`, `vmax`, `mm`, `cm`, `in`, `pt`, or `pc` Experimental
The attribute value is parsed as a CSS [`<number>`](number), that is without the unit (e.g. `12.5`), and interpreted as a [`<length>`](length) with the specified unit. If it is not valid, that is not a number or out of the range accepted by the CSS property, the default value is used. If the given unit is a relative length, `attr()` computes it to an absolute length. Leading and trailing spaces are stripped.
Default value: `0`, or, if `0` is not a valid value for the property, the property's minimum value.
`angle` Experimental
The attribute value is parsed as a CSS [`<angle>`](angle) dimension, that is including the unit (e.g. `30.5deg`). If it is not valid, that is not an angle or out of the range accepted by the CSS property, the default value is used. Leading and trailing spaces are stripped.
Default value: `0deg`, or, if `0deg` is not a valid value for the property, the property's minimum value.
`deg`, `grad`, `rad` Experimental
The attribute value is parsed as a CSS [`<number>`](number), that is without the unit (e.g. `12.5`), and interpreted as an [`<angle>`](angle) with the specified unit. If it is not valid, that is not a number or out of the range accepted by the CSS property, the default value is used. Leading and trailing spaces are stripped.
Default value: `0deg`, or, if `0deg` is not a valid value for the property, the property's minimum value.
`time` Experimental
The attribute value is parsed as a CSS [`<time>`](time) dimension, that is including the unit (e.g. `30.5ms`). If it is not valid, that is not a time or out of the range accepted by the CSS property, the default value is used. Leading and trailing spaces are stripped.
Default value: `0s`, or, if `0s` is not a valid value for the property, the property's minimum value.
`s`, `ms` Experimental
The attribute value is parsed as a CSS [`<number>`](number), that is without the unit (e.g. `12.5`), and interpreted as an [`<time>`](time) with the specified unit. If it is not valid, that is not a number or out of the range accepted by the CSS property, the default value is used. Leading and trailing spaces are stripped.
Default value: `0s`, or, if `0s` is not a valid value for the property, the property's minimum value.
`frequency` Experimental
The attribute value is parsed as a CSS [`<frequency>`](frequency) dimension, that is including the unit (e.g. `30.5kHz`). If it is not valid, that is not a frequency or out of the range accepted by the CSS property, the default value is used.
Default value: `0Hz`, or, if `0Hz` is not a valid value for the property, the property's minimum value.
`Hz`, `kHz` Experimental
The attribute value is parsed as a CSS [`<number>`](number), that is without the unit (e.g. `12.5`), and interpreted as a [`<frequency>`](frequency) with the specified unit. If it is not valid, that is not a number or out of the range accepted by the CSS property, the default value is used. Leading and trailing spaces are stripped.
Default value: `0Hz`, or, if `0Hz` is not a valid value for the property, the property's minimum value.
`%` Experimental
The attribute value is parsed as a CSS [`<number>`](number), that is without the unit (e.g. `12.5`), and interpreted as a [`<percentage>`](percentage). If it is not valid, that is not a number or out of the range accepted by the CSS property, the default value is used. If the given value is used as a length, `attr()` computes it to an absolute length. Leading and trailing spaces are stripped.
Default value: `0%`, or, if `0%` is not a valid value for the property, the property's minimum value.
`<fallback>` Experimental
The value to be used if the associated attribute is missing or contains an invalid value. If not set, CSS will use the default value defined for each `<type-or-unit>`.
### Formal syntax
```
<attr()> =
attr( [<q-name>](q-name) <attr-type>[?](value_definition_syntax#question_mark) , [<declaration-value>](declaration-value)[?](value_definition_syntax#question_mark) )
<attr-type> =
string [|](value_definition_syntax#single_bar)
url [|](value_definition_syntax#single_bar)
ident [|](value_definition_syntax#single_bar)
color [|](value_definition_syntax#single_bar)
number [|](value_definition_syntax#single_bar)
percentage [|](value_definition_syntax#single_bar)
length [|](value_definition_syntax#single_bar)
angle [|](value_definition_syntax#single_bar)
time [|](value_definition_syntax#single_bar)
frequency [|](value_definition_syntax#single_bar)
flex [|](value_definition_syntax#single_bar)
[<dimension-unit>](dimension-unit)
```
Examples
--------
### content property
#### HTML
```
<p data-foo="hello">world</p>
```
#### CSS
```
[data-foo]::before {
content: attr(data-foo) " ";
}
```
#### Result
### color value
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
#### HTML
```
<div class="background" data-background="lime">
background expected to be red if your browser does not support advanced usage
of attr()
</div>
```
#### CSS
```
.background {
background-color: red;
}
.background[data-background] {
background-color: attr(data-background color, red);
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 5 # attr-notation](https://w3c.github.io/csswg-drafts/css-values-5/#attr-notation) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `attr` | 2 | 12 | 1 | 8 | 9 | 3.1 | ≤37 | 18 | 4 | 10.1 | 2 | 1.0 |
| `fallback` | No | No | No
See [bug 1448248](https://bugzil.la/1448248). | No | No | No
See [bug 204275](https://webkit.org/b/204275). | No | No | No
See [bug 1448248](https://bugzil.la/1448248). | No | No
See [bug 204275](https://webkit.org/b/204275). | No |
| `type-or-unit` | No | No | No
See [bug 435426](https://bugzil.la/435426). | No | No | No
See [bug 204275](https://webkit.org/b/204275). | No | No | No
See [bug 435426](https://bugzil.la/435426). | No | No
See [bug 204275](https://webkit.org/b/204275). | No |
See also
--------
* [Attribute selectors](attribute_selectors)
* [HTML `data-*` attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*)
* [SVG `data-*` attributes](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/data-*)
| programming_docs |
css outline-color outline-color
=============
The `outline-color` CSS property sets the color of an element's outline.
Try it
------
Syntax
------
```
/\* <color> values \*/
outline-color: #f92525;
outline-color: rgb(30, 222, 121);
outline-color: blue;
/\* Keyword value \*/
outline-color: invert;
/\* Global values \*/
outline-color: inherit;
outline-color: initial;
outline-color: revert;
outline-color: revert-layer;
outline-color: unset;
```
The `outline-color` property is specified as any one of the values listed below.
### Values
[`<color>`](color_value) The color of the outline, specified as a `<color>`.
`invert` To ensure the outline is visible, performs a color inversion of the background. Note that browsers are not required to support this value; if they don't, this keyword is considered invalid.
Description
-----------
An outline is a line that is drawn around an element, outside the [`border`](border). Unlike the element's border, the outline is drawn outside the element's frame, and may overlap other content. The border, on the other hand, will actually alter the page's layout to ensure that it fits without overlapping anything else (unless you explicitly set it to overlap).
It is often more convenient to use the shorthand property [`outline`](outline) when defining the appearance of an outline.
Accessibility concerns
----------------------
Custom [focus styles](:focus) commonly involve making adjustments to the [`outline`](outline) property. If the color of the outline is adjusted, it is important to ensure that the contrast ratio between it and the background the outline is placed over is high enough that people experiencing low vision conditions will be able to perceive it.
Color contrast ratio is determined by comparing the luminosity of the text and background color values. In order to meet current [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/standards-guidelines/wcag/), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and [bold](font-weight) or larger, or 24px or larger.
* [WebAIM: Color Contrast Checker](https://webaim.org/resources/contrastchecker/)
* [MDN Understanding WCAG, Guideline 1.4 explanations](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background)
* [Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html)
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `invert`, for browsers supporting it, `currentColor` for the other |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | For the keyword `invert`, the computed value is `invert`. For the color value, if the value is translucent, the computed value will be the `rgba()` corresponding one. If it isn't, it will be the `rgb()` corresponding one. The `transparent` keyword maps to `rgba(0,0,0,0)`. |
| Animation type | a [color](color_value#interpolation) |
Formal syntax
-------------
```
outline-color =
[[](value_definition_syntax#brackets) [<color>](color_value) [|](value_definition_syntax#single_bar) <1d-image> []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
invert
<1d-image> =
<stripes()>
<stripes()> =
stripes( <color-stripe>[#](value_definition_syntax#hash_mark) )
<color-stripe> =
[<color>](color_value) [&&](value_definition_syntax#double_ampersand)
[[](value_definition_syntax#brackets) <length-percentage> [|](value_definition_syntax#single_bar) [<flex>](flex) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Setting a solid blue outline
#### HTML
```
<p>My outline is blue, as you can see.</p>
```
#### CSS
```
p {
outline: 2px solid; /\* Set the outline width and style \*/
outline-color: #0000ff; /\* Make the outline blue \*/
margin: 5px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Basic User Interface Module Level 4 # outline-color](https://w3c.github.io/csswg-drafts/css-ui/#outline-color) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `outline-color` | 1 | 12 | 1.5
1-3.6 | 8 | 7 | 1.2 | 37 | 18 | 4 | 14 | 1 | 1.0 |
| `invert` | No | 12-79 | 1-3 | 8 | 7-15 | No | No | No | No | No | No | No |
See also
--------
* [`outline`](outline)
* [`outline-color`](outline-color)
* [`outline-style`](outline-style)
* [`outline-width`](outline-width)
* The [`<color>`](color_value) data type
* Other color-related properties: [`color`](color), [`background-color`](background-color), [`border-color`](border-color), [`text-decoration-color`](text-decoration-color), [`text-emphasis-color`](text-emphasis-color), [`text-shadow`](text-shadow), [`caret-color`](caret-color), and [`column-rule-color`](column-rule-color)
* [Applying color to HTML elements using CSS](css_colors/applying_color)
css text-emphasis-style text-emphasis-style
===================
The `text-emphasis-style` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the appearance of emphasis marks. It can also be set, and reset, using the [`text-emphasis`](text-emphasis) shorthand.
Try it
------
Syntax
------
```
/\* Initial value \*/
text-emphasis-style: none; /\* No emphasis marks \*/
/\* <string> values \*/
text-emphasis-style: "x";
text-emphasis-style: "点";
text-emphasis-style: "\25B2";
text-emphasis-style: "\*";
text-emphasis-style: "foo"; /\* Should NOT be used. It may be computed to or rendered as 'f' only \*/
/\* Keyword values \*/
text-emphasis-style: filled;
text-emphasis-style: open;
text-emphasis-style: dot;
text-emphasis-style: circle;
text-emphasis-style: double-circle;
text-emphasis-style: triangle;
text-emphasis-style: filled sesame;
text-emphasis-style: open sesame;
/\* Global values \*/
text-emphasis-style: inherit;
text-emphasis-style: initial;
text-emphasis-style: revert;
text-emphasis-style: revert-layer;
text-emphasis-style: unset;
```
### Values
`none` No emphasis marks.
`filled` The shape is filled with solid color. If neither `filled` nor `open` is present, this is the default.
`open` The shape is hollow.
`dot` Display small circles as marks. The filled dot is `'•'` (`U+2022`), and the open dot is `'◦'` (`U+25E6`).
`circle` Display large circles as marks. The filled circle is `'●'` (`U+25CF`), and the open circle is `'○'` (`U+25CB`).
`double-circle` Display double circles as marks. The filled double-circle is `'◉'` (`U+25C9`), and the open double-circle is `'◎'` (`U+25CE`).
`triangle` Display triangles as marks. The filled triangle is `'▲'` (`U+25B2`), and the open triangle is `'△'` (`U+25B3`).
`sesame` Display sesames as marks. The filled sesame is `'﹅'` (`U+FE45`), and the open sesame is `'﹆'` (`U+FE46`).
`<string>` Display the given string as marks. Authors should not specify more than one *character* in `<string>`. The UA may truncate or ignore strings consisting of more than one grapheme cluster.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
text-emphasis-style =
none [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) filled [|](value_definition_syntax#single_bar) open []](value_definition_syntax#brackets) [||](value_definition_syntax#double_bar) [[](value_definition_syntax#brackets) dot [|](value_definition_syntax#single_bar) circle [|](value_definition_syntax#single_bar) double-circle [|](value_definition_syntax#single_bar) triangle [|](value_definition_syntax#single_bar) sesame []](value_definition_syntax#brackets) []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[<string>](string)
```
Examples
--------
### Basic example
```
h2 {
-webkit-text-emphasis-style: sesame;
text-emphasis-style: sesame;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Text Decoration Module Level 3 # text-emphasis-style-property](https://w3c.github.io/csswg-drafts/css-text-decor/#text-emphasis-style-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `text-emphasis-style` | 99
25 | 99
79 | 46 | No | 15 | 7
7 | 4.4 | 99
25 | 46 | 14 | 7
7 | 18.0
1.5 |
See also
--------
* The related properties [`text-emphasis-color`](text-emphasis-color), [`text-emphasis`](text-emphasis).
* The [`text-emphasis-position`](text-emphasis-position) property allowing to define the position of the emphasis marks.
css isolation isolation
=========
The `isolation` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property determines whether an element must create a new [stacking context](https://developer.mozilla.org/en-US/docs/Glossary/Stacking_context).
Try it
------
This property is especially helpful when used in conjunction with [`mix-blend-mode`](mix-blend-mode) and [`z-index`](z-index).
Syntax
------
```
/\* Keyword values \*/
isolation: auto;
isolation: isolate;
/\* Global values \*/
isolation: inherit;
isolation: initial;
isolation: revert;
isolation: revert-layer;
isolation: unset;
```
The `isolation` property is specified as one of the keyword values listed below.
### Values
`auto` A new stacking context is created only if one of the properties applied to the element requires it.
`isolate` A new stacking context must be created.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | All elements. In SVG, it applies to container elements, graphics elements, and graphics referencing elements. |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
isolation =
<isolation-mode>
<isolation-mode> =
auto [|](value_definition_syntax#single_bar)
isolate
```
Examples
--------
### Forcing a new stacking context for an element
#### HTML
```
<div id="b" class="a">
<div id="d">
<div class="a c">auto</div>
</div>
<div id="e">
<div class="a c">isolate</div>
</div>
</div>
```
#### CSS
```
.a {
background-color: rgb(0, 255, 0);
}
#b {
width: 200px;
height: 210px;
}
.c {
width: 100px;
height: 100px;
border: 1px solid black;
padding: 2px;
mix-blend-mode: difference;
}
#d {
isolation: auto;
}
#e {
isolation: isolate;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Compositing and Blending Level 1 # isolation](https://drafts.fxtf.org/compositing/#isolation) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `isolation` | 41 | 79 | 36 | No | 30 | 8 | 41 | 41 | 36 | 30 | 8 | 4.0 |
See also
--------
* [`<blend-mode>`](blend-mode)
* [`mix-blend-mode`](mix-blend-mode), [`background-blend-mode`](background-blend-mode)
css <gradient> <gradient>
==========
The `<gradient>` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [data type](css_types) is a special type of [`<image>`](image) that consists of a progressive transition between two or more colors.
Try it
------
A CSS gradient has [no intrinsic dimensions](image#description); i.e., it has no natural or preferred size, nor a preferred ratio. Its concrete size will match the size of the element to which it applies.
Syntax
------
The `<gradient>` data type is defined with one of the function types listed below.
### Linear gradient
Linear gradients transition colors progressively along an imaginary line. They are generated with the [`linear-gradient()`](gradient/linear-gradient) function.
### Radial gradient
Radial gradients transition colors progressively from a center point (origin). They are generated with the [`radial-gradient()`](gradient/radial-gradient) function.
### Repeating gradient
Repeating gradients duplicate a gradient as much as necessary to fill a given area. They are generated with the [`repeating-linear-gradient()`](gradient/repeating-linear-gradient) and [`repeating-radial-gradient()`](gradient/repeating-radial-gradient) functions.
### Conic gradient
Conic gradients transition colors progressively around a circle. They are generated with the [`conic-gradient()`](gradient/conic-gradient) function.
Interpolation
-------------
As with any interpolation involving colors, gradients are calculated in the alpha-premultiplied color space. This prevents unexpected shades of gray from appearing when both the color and the opacity are changing. (Be aware that older browsers may not use this behavior when using the [transparent keyword](color_value#transparent_keyword).)
Formal syntax
-------------
```
<gradient> =
<linear-gradient()> [|](value_definition_syntax#single_bar)
[<repeating-linear-gradient()>](gradient/repeating-linear-gradient) [|](value_definition_syntax#single_bar)
<radial-gradient()> [|](value_definition_syntax#single_bar)
[<repeating-radial-gradient()>](gradient/repeating-radial-gradient)
<linear-gradient()> =
linear-gradient( [[](value_definition_syntax#brackets) [<angle>](angle) [|](value_definition_syntax#single_bar) to <side-or-corner> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) , <color-stop-list> )
<radial-gradient()> =
radial-gradient( [[](value_definition_syntax#brackets) [<ending-shape>](ending-shape) [||](value_definition_syntax#double_bar) <size> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) at <position> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) , <color-stop-list> )
<side-or-corner> =
[[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) right []](value_definition_syntax#brackets) [||](value_definition_syntax#double_bar)
[[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) bottom []](value_definition_syntax#brackets)
<color-stop-list> =
<linear-color-stop> , [[](value_definition_syntax#brackets) <linear-color-hint>[?](value_definition_syntax#question_mark) , <linear-color-stop> []](value_definition_syntax#brackets)[#](value_definition_syntax#hash_mark)
<size> =
<extent-keyword> [|](value_definition_syntax#single_bar)
[<length [0,∞]>](length) [|](value_definition_syntax#single_bar)
[<length-percentage [0,∞]>](length-percentage)[{2}](value_definition_syntax#curly_braces)
<position> =
[[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) right []](value_definition_syntax#brackets) [||](value_definition_syntax#double_bar) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) bottom []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) right [|](value_definition_syntax#single_bar) <length-percentage> []](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) center [|](value_definition_syntax#single_bar) bottom [|](value_definition_syntax#single_bar) <length-percentage> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) left [|](value_definition_syntax#single_bar) right []](value_definition_syntax#brackets) <length-percentage> []](value_definition_syntax#brackets) [&&](value_definition_syntax#double_ampersand) [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) top [|](value_definition_syntax#single_bar) bottom []](value_definition_syntax#brackets) <length-percentage> []](value_definition_syntax#brackets)
<linear-color-stop> =
[<color>](color_value) [&&](value_definition_syntax#double_ampersand)
<length-percentage>[?](value_definition_syntax#question_mark)
<linear-color-hint> =
<length-percentage>
<extent-keyword> =
closest-corner [|](value_definition_syntax#single_bar)
closest-side [|](value_definition_syntax#single_bar)
farthest-corner [|](value_definition_syntax#single_bar)
farthest-side
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Linear gradient example
A simple linear gradient.
```
.linear-gradient {
background: linear-gradient(
to right,
red,
orange,
yellow,
green,
blue,
indigo,
violet
);
}
```
### Radial gradient example
A simple radial gradient.
```
.radial-gradient {
background: radial-gradient(red, yellow, rgb(30, 144, 255));
}
```
### Repeating gradient examples
Simple repeating linear and radial gradient examples.
```
.linear-repeat {
background: repeating-linear-gradient(
to top left,
lightpink,
lightpink 5px,
white 5px,
white 10px
);
}
.radial-repeat {
background: repeating-radial-gradient(
powderblue,
powderblue 8px,
white 8px,
white 16px
);
}
```
### Conic gradient example
A simple conic gradient example. Note that this isn't supported widely across browser as of yet.
```
.conic-gradient {
background: conic-gradient(lightpink, white, powderblue);
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Image Values and Replaced Content Module Level 4 # gradients](https://w3c.github.io/csswg-drafts/css-images-4/#gradients) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `gradient` | 26
10 | 12 | 3.6
Gradients are limited to [`background-image`](https://developer.mozilla.org/docs/Web/CSS/background-image), [`border-image`](https://developer.mozilla.org/docs/Web/CSS/border-image), and [`mask-image`](https://developer.mozilla.org/docs/Web/CSS/mask-image). | 10 | 15
12.1
11-15 | 7
5.1 | ≤37
≤37 | 26
18 | 4
Gradients are limited to [`background-image`](https://developer.mozilla.org/docs/Web/CSS/background-image), [`border-image`](https://developer.mozilla.org/docs/Web/CSS/border-image), and [`mask-image`](https://developer.mozilla.org/docs/Web/CSS/mask-image). | 14
12.1
11-14 | 7
5 | 1.5
1.0 |
| `conic-gradient` | 69 | 79 | 83 | No | 56 | 12.1 | 69 | 69 | 83 | 48 | 12.2 | 10.0 |
| `linear-gradient` | 26
10 | 12 | 49
16
Before Firefox 36, gradients weren't applied on the pre-multiplied color space, leading to shades of grey unexpectedly appearing when used with transparency.
3.6
["Since Firefox 42, the prefixed version of gradients can be disabled by setting `layout.css.prefixes.gradients` to `false`.", "Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right."] | 10
Internet Explorer 5.5 through 9.0 supported gradients via a proprietary filter: `[-ms-filter: progid:DXImageTransform.Microsoft.Gradient()](https://developer.mozilla.org/docs/Web/CSS/-ms-filter#Gradient)`. | 15
Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right.
12.1
11-15
Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right. | 7
5.1
["Safari 4 was supporting an experimental `[-webkit-gradient(linear,…)](https://developer.apple.com/library/archive/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Gradients/Gradient.html)` function. It is more limited than the later standard version: you cannot specify both a position and an angle like in `linear-gradient()`. This old outdated syntax is still supported for compatibility purposes.", "Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right."] | ≤37
≤37 | 26
18 | 49
16
Before Firefox 36, gradients weren't applied on the pre-multiplied color space, leading to shades of grey unexpectedly appearing when used with transparency.
4
["Since Firefox 42, the prefixed version of gradients can be disabled by setting `layout.css.prefixes.gradients` to `false`.", "Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right."] | 14
Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right.
12.1
11-14
Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right. | 7
5
["Safari 4 was supporting an experimental `[-webkit-gradient(linear,…)](https://developer.apple.com/library/archive/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Gradients/Gradient.html)` function. It is more limited than the later standard version: you cannot specify both a position and an angle like in `linear-gradient()`. This old outdated syntax is still supported for compatibility purposes.", "Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right."] | 1.5
1.0 |
| `radial-gradient` | 26
13 | 12 | 49
16
Before Firefox 36, gradients weren't applied on the pre-multiplied color space, leading to shades of grey unexpectedly appearing when used with transparency.
3.6
Since Firefox 42, the prefixed version of gradients can be disabled by setting `layout.css.prefixes.gradients` to `false`. | 10
Internet Explorer 5.5 through 9.0 supported gradients via a proprietary filter: `[-ms-filter: progid:DXImageTransform.Microsoft.Gradient()](https://developer.mozilla.org/docs/Web/CSS/-ms-filter#Gradient)`. | 15
12.1
11.6-15 | 7
5.1
Safari 4 was supporting an experimental `[-webkit-gradient(radial,…)](https://developer.apple.com/library/archive/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Gradients/Gradient.html)` function. This old outdated syntax is still supported for compatibility purposes. | ≤37
≤37 | 26
18 | 49
16
Before Firefox 36, gradients weren't applied on the pre-multiplied color space, leading to shades of grey unexpectedly appearing when used with transparency.
4
Since Firefox 42, the prefixed version of gradients can be disabled by setting `layout.css.prefixes.gradients` to `false`. | 14
12.1
12-14 | 7
5
Safari 4 was supporting an experimental `[-webkit-gradient(radial,…)](https://developer.apple.com/library/archive/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Gradients/Gradient.html)` function. This old outdated syntax is still supported for compatibility purposes. | 1.5
1.0 |
| `repeating-conic-gradient` | 69 | 79 | 83 | No | 56 | 12.1 | 69 | 69 | 83 | 48 | 12.2 | 10.0 |
| `repeating-linear-gradient` | 26
10 | 12 | 49
16
Before Firefox 36, gradients weren't applied on the pre-multiplied color space, leading to shades of grey unexpectedly appearing when used with transparency.
3.6
["Since Firefox 42, the prefixed version of gradients can be disabled by setting `layout.css.prefixes.gradients` to `false`.", "Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right."] | 10
Internet Explorer 5.5 through 9.0 supported gradients via a proprietary filter: `[-ms-filter: progid:DXImageTransform.Microsoft.Gradient()](https://developer.mozilla.org/docs/Web/CSS/-ms-filter#Gradient)`. | 15
Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right.
12.1
11-15
Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right. | 7
5.1
["Safari 4 was supporting an experimental `[-webkit-gradient(linear,…)](https://developer.apple.com/library/archive/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Gradients/Gradient.html)` function. It is more limited than the later standard version: you cannot specify both a position and an angle like in `repeating-linear-gradient()`. This old outdated syntax is still supported for compatibility purposes.", "Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right."] | ≤37
≤37 | 26
18 | 49
16
Before Firefox 36, gradients weren't applied on the pre-multiplied color space, leading to shades of grey unexpectedly appearing when used with transparency.
4
["Since Firefox 42, the prefixed version of gradients can be disabled by setting `layout.css.prefixes.gradients` to `false`.", "Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right."] | 14
Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right.
12.1
11-14
Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right. | 7
5
["Safari 4 was supporting an experimental `[-webkit-gradient(linear,…)](https://developer.apple.com/library/archive/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Gradients/Gradient.html)` function. It is more limited than the later standard version: you cannot specify both a position and an angle like in `repeating-linear-gradient()`. This old outdated syntax is still supported for compatibility purposes.", "Considers `<angle>` to start to the right, instead of the top. I.e. it considered an angle of `0deg` as a direction indicator pointing to the right."] | 1.5
1.0 |
| `repeating-radial-gradient` | 26
10 | 12 | 49
16
Before Firefox 36, gradients weren't applied on the pre-multiplied color space, leading to shades of grey unexpectedly appearing when used with transparency.
3.6
Since Firefox 42, the prefixed version of gradients can be disabled by setting `layout.css.prefixes.gradients` to `false`. | 10 | 15
12.1
12-15 | 7
5.1
Safari 4 was supporting an experimental `[-webkit-gradient(radial,…)](https://developer.apple.com/library/archive/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Gradients/Gradient.html)` function. This old outdated syntax is still supported for compatibility purposes. | ≤37
4.4 | 26
18 | 49
16
Before Firefox 36, gradients weren't applied on the pre-multiplied color space, leading to shades of grey unexpectedly appearing when used with transparency.
10
Since Firefox 42, the prefixed version of gradients can be disabled by setting `layout.css.prefixes.gradients` to `false`. | 14
12.1
12-14 | 7
5
Safari 4 was supporting an experimental `[-webkit-gradient(radial,…)](https://developer.apple.com/library/archive/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Gradients/Gradient.html)` function. This old outdated syntax is still supported for compatibility purposes. | 1.5
1.0 |
See also
--------
* [Using CSS gradients](css_images/using_css_gradients)
* Gradient functions: [`linear-gradient()`](gradient/linear-gradient), [`repeating-linear-gradient()`](gradient/repeating-linear-gradient), [`radial-gradient()`](gradient/radial-gradient), [`repeating-radial-gradient()`](gradient/repeating-radial-gradient), [`conic-gradient()`](gradient/conic-gradient), [`repeating-conic-gradient()`](gradient/repeating-conic-gradient)
* [CSS Basic Data Types](css_types)
* [CSS Units and Values](css_values_and_units)
* [Introduction to CSS: Values and Units](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units)
| programming_docs |
css CSS Containment CSS Containment
===============
The aim of the CSS Containment specification is to improve performance of web pages by allowing the browser to isolate a subtree of the page from the rest of the page. If the browser knows that a part of the page is independent, rendering can be optimized and performance improved.
In addition, it lets developers indicate whether or not an element should render its contents at all, and whether it should render its contents when it is offscreen. This allows the user agent to apply containment on elements when appropriate, and potentially defer layout and rendering until it is actually needed.
The specification defines the CSS properties [`contain`](contain) and [`content-visibility`](content-visibility). This document describes the basic aims of the specification. For details on CSS container queries, see [CSS Container Queries](css_container_queries).
Basic example
-------------
Many webpages contain several sections which are independent of each other. For example a listing of article headlines and content, as in the markup below.
```
<h1>My blog</h1>
<article>
<h2>Heading of a nice article</h2>
<p>Content here.</p>
</article>
<article>
<h2>Another heading of another article</h2>
<p>More content here.</p>
</article>
```
Each article has the [`contain`](contain) property with a value of `content` applied in the CSS.
```
article {
contain: content;
}
```
Each article is independent of the other articles on the page, and so they have been given `contain: content` to indicate to the browser that this is the case. The browser can then use this information to make decisions about how to render the content. For example, it might not render articles that are outside the viewable area.
If we give each `<article>` the `contain` property with a value of `content`, when new elements are inserted the browser does not need to recalculate layout or repaint any area outside of the containing element's subtree. If the `<article>` is styled such that its size depends on its contents (e.g. with `height: auto`), then the browser may need to account for its size changing.
We have told it by way of the `contain` property that each article is independent.
The `content` value is shorthand for `contain: layout paint style`. It tells the browser that the internal layout of the element is totally separate from the rest of the page, and that everything about the element is painted inside its bounds. Nothing can visibly overflow.
This information is something that is usually known, and in fact quite obvious, to the web developer creating the page. However browsers cannot guess at your intent and cannot assume that an article will be entirely self-contained. Therefore this property gives you a nice way to explain to the browser this fact, and allow it to make performance optimizations based on that knowledge.
Key concepts and terminology
----------------------------
###
`contain` values
The values for the [`contain`](contain) property indicate the type of containment that you want to apply to that element.
#### Layout containment
```
article {
contain: layout;
}
```
Layout is normally scoped to the entire document, which means that if you move one element the entire document needs to be treated as if things could have moved anywhere. By using `contain: layout` you can tell the browser it only needs to check this element — everything inside the element is scoped to that element and does not affect the rest of the page, and the containing box establishes an independent formatting context.
In addition:
* `float` layout will be performed independently.
* Margins won't collapse across a layout containment boundary
* The layout container will be a containing block for `absolute`/`fixed` position descendants.
* The containing box creates a stacking context, therefore [`z-index`](z-index) can be used.
#### Paint containment
```
article {
contain: paint;
}
```
Paint containment essentially clips the box to the padding edge of the principal box. There can be no visible overflow. The same things are true for `paint` containment as `layout` containment (see above).
Another advantage is that if the containing box is offscreen, the browser does not need to paint its contained elements — these must also be offscreen as they are contained completely by that box.
#### Size containment
```
article {
contain: size;
}
```
Size containment does not offer much in the way of performance optimizations when used on its own. However, it means that the size of the element's children cannot affect the size of the element itself — its size is computed as if it had no children.
If you turn on `contain: size` you need to also specify the size of the element you have applied this to using [`contain-intrinsic-size`](contain-intrinsic-size) (or the equivalent longhand properties). It will end up being zero-sized in most cases, if you don't manually give it a size.
#### Style containment
```
article {
contain: style;
}
```
Despite the name, style containment does not provide scoped styles such as you would get with the [Shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM). The main use case is to prevent situations where a [CSS Counter](css_counter_styles/using_css_counters) could be changed in an element, which could then affect the rest of the tree.
Using `contain: style` would ensure that the [`counter-increment`](counter-increment) and [`counter-set`](counter-set) properties created new counters scoped to that subtree only.
**Note:** `style` containment is "at-risk" in the spec and may not be supported everywhere (it's not currently supported in Firefox).
#### Special values
There are two special values of contain:
* `content`
* `strict`
We encountered the first in the example above. Using `contain: content` turns on `layout` and `paint` containment. The specification describes this value as being "reasonably safe to apply widely". It does not apply `size` containment, so you would not be at risk of a box ending up zero-sized due to a reliance on the size of its children.
To gain as much containment as possible use `contain: strict`, which behaves the same as `contain: size layout paint style`:
```
contain: strict;
```
### `content-visibility`
[`content-visibility`](content-visibility) controls whether or not an element renders its contents at all, along with forcing a strong set of containments, allowing user agents to potentially omit large swathes of layout and rendering work until it becomes needed. Basically it enables the user agent to skip an element's rendering work (including layout and painting) until it is needed — which makes the initial page load much faster.
Its possible values are:
* `visible`: The default behavior — an element's contents are laid out and rendered as normal.
* `hidden`: The element skips its contents. The skipped contents must not be accessible to user agent features such as find-in-page, tab-order navigation, etc., nor be selectable or focusable.
* `auto`: The element turns on layout containment, style containment, and paint containment. If the element is not relevant to the user, it also skips its contents. Unlike `hidden`, the skipped contents must still be available as normal to user-agent features such as find-in-page, tab order navigation, etc., and must be focusable and selectable as normal.
### Relevant to the user
The specification refers to the concept of [relevant to the user](https://www.w3.org/TR/css-contain-2/#relevant-to-the-user). An element that is relevant to the user should be rendered, as it visible, and/or being interacted with by the user.
To be precise, an element is relevant to the user if any of the following are true:
* The element appears in the viewport, or a user-agent-defined margin around the viewport (50% of the viewport dimensions, to give the app time to prepare for when the element visibility changes).
* The element or its contents receive focus.
* The element or its contents are selected, for example by dragging over the text with the mouse cursor or by some other highlight operation.
* The element or its contents are placed in the top layer.
### Skips its contents
The specification refers to the concept of [skips its contents](https://www.w3.org/TR/css-contain-2/#skips-its-contents). This means that the element referred to is not relevant to the user and will not be rendered to improve performance.
To be precise, when an element skips its contents:
* It has layout, style, paint, and size containment turned on.
* Its contents are not painted, as if [`visibility: hidden`](visibility) was set on it.
* Its contents do not receive pointer events, as if [`pointer-events: none`](pointer-events) was set on it.
Reference
---------
### CSS Properties
* [`contain`](contain)
* [`content-visibility`](content-visibility)
Specifications
--------------
| Specification |
| --- |
| [CSS Containment Module Level 2 # contain-property](https://w3c.github.io/csswg-drafts/css-contain/#contain-property) |
| [CSS Containment Module Level 2 # content-visibility](https://w3c.github.io/csswg-drafts/css-contain/#content-visibility) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `CSS_Containment` | 85 | 85 | No | No | 71 | No | 85 | 85 | No | 60 | No | 14.0 |
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `CSS_Containment` | 52 | 79 | 69 | No | 39 | 15.4 | 52 | 52 | 79 | 41 | 15.4 | 6.0 |
| `inline-size` | 105 | 105 | 101 | No | 91 | 15.4 | 105 | 105 | 101 | 72 | 15.4 | No |
| `style` | 52 | 79 | 103 | No | 39 | 15.4 | 52 | 52 | 103 | 41 | 15.4 | 6.0 |
### css.properties.contain
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
### css.properties.content-visibility
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
See also
--------
* [An Introduction to CSS Containment](https://blogs.igalia.com/mrego/2019/01/11/an-introduction-to-css-containment/)
* The [`contentvisibilityautostatechanged`](https://developer.mozilla.org/en-US/docs/Web/API/Element/contentvisibilityautostatechanged_event) event
css repeat() repeat()
========
The `repeat()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) represents a repeated fragment of the [track list](css_grid_layout/basic_concepts_of_grid_layout), allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form.
Try it
------
This function can be used in the CSS Grid properties [`grid-template-columns`](grid-template-columns) and [`grid-template-rows`](grid-template-rows).
Syntax
------
```
/\* <track-repeat> values \*/
repeat(4, 1fr)
repeat(4, [col-start] 250px [col-end])
repeat(4, [col-start] 60% [col-end])
repeat(4, [col-start] 1fr [col-end])
repeat(4, [col-start] min-content [col-end])
repeat(4, [col-start] max-content [col-end])
repeat(4, [col-start] auto [col-end])
repeat(4, [col-start] minmax(100px, 1fr) [col-end])
repeat(4, [col-start] fit-content(200px) [col-end])
repeat(4, 10px [col-start] 30% [col-middle] auto [col-end])
repeat(4, [col-start] min-content [col-middle] max-content [col-end])
/\* <auto-repeat> values \*/
repeat(auto-fill, 250px)
repeat(auto-fit, 250px)
repeat(auto-fill, [col-start] 250px [col-end])
repeat(auto-fit, [col-start] 250px [col-end])
repeat(auto-fill, [col-start] minmax(100px, 1fr) [col-end])
repeat(auto-fill, 10px [col-start] 30% [col-middle] 400px [col-end])
/\* <fixed-repeat> values \*/
repeat(4, 250px)
repeat(4, [col-start] 250px [col-end])
repeat(4, [col-start] 60% [col-end])
repeat(4, [col-start] minmax(100px, 1fr) [col-end])
repeat(4, [col-start] fit-content(200px) [col-end])
repeat(4, 10px [col-start] 30% [col-middle] 400px [col-end])
```
The `repeat()` function takes two arguments:
* **repeat count**: the first argument specifies the number of times that the track list should be repeated. It is specified with an integer value of 1 or more, or with the keyword values [`auto-fill`](#auto-fill) or [`auto-fit`](#auto-fit). These keyword values repeat the set of tracks as many times as is needed to fill the grid container.
* **tracks**: the second argument specifies the set of tracks that will be repeated. Fundamentally this consists of one or more values, where each value represents the size of that track. Each size is specified using either a [`<track-size>`](#track-size) value or a [`<fixed-size>`](#fixed-size) value. You can also specify one or more [line names](css_grid_layout/layout_using_named_grid_lines) before or after each track, by providing [`<line-names>`](#line-names) values before and/or after the track size.
If you use [`auto-fill`](#auto-fill) or [`auto-fit`](#auto-fit) to set the repeat count, you may only specify track sizes using the [`<fixed-size>`](#fixed-size) type, not the [`<track-size>`](#track-size) type. This give us three main syntax forms for `repeat()`:
* `<track-repeat>`, which uses:
+ an integer to set the repeat count
+ [`<track-size>`](#track-size) values to set track sizes.
* `<auto-repeat>`, which uses
+ [`auto-fill`](#auto-fill) or [`auto-fit`](#auto-fit) to set the repeat count
+ [`<fixed-size>`](#fixed-size) to set track sizes.
* `<fixed-repeat>`, which uses:
+ an integer to set the repeat count
+ [`<fixed-size>`](#fixed-size) values to set track sizes.
Then if a property declaration uses `<auto-repeat>`, it is only allowed to use `<fixed-repeat>` for any additional `repeat()` calls. For example, this is invalid, because it combines the `<auto-repeat>` form with the `<track-repeat>` form:
```
.wrapper {
grid-template-columns:
repeat(auto-fill, 10px)
repeat(2, minmax(min-content, max-content));
}
```
There is a fourth form, `<name-repeat>`, which is used to add line names to subgrids. It only used with the [`subgrid`](css_grid_layout/subgrid) keyword and only specifies line names, not track sizes.
### Values
`<fixed-size>` One of the following forms:
* a [`<length-percentage>`](length-percentage) value
* a [`minmax()`](minmax) function with:
+ `min` given as a [`<length-percentage>`](length-percentage) value
+ `max` given as one of a [`<length-percentage>`](length-percentage) value, a [`<flex>`](flex_value) value, or one of the following keywords: [`min-content`](#min-content), [`max-content`](#max-content), or [`auto`](#auto)
* a [`minmax()`](minmax) function with:
+ `min` given as a [`<length-percentage>`](length-percentage) value or one of the following keywords: [`min-content`](#min-content), [`max-content`](#max-content), or [`auto`](#auto)
+ `max` given as a [`<length-percentage>`](length-percentage) value.
[`<flex>`](flex_value) A non-negative dimension with the unit `fr` specifying the track's flex factor. Each `<flex>`-sized track takes a share of the remaining space in proportion to its flex factor.
[`<length>`](length) A positive integer length.
`<line-names>` Zero or more [`<custom-ident>`](custom-ident) values, space-separated and enclosed in square brackets, like this: `[first header-start]`.
[`<percentage>`](percentage) A non-negative percentage relative to the inline size of the grid container in column grid tracks, and the block size of the grid container in row grid tracks. If the size of the grid container depends on the size of its tracks, then the `<percentage>` must be treated as `auto`. The user-agent may adjust the intrinsic size contributions of the track to the size of the grid container and increase the final size of the track by the minimum amount that would result in honoring the percentage.
`<track-size>` One of the following forms:
* a [`<length-percentage>`](length-percentage) value, a [`<flex>`](flex_value) value, or one of the following keywords: [`min-content`](#min-content), [`max-content`](#max-content), or [`auto`](#auto)
* a [`minmax()`](minmax) function with:
+ `min` given as a [`<length-percentage>`](length-percentage) value, or one of the following keywords: [`min-content`](#min-content), [`max-content`](#max-content), or [`auto`](#auto)
+ `max` given as a [`<length-percentage>`](length-percentage) value, a [`<flex>`](flex_value) value, or one of the following keywords: [`min-content`](#min-content), [`max-content`](#max-content), or [`auto`](#auto)
* a [`fit-content()`](fit-content_function) function, passed a [`<length-percentage>`](length-percentage) value.
`auto` As a maximum, identical to `max-content`. As a minimum it represents the largest minimum size (as specified by [`min-width`](min-width)/[`min-height`](min-height)) of the grid items occupying the grid track.
`auto-fill` If the grid container has a definite or maximal size in the relevant axis, then the number of repetitions is the largest possible positive integer that does not cause the grid to overflow its grid container. Treating each track as its maximal track sizing function (each independent value used to define `grid-template-rows` or `grid-template-columns`), if that is definite. Otherwise, as its minimum track sizing function, and taking grid-gap into account. If any number of repetitions would overflow, then the repetition is `1`. Otherwise, if the grid container has a definite minimal size in the relevant axis, the number of repetitions is the smallest possible positive integer that fulfills that minimum requirement. Otherwise, the specified track list repeats only once.
`auto-fit` Behaves the same as `auto-fill`, except that after placing the grid items any empty repeated tracks are collapsed. An empty track is one with no in-flow grid items placed into or spanning across it. (This can result in all tracks being collapsed, if they're all empty.)
A collapsed track is treated as having a single fixed track sizing function of `0px`, and the gutters on either side of it collapse.
For the purpose of finding the number of auto-repeated tracks, the user agent floors the track size to a user agent specified value (e.g., `1px`), to avoid division by zero.
`max-content` Represents the largest max-content contribution of the grid items occupying the grid track.
`min-content` Represents the largest min-content contribution of the grid items occupying the grid track.
Examples
--------
### Specifying grid columns using repeat()
#### HTML
```
<div id="container">
<div>This item is 50 pixels wide.</div>
<div>Item with flexible width.</div>
<div>This item is 50 pixels wide.</div>
<div>Item with flexible width.</div>
<div>Inflexible item of 100 pixels width.</div>
</div>
```
#### CSS
```
#container {
display: grid;
grid-template-columns: repeat(2, 50px 1fr) 100px;
grid-gap: 5px;
box-sizing: border-box;
height: 200px;
width: 100%;
background-color: #8cffa0;
padding: 10px;
}
#container > div {
background-color: #8ca0ff;
padding: 5px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Grid Layout Module Level 2 # repeat-notation](https://w3c.github.io/csswg-drafts/css-grid/#repeat-notation) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `repeat` | 57 | 16 | 76
57-76
`repeat(auto-fill, ...)` and `repeat(auto-fit, ...)` only support one repeated column (see [bug 1341507](https://bugzil.la/1341507)).
52-57
[`calc()`](https://developer.mozilla.org/docs/Web/CSS/calc) doesn't work in `repeat()` (see [bug 1350069](https://bugzil.la/1350069)). | No | 44 | 10.1 | 57 | 57 | 79
57-79
`repeat(auto-fill, ...)` and `repeat(auto-fit, ...)` only support one repeated column (see [bug 1341507](https://bugzil.la/1341507)).
52-57
[`calc()`](https://developer.mozilla.org/docs/Web/CSS/calc) doesn't work in `repeat()` (see [bug 1350069](https://bugzil.la/1350069)). | 43 | 10.3 | 6.0 |
See also
--------
* Related CSS properties: [`grid-template`](grid-template), [`grid-template-rows`](grid-template-rows), [`grid-template-columns`](grid-template-columns), [`grid-template-areas`](grid-template-areas), [`grid-auto-columns`](grid-auto-columns), [`grid-auto-rows`](grid-auto-rows), [`grid-auto-flow`](grid-auto-flow)
* Grid Layout Guide: *[Line-based placement with CSS Grid](css_grid_layout/line-based_placement_with_css_grid)*
* Grid Layout Guide: *[Grid template areas - Grid definition shorthands](css_grid_layout/grid_template_areas#grid_definition_shorthands)*
| programming_docs |
css var() var()
=====
The `var()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) can be used to insert the value of a [custom property](--*) (sometimes called a "CSS variable") instead of any part of a value of another property.
Try it
------
The `var()` function cannot be used in property names, selectors or anything else besides property values. (Doing so usually produces invalid syntax, or else a value whose meaning has no connection to the variable.)
Syntax
------
The first argument to the function is the name of the custom property to be substituted. An optional second argument to the function serves as a fallback value. If the custom property referenced by the first argument is invalid, the function uses the second value.
```
<var()> =
var( [<custom-property-name>](custom-property-name) , [<declaration-value>](declaration-value)[?](value_definition_syntax#question_mark) )
```
**Note:** The syntax of the fallback, like that of custom properties, allows commas. For example, `var(--foo, red, blue)` defines a fallback of `red, blue`; that is, anything between the first comma and the end of the function is considered a fallback value.
### Values
`<custom-property-name>` A custom property's name represented by an identifier that starts with two dashes. Custom properties are solely for use by authors and users; CSS will never give them a meaning beyond what is presented here.
`<declaration-value>` The custom property's fallback value, which is used in case the custom property is invalid in the used context. This value may contain any character except some characters with special meaning like newlines, unmatched closing brackets, i.e. `)`, `]`, or `}`, top-level semicolons, or exclamation marks. The fallback value can itself be a custom property using the `var()` syntax.
**Note:** `var(--a,)` is valid, specifying that if the `--a` custom property is invalid or missing, the `var()` should be replaced with nothing.
Examples
--------
### Using a custom property set on :root
```
:root {
--main-bg-color: pink;
}
body {
background-color: var(--main-bg-color);
}
```
### Custom properties with fallbacks for use when the property has not been set
```
/\* Fallback \*/
/\* In the component's style: \*/
.component .header {
/\* header-color isn't set, and so remains blue, the fallback value \*/
color: var(
--header-color,
blue
);
}
.component .text {
color: var(--text-color, black);
}
/\* In the larger application's style: \*/
.component {
--text-color: #080;
}
```
### Using a custom property as a fallback
```
:root {
--backup-bg-color: teal;
}
body {
/\* main-bg-color isn't set, it will fall back to backup-bg-color. If backup-bg-color isn't set it will fall back to white. \*/
color: var(--main-bg-color, var(--backup-bg-color, white));
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Custom Properties for Cascading Variables Module Level 1 # using-variables](https://w3c.github.io/csswg-drafts/css-variables/#using-variables) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `var()` | 49 | 15 | 31 | No | 36 | 9.1 | 50 | 49 | 31 | 36 | 9.3 | 5.0 |
See also
--------
* [`env(…)`](env) – read‑only environment variables controlled by the user‑agent.
* [Using CSS variables](using_css_custom_properties)
css gap gap
===
The `gap` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the gaps ([gutters](https://developer.mozilla.org/en-US/docs/Glossary/Gutters)) between rows and columns. It is a [shorthand](shorthand_properties) for [`row-gap`](row-gap) and [`column-gap`](column-gap).
Try it
------
Note that `grid-gap` is an alias for this property.
Syntax
------
```
/\* One <length> value \*/
gap: 20px;
gap: 1em;
gap: 3vmin;
gap: 0.5cm;
/\* One <percentage> value \*/
gap: 16%;
gap: 100%;
/\* Two <length> values \*/
gap: 20px 10px;
gap: 1em 0.5em;
gap: 3vmin 2vmax;
gap: 0.5cm 2mm;
/\* One or two <percentage> values \*/
gap: 16% 100%;
gap: 21px 82%;
/\* calc() values \*/
gap: calc(10% + 20px);
gap: calc(20px + 10%) calc(10% - 5px);
/\* Global values \*/
gap: inherit;
gap: initial;
gap: revert;
gap: revert-layer;
gap: unset;
```
This property is specified as a value for `<'row-gap'>` followed optionally by a value for `<'column-gap'>`. If `<'column-gap'>` is omitted, it's set to the same value as `<'row-gap'>`.
`<'row-gap'>` and `<'column-gap'>` are each specified as a `<length>` or a `<percentage>`.
### Values
[`<length>`](length) Is the width of the gutter separating the grid lines.
[`<percentage>`](percentage) Is the width of the gutter separating the grid lines, relative to the dimension of the element.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`row-gap`](row-gap): `normal`
* [`column-gap`](column-gap): `normal`
|
| Applies to | multi-column elements, flex containers, grid containers |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`row-gap`](row-gap): as specified, with <length>s made absolute, and normal computing to zero except on multi-column elements
* [`column-gap`](column-gap): as specified, with <length>s made absolute, and normal computing to zero except on multi-column elements
|
| Animation type | as each of the properties of the shorthand:* [`row-gap`](row-gap): a [length](length#interpolation), [percentage](percentage#interpolation) or calc();
* [`column-gap`](column-gap): a [length](length#interpolation), [percentage](percentage#interpolation) or calc();
|
Formal syntax
-------------
```
gap =
<'row-gap'> <'column-gap'>[?](value_definition_syntax#question_mark)
```
Examples
--------
### Flex layout
#### HTML
```
<div id="flexbox">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
```
#### CSS
```
#flexbox {
display: flex;
flex-wrap: wrap;
width: 300px;
gap: 20px 5px;
}
#flexbox > div {
border: 1px solid green;
background-color: lime;
flex: 1 1 auto;
width: 100px;
height: 50px;
}
```
#### Result
### Grid layout
#### HTML
```
<div id="grid">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
```
#### CSS
```
#grid {
display: grid;
height: 200px;
grid-template: repeat(3, 1fr) / repeat(3, 1fr);
gap: 20px 5px;
}
#grid > div {
border: 1px solid green;
background-color: lime;
}
```
#### Result
### Multi-column layout
#### HTML
```
<p class="content-box">
This is some multi-column text with a 40px column gap created with the CSS
<code>gap</code> property. Don't you think that's fun and exciting? I sure do!
</p>
```
#### CSS
```
.content-box {
column-count: 3;
gap: 40px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Box Alignment Module Level 3 # gap-shorthand](https://w3c.github.io/csswg-drafts/css-align/#gap-shorthand) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `gap` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 7.0 |
| `flex_context` | 84 | 84 | 63 | No | 70 | 14.1 | 84 | 84 | 63 | 60 | 14.5 | 14.0 |
| `grid_context` | 66
57 | 16
16 | 61
52 | No | 53
44 | 12
10.1 | 66
57 | 66
57 | 61
52 | 47
43 | 12
10.3 | 9.0
7.0 |
| `multicol_context` | 66 | 16 | 61 | No | 53 | No | 66 | 66 | 61 | 47 | No | 9.0 |
See also
--------
* Related CSS properties: [`row-gap`](row-gap), [`column-gap`](column-gap)
* Grid Layout Guide: *[Basic concepts of grid layout - Gutters](css_grid_layout/basic_concepts_of_grid_layout#gutters)*
css overscroll-behavior-inline overscroll-behavior-inline
==========================
The `overscroll-behavior-inline` CSS property sets the browser's behavior when the inline direction boundary of a scrolling area is reached.
See [`overscroll-behavior`](overscroll-behavior) for a full explanation.
```
/\* Keyword values \*/
overscroll-behavior-inline: auto; /\* default \*/
overscroll-behavior-inline: contain;
overscroll-behavior-inline: none;
/\* Global values \*/
overscroll-behavior-inline: inherit;
overscroll-behavior-inline: initial;
overscroll-behavior-inline: revert;
overscroll-behavior-inline: revert-layer;
overscroll-behavior-inline: unset;
```
Syntax
------
The `overscroll-behavior-inline` property is specified as a keyword chosen from the list of values below.
### Values
`auto` The default scroll overflow behavior occurs as normal.
`contain` Default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighboring scrolling areas, e.g. underlying elements will not scroll.
`none` No scroll chaining occurs to neighboring scrolling areas, and default scroll overflow behavior is prevented.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | non-replaced block-level elements and non-replaced inline-block elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
overscroll-behavior-inline =
contain [|](value_definition_syntax#single_bar)
none [|](value_definition_syntax#single_bar)
auto
```
Examples
--------
### Preventing inline overscrolling
In this demo we have two block-level boxes, one inside the other. The outer box has a large [`width`](width) set on it so the page will scroll horizontally. The inner box has a small width (and [`height`](height)) set on it so it sits comfortably inside the viewport, but its content is given a large width so it will also scroll horizontally.
By default, when the inner box is scrolled and a scroll boundary is reached, the whole page will begin to scroll, which is probably not what we want. To avoid this happening in the inline direction, we've set `overscroll-behavior-inline: contain` on the inner box.
#### HTML
```
<main>
<div>
<div>
<p>
<code>overscroll-behavior-inline</code> has been used to make it so that
when the scroll boundaries of the yellow inner box are reached, the
whole page does not begin to scroll.
</p>
</div>
</div>
</main>
```
#### CSS
```
main {
height: 400px;
width: 3000px;
background-color: white;
background-image: repeating-linear-gradient(
to right,
rgba(0, 0, 0, 0) 0px,
rgba(0, 0, 0, 0) 19px,
rgba(0, 0, 0, 0.5) 20px
);
}
main > div {
height: 300px;
width: 400px;
overflow: auto;
position: relative;
top: 50px;
left: 50px;
overscroll-behavior-inline: contain;
}
div > div {
height: 100%;
width: 1500px;
background-color: yellow;
background-image: repeating-linear-gradient(
to right,
rgba(0, 0, 0, 0) 0px,
rgba(0, 0, 0, 0) 19px,
rgba(0, 0, 0, 0.5) 20px
);
}
p {
padding: 10px;
background-color: rgba(255, 0, 0, 0.5);
margin: 0;
width: 360px;
position: relative;
top: 10px;
left: 10px;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Overscroll Behavior Module Level 1 # overscroll-behavior-longhands-logical](https://w3c.github.io/csswg-drafts/css-overscroll/#overscroll-behavior-longhands-logical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `overscroll-behavior-inline` | 77 | 79 | 73 | No | 64 | 16 | 77 | 77 | No | 55 | 16 | 12.0 |
See also
--------
* [Take control of your scroll: customizing pull-to-refresh and overflow effects](https://developer.chrome.com/blog/overscroll-behavior/#demo)
css :picture-in-picture :picture-in-picture
===================
The `:picture-in-picture` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) matches the element which is currently in picture-in-picture mode.
Syntax
------
```
:picture-in-picture
```
Usage notes
-----------
The `:picture-in-picture` pseudo-class lets you configure your stylesheets to automatically adjust the size, style, or layout of content when a video switches back and forth between picture-in-picture and traditional presentation modes.
Examples
--------
In this example, a video has a box shadow when it is displayed in the floating window.
### HTML
The page's HTML looks like this:
```
<h1>MDN Web Docs Demo: :picture-in-picture pseudo-class</h1>
<p>
This demo uses the <code>:picture-in-picture</code> pseudo-class to
automatically change the style of a video entirely using CSS.
</p>
<video id="pip-video"></video>
```
The [`<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) with the ID `"pip-video"` will change between having a red box shadow or not, depending on whether or not it is displayed in the picture-in-picture floating window.
### CSS
The magic happens in the CSS.
```
:picture-in-picture {
box-shadow: 0 0 0 5px red;
}
```
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # pip-state](https://w3c.github.io/csswg-drafts/selectors/#pip-state) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:picture-in-picture` | 76 | 79 | No | No | 63 | No | 76 | 76 | No | 54 | No | 12.0 |
See also
--------
* [Picture-in-picture API](https://developer.mozilla.org/en-US/docs/Web/API/Picture-in-Picture_API)
* [`HTMLVideoElement.requestPictureInPicture()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/requestPictureInPicture)
* [`HTMLVideoElement.autoPictureInPicture`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/autoPictureInPicture)
* [`HTMLVideoElement.disablePictureInPicture`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/disablePictureInPicture)
* [`Document.pictureInPictureEnabled`](https://developer.mozilla.org/en-US/docs/Web/API/Document/pictureInPictureEnabled)
* [`Document.exitPictureInPicture()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/exitPictureInPicture)
* [`Document.pictureInPictureElement`](https://developer.mozilla.org/en-US/docs/Web/API/Document/pictureInPictureElement)
css CSS Table CSS Table
=========
**CSS Table** is a CSS module that defines how to lay out table data.
Reference
---------
### Properties
* [`border-collapse`](border-collapse)
* [`border-spacing`](border-spacing)
* [`caption-side`](caption-side)
* [`empty-cells`](empty-cells)
* [`table-layout`](table-layout)
* [`vertical-align`](vertical-align)
Specifications
--------------
| Specification |
| --- |
| [Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification](https://www.w3.org/TR/CSS22/tables.html) |
css @color-profile @color-profile
==============
The `@color-profile` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) <at-rule> defines and names a color profile which can later be used in the [`color()`](color_value/color) function to specify a color.
Syntax
------
```
@color-profile --swop5c {
src: url("https://example.org/SWOP2006\_Coated5v2.icc");
}
```
### Descriptors
`src` Specifies the URL to retrieve the color-profile information from.
`rendering-intent` If the color profile contains more than one rendering intent, this descriptor allows one to be selected as the one to use to define how to map the color to smaller [gamut](https://developer.mozilla.org/en-US/docs/Glossary/Gamut)s than this profile is defined over.
If used, it must be one of the following keywords:
`relative-colorimetric` Media-relative colorimetric is required to leave source colors that fall inside the destination medium [gamut](https://developer.mozilla.org/en-US/docs/Glossary/Gamut) unchanged relative to the respective media white points. Source colors that are out of the destination medium gamut are mapped to colors on the gamut boundary using a variety of different methods.
`absolute-colorimetric` ICC-absolute colorimetric is required to leave source colors that fall inside the destination medium [gamut](https://developer.mozilla.org/en-US/docs/Glossary/Gamut) unchanged relative to the adopted white (a perfect reflecting diffuser). Source colors that are out of the destination medium gamut are mapped to colors on the gamut boundary using a variety of different methods.
`perceptual` This method is often the preferred choice for images, especially when there are substantial differences between the source and destination (such as a screen display image reproduced on a reflection print). It takes the colors of the source image and re-optimizes the appearance for the destination medium using proprietary methods.
`saturation` This option was created to preserve the relative saturation (chroma) of the original, and to keep solid colors pure. However, it experienced interoperability problems like the perceptual intent.
Examples
--------
This example is from the specification and demonstrates using offset printing to ISO 12647-2:2004 using the CGATS/SWOP TR005 2007 characterization data on grade 5 paper with an ink limit of 300% Total Area Coverage, and medium gray component replacement (GCR).
The `src` descriptor specifies the URL to retrieve the color-profile information from.
```
@color-profile --swop5c {
src: url("https://example.org/SWOP2006\_Coated5v2.icc");
}
.header {
background-color: color(--swop5c 0% 70% 20% 0%);
}
```
Formal syntax
-------------
```
@color-profile =
@color-profile [[](value_definition_syntax#brackets) [<dashed-ident>](dashed-ident) [|](value_definition_syntax#single_bar) device-cmyk []](value_definition_syntax#brackets) { [<declaration-list>](declaration-list) }
```
Specifications
--------------
**No specification found**No specification data found for `css.at-rules.color-profile`.
[Check for problems with this page](#on-github) or contribute a missing `spec_url` to [mdn/browser-compat-data](https://github.com/mdn/browser-compat-data). Also make sure the specification is included in [w3c/browser-specs](https://github.com/w3c/browser-specs).
Browser compatibility
---------------------
No compatibility data found for `css.at-rules.color-profile`.
[Check for problems with this page](#on-github) or contribute missing data to [mdn/browser-compat-data](https://github.com/mdn/browser-compat-data).
css scroll-margin-right scroll-margin-right
===================
The `scroll-margin-right` property defines the right margin of the scroll snap area that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets.
Try it
------
Syntax
------
```
/\* <length> values \*/
scroll-margin-right: 10px;
scroll-margin-right: 1em;
/\* Global values \*/
scroll-margin-right: inherit;
scroll-margin-right: initial;
scroll-margin-right: revert;
scroll-margin-right: revert-layer;
scroll-margin-right: unset;
```
### Values
`<length>` An outset from the right edge of the scroll container.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `0` |
| Applies to | all elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-margin-right =
[<length>](length)
```
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # margin-longhands-physical](https://w3c.github.io/csswg-drafts/css-scroll-snap/#margin-longhands-physical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-margin-right` | 69 | 79 | 68 | No | 56 | 14.1
11
Before version 14.1, scroll margin is not applied for scrolls to fragment target or `scrollIntoView()`, see [bug 189265](https://webkit.org/b/189265). | 69 | 69 | 68 | 48 | 14.5
11
Before version 14.5, scroll margin is not applied for scrolls to fragment target or `scrollIntoView()`, see [bug 189265](https://webkit.org/b/189265). | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
| programming_docs |
css scroll-padding-inline scroll-padding-inline
=====================
The `scroll-padding-inline` [shorthand property](shorthand_properties) sets the scroll padding of an element in the inline dimension.
Try it
------
The scroll-padding properties define offsets for the *optimal viewing region* of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or to put more breathing room between a targeted element and the edges of the scrollport.
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`scroll-padding-inline-end`](scroll-padding-inline-end)
* [`scroll-padding-inline-start`](scroll-padding-inline-start)
Syntax
------
```
/\* Keyword values \*/
scroll-padding-inline: auto;
/\* <length> values \*/
scroll-padding-inline: 10px;
scroll-padding-inline: 1em 0.5em;
scroll-padding-inline: 10%;
/\* Global values \*/
scroll-padding-inline: inherit;
scroll-padding-inline: initial;
scroll-padding-inline: revert;
scroll-padding-inline: revert-layer;
scroll-padding-inline: unset;
```
### Values
`<length-percentage>` An inwards offset from the corresponding edge of the scrollport, as a valid length or a percentage.
`auto` The offset is determined by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`scroll-padding-inline-start`](scroll-padding-inline-start): `auto`
* [`scroll-padding-inline-end`](scroll-padding-inline-end): `auto`
|
| Applies to | scroll containers |
| [Inherited](inheritance) | no |
| Percentages | relative to the scroll container's scrollport |
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`scroll-padding-inline-start`](scroll-padding-inline-start): as specified
* [`scroll-padding-inline-end`](scroll-padding-inline-end): as specified
|
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-padding-inline =
[[](value_definition_syntax#brackets) auto [|](value_definition_syntax#single_bar) [<length-percentage [0,∞]>](length-percentage) []](value_definition_syntax#brackets)[{1,2}](value_definition_syntax#curly_braces)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # propdef-scroll-padding-inline](https://w3c.github.io/csswg-drafts/css-scroll-snap/#propdef-scroll-padding-inline) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-padding-inline` | 69 | 79 | 68 | No | 56 | 15 | 69 | 69 | 68 | 48 | 15 | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
css CSS Images CSS Images
==========
**CSS Images** is a module of CSS that defines what types of images can be used (the [`<image>`](image) type, containing URLs, gradients and other types of images), how to resize them and how they, and other replaced content, interact with the different layout models.
Reference
---------
### Properties
* [`image-orientation`](image-orientation)
* [`image-rendering`](image-rendering)
* [`image-resolution`](image-resolution)
* [`object-fit`](object-fit)
* [`object-position`](object-position)
### Functions
* [`linear-gradient()`](gradient/linear-gradient)
* [`radial-gradient()`](gradient/radial-gradient)
* [`repeating-linear-gradient()`](gradient/repeating-linear-gradient)
* [`repeating-radial-gradient()`](gradient/repeating-radial-gradient)
* [`conic-gradient()`](gradient/conic-gradient)
* [`repeating-conic-gradient()`](gradient/repeating-conic-gradient)
* [`url()`](url)
* [`element()`](element())
* [`image()`](image/image)
* [`cross-fade()`](cross-fade)
### Data types
* [`<gradient>`](gradient)
* [`<image>`](image)
Guides
------
[Using CSS gradients](css_images/using_css_gradients) Presents a specific type of CSS images, *gradients*, and how to create and use these.
[Implementing image sprites in CSS](css_images/implementing_image_sprites_in_css) Describes the common technique grouping several images in one single document to save download requests and speed up the availability of a page.
Specifications
--------------
| Specification |
| --- |
| [CSS Images Module Level 3](https://drafts.csswg.org/css-images/) |
| [Compatibility Standard # css-%3Cimage%3E-type](https://compat.spec.whatwg.org/#css-%3Cimage%3E-type) |
| [CSS Values and Units Module Level 4 # urls](https://drafts.csswg.org/css-values/#urls) |
css text-decoration-skip-ink text-decoration-skip-ink
========================
The `text-decoration-skip-ink` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property specifies how overlines and underlines are drawn when they pass over glyph ascenders and descenders.
Try it
------
`text-decoration-skip-ink` is not part of the [`text-decoration`](text-decoration) shorthand.
Syntax
------
```
/\* Single keyword \*/
text-decoration-skip-ink: none;
text-decoration-skip-ink: auto;
text-decoration-skip-ink: all;
/\* Global keywords \*/
text-decoration-skip-ink: inherit;
text-decoration-skip-ink: initial;
text-decoration-skip-ink: revert;
text-decoration-skip-ink: revert-layer;
text-decoration-skip-ink: unset;
```
### Values
`none` Underlines and overlines are drawn across the full length of the text content, including parts that cross over glyph descenders and ascenders.
`auto` The default — the browser *may* interrupt underlines and overlines so that they do not touch or closely approach a glyph. That is, they are interrupted where they would otherwise cross over a glyph.
`all` The browser *must* interrupt underlines and overlines so that they do not touch or closely approach a glyph. This can be helpful with certain Chinese, Japanese, or Korean (CJK) fonts, where the `auto` behavior might not create interruptions.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | all elements |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
text-decoration-skip-ink =
auto [|](value_definition_syntax#single_bar)
none [|](value_definition_syntax#single_bar)
all
```
Examples
--------
### HTML
```
<p>You should go on a quest for a cup of coffee.</p>
<p class="no-skip-ink">Or maybe you'd prefer some tea?</p>
<p>この文は、 text-decoration-skip-ink: auto の使用例を示しています。</p>
<p class="skip-ink-all">
この文は、 text-decoration-skip-ink: all の使用例を示しています。
</p>
```
### CSS
```
p {
font-size: 1.5em;
text-decoration: underline blue;
text-decoration-skip-ink: auto; /\* this is the default anyway \*/
}
.no-skip-ink {
text-decoration-skip-ink: none;
}
.skip-ink-all {
text-decoration-skip-ink: all;
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Text Decoration Module Level 4 # text-decoration-skip-ink-property](https://w3c.github.io/csswg-drafts/css-text-decor-4/#text-decoration-skip-ink-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `text-decoration-skip-ink` | 64 | 79 | 70 | No | 50 | 15.4 | 64 | 64 | No | 46 | 15.4 | 9.0 |
| `all` | No | No | 75 | No | No | preview | No | No | No | No | No | No |
See also
--------
* [`text-decoration`](text-decoration)
* [`text-decoration-skip`](text-decoration-skip)
css :root :root
=====
The `:root` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) matches the root element of a tree representing the document. In HTML, `:root` represents the [`<html>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html) element and is identical to the selector `html`, except that its <specificity> is higher.
```
/\* Selects the root element of the document:
<html> in the case of HTML \*/
:root {
background: yellow;
}
```
Syntax
------
```
:root
```
Examples
--------
### Declaring global CSS variables
`:root` can be useful for declaring global [CSS variables](using_css_custom_properties):
```
:root {
--main-color: hotpink;
--pane-padding: 5px 42px;
}
```
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # root-pseudo](https://w3c.github.io/csswg-drafts/selectors/#root-pseudo) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:root` | 1 | 12 | 1 | 9 | 9.5 | 1 | 37 | 18 | 4 | 14 | 1 | 1.0 |
See also
--------
* [`<html>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html)
* [`Document.rootElement`](https://developer.mozilla.org/en-US/docs/Web/API/Document/rootElement)
* [`Node.getRootNode()`](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode)
* [`Element.shadowRoot`](https://developer.mozilla.org/en-US/docs/Web/API/Element/shadowRoot)
* [`ShadowRoot`](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot)
css grid-row-start grid-row-start
==============
The `grid-row-start` CSS property specifies a grid item's start position within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start edge of its [grid area](https://developer.mozilla.org/en-US/docs/Glossary/Grid_Areas).
Try it
------
Syntax
------
```
/\* Keyword value \*/
grid-row-start: auto;
/\* <custom-ident> values \*/
grid-row-start: somegridarea;
/\* <integer> + <custom-ident> values \*/
grid-row-start: 2;
grid-row-start: somegridarea 4;
/\* span + <integer> + <custom-ident> values \*/
grid-row-start: span 3;
grid-row-start: span somegridarea;
grid-row-start: 5 somegridarea span;
/\* Global values \*/
grid-row-start: inherit;
grid-row-start: initial;
grid-row-start: revert;
grid-row-start: revert-layer;
grid-row-start: unset;
```
This property is specified as a single `<grid-line>` value. A `<grid-line>` value can be specified as:
* either the `auto` keyword
* or a `<custom-ident>` value
* or an `<integer>` value
* or both `<custom-ident>` and `<integer>`, separated by a space
* or the keyword `span` together with either a `<custom-ident>` or an `<integer>` or both.
### Values
`auto` Is a keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement, an automatic span, or a default span of `1`.
`<custom-ident>` If there is a named line with the name '<custom-ident>-start', it contributes the first such line to the grid item's placement.
**Note:** Named grid areas automatically generate implicit named lines of this form, so specifying `grid-row-start: foo;` will choose the start edge of that named grid area (unless another line named `foo-start` was explicitly specified before it).
Otherwise, this is treated as if the integer `1` had been specified along with the `<custom-ident>`.
`<integer> && <custom-ident>?` Contributes the nth grid line to the grid item's placement. If a negative integer is given, it instead counts in reverse, starting from the end edge of the explicit grid.
If a name is given as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position.
An [`<integer>`](integer) value of `0` is invalid.
`span && [ <integer> || <custom-ident> ]` Contributes a grid span to the grid item's placement; such that the row start edge of the grid item's grid area is n lines from the end edge.
If a name is given as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines on the side of the explicit grid, corresponding to the search direction, are assumed to have that name for the purpose of counting this span.
If the <integer> is omitted, it defaults to `1`. Negative integers or 0 are invalid.
The `<custom-ident>` cannot take the `span` value.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | grid items and absolutely-positioned boxes whose containing block is a grid container |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
grid-row-start =
<grid-line>
<grid-line> =
auto [|](value_definition_syntax#single_bar)
[<custom-ident>](custom-ident) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) [<integer [-∞,-1]>](integer) [|](value_definition_syntax#single_bar) [<integer [1,∞]>](integer) []](value_definition_syntax#brackets) [&&](value_definition_syntax#double_ampersand) [<custom-ident>](custom-ident)[?](value_definition_syntax#question_mark) []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) span [&&](value_definition_syntax#double_ampersand) [[](value_definition_syntax#brackets) [<integer [1,∞]>](integer) [||](value_definition_syntax#double_bar) [<custom-ident>](custom-ident) []](value_definition_syntax#brackets) []](value_definition_syntax#brackets)
```
Examples
--------
### Setting row start for a grid item
#### HTML
```
<div class="wrapper">
<div class="box1">One</div>
<div class="box2">Two</div>
<div class="box3">Three</div>
<div class="box4">Four</div>
<div class="box5">Five</div>
</div>
```
#### CSS
```
.wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: 100px;
}
.box1 {
grid-column-start: 1;
grid-column-end: 4;
grid-row-start: 1;
grid-row-end: 3;
}
.box2 {
grid-column-start: 1;
grid-row-start: 3;
grid-row-end: 5;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Grid Layout Module Level 2 # line-placement](https://w3c.github.io/csswg-drafts/css-grid/#line-placement) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `grid-row-start` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
See also
--------
* Related CSS properties: [`grid-row-end`](grid-row-end), [`grid-row`](grid-row), [`grid-column-start`](grid-column-start), [`grid-column-end`](grid-column-end), [`grid-column`](grid-column)
* Grid Layout Guide: *[Line-based placement with CSS Grid](css_grid_layout/line-based_placement_with_css_grid)*
* Video tutorial: *[Line-based placement](https://gridbyexample.com/video/series-line-based-placement/)*
css border-right-color border-right-color
==================
The `border-right-color` CSS property sets the color of an element's right <border>. It can also be set with the shorthand CSS properties [`border-color`](border-color) or [`border-right`](border-right).
Try it
------
Syntax
------
```
/\* <color> values \*/
border-right-color: red;
border-right-color: #ffbb00;
border-right-color: rgb(255 0 0);
border-right-color: hsl(100deg 50% 25% / 0.75);
border-right-color: currentcolor;
border-right-color: transparent;
/\* Global values \*/
border-right-color: inherit;
border-right-color: initial;
border-right-color: revert;
border-right-color: revert-layer;
border-right-color: unset;
```
The `border-right-color` property is specified as a single value.
### Values
[`<color>`](color_value) The color of the right border.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `currentcolor` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | computed color |
| Animation type | a [color](color_value#interpolation) |
Formal syntax
-------------
```
border-right-color =
[<color>](color_value)
```
Examples
--------
### A simple div with a border
#### HTML
```
<div class="mybox">
<p>
This is a box with a border around it. Note which side of the box is
<span class="redtext">red</span>.
</p>
</div>
```
#### CSS
```
.mybox {
border: solid 0.3em gold;
border-right-color: red;
width: auto;
}
.redtext {
color: red;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # border-color](https://w3c.github.io/csswg-drafts/css-backgrounds/#border-color) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-right-color` | 1 | 12 | 1
Firefox also supports the non-standard [`-moz-border-right-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-right-colors) CSS property that sets the right border to multiple colors. | 4 | 3.5 | 1 | 4.4 | 18 | 4
Firefox also supports the non-standard [`-moz-border-right-colors`](https://developer.mozilla.org/docs/Web/CSS/-moz-border-right-colors) CSS property that sets the right border to multiple colors. | 10.1 | 1 | 1.0 |
See also
--------
* The border-related CSS shorthand properties: [`border`](border), [`border-right`](border-right), and [`border-color`](border-color).
* The color-related CSS properties for the other borders: [`border-left-color`](border-left-color), [`border-bottom-color`](border-bottom-color), and [`border-top-color`](border-top-color).
* The other border-related CSS properties applying to the same border: [`border-right-style`](border-right-style) and [`border-right-width`](border-right-width).
css grid-column-end grid-column-end
===============
The `grid-column-end` CSS property specifies a grid item's end position within the grid column by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the block-end edge of its [grid area](https://developer.mozilla.org/en-US/docs/Glossary/Grid_Areas).
Try it
------
Syntax
------
```
/\* Keyword value \*/
grid-column-end: auto;
/\* <custom-ident> values \*/
grid-column-end: somegridarea;
/\* <integer> + <custom-ident> values \*/
grid-column-end: 2;
grid-column-end: somegridarea 4;
/\* span + <integer> + <custom-ident> values \*/
grid-column-end: span 3;
grid-column-end: span somegridarea;
grid-column-end: 5 somegridarea span;
/\* Global values \*/
grid-column-end: inherit;
grid-column-end: initial;
grid-column-end: revert;
grid-column-end: revert-layer;
grid-column-end: unset;
```
### Values
`auto` Is a keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement, an automatic span, or a default span of `1`.
`<custom-ident>` If there is a named line with the name '<custom-ident>-end', it contributes the first such line to the grid item's placement.
**Note:** Named grid areas automatically generate implicit named lines of this form, so specifying `grid-column-end: foo;` will choose the end edge of that named grid area (unless another line named `foo-end` was explicitly specified before it).
Otherwise, this is treated as if the integer `1` had been specified along with the `<custom-ident>`.
`<integer> && <custom-ident>?` Contributes the nth grid line to the grid item's placement. If a negative integer is given, it instead counts in reverse, starting from the end edge of the explicit grid.
If a name is given as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position.
An [`<integer>`](integer) value of `0` is invalid.
`span && [ <integer> || <custom-ident> ]` Contributes a grid span to the grid item's placement such that the column end edge of the grid item's grid area is n lines from the start edge.
If a name is given as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines on the side of the explicit grid corresponding to the search direction are assumed to have that name for the purpose of counting this span.
If the <integer> is omitted, it defaults to `1`. Negative integers or 0 are invalid.
The `<custom-ident>` cannot take the `span` value.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | grid items and absolutely-positioned boxes whose containing block is a grid container |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
grid-column-end =
<grid-line>
<grid-line> =
auto [|](value_definition_syntax#single_bar)
[<custom-ident>](custom-ident) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) [<integer [-∞,-1]>](integer) [|](value_definition_syntax#single_bar) [<integer [1,∞]>](integer) []](value_definition_syntax#brackets) [&&](value_definition_syntax#double_ampersand) [<custom-ident>](custom-ident)[?](value_definition_syntax#question_mark) []](value_definition_syntax#brackets) [|](value_definition_syntax#single_bar)
[[](value_definition_syntax#brackets) span [&&](value_definition_syntax#double_ampersand) [[](value_definition_syntax#brackets) [<integer [1,∞]>](integer) [||](value_definition_syntax#double_bar) [<custom-ident>](custom-ident) []](value_definition_syntax#brackets) []](value_definition_syntax#brackets)
```
Examples
--------
### Setting column end for a grid item
#### HTML
```
<div class="wrapper">
<div class="box1">One</div>
<div class="box2">Two</div>
<div class="box3">Three</div>
<div class="box4">Four</div>
<div class="box5">Five</div>
</div>
```
#### CSS
```
.wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: 100px;
}
.box1 {
grid-column-start: 1;
grid-column-end: 4;
grid-row-start: 1;
grid-row-end: 3;
}
.box2 {
grid-column-start: 1;
grid-row-start: 3;
grid-row-end: 5;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Grid Layout Module Level 2 # line-placement](https://w3c.github.io/csswg-drafts/css-grid/#line-placement) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `grid-column-end` | 57 | 16 | 52 | No | 44 | 10.1 | 57 | 57 | 52 | 43 | 10.3 | 6.0 |
See also
--------
* Related CSS properties: [`grid-column-start`](grid-column-start), [`grid-column`](grid-column), [`grid-row-start`](grid-row-start), [`grid-row-end`](grid-row-end), [`grid-row`](grid-row)
* Grid Layout Guide: *[Line-based placement with CSS Grid](css_grid_layout/line-based_placement_with_css_grid)*
* Video tutorial: *[Line-based placement](https://gridbyexample.com/video/series-line-based-placement/)*
| programming_docs |
css visibility visibility
==========
The `visibility` CSS property shows or hides an element without changing the layout of a document. The property can also hide rows or columns in a [`<table>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table).
Try it
------
To both hide an element *and remove it from the document layout*, set the [`display`](display) property to `none` instead of using `visibility`.
Syntax
------
```
/\* Keyword values \*/
visibility: visible;
visibility: hidden;
visibility: collapse;
/\* Global values \*/
visibility: inherit;
visibility: initial;
visibility: revert;
visibility: revert-layer;
visibility: unset;
```
The `visibility` property is specified as one of the keyword values listed below.
### Values
`visible` The element box is visible.
`hidden` The element box is invisible (not drawn), but still affects layout as normal. Descendants of the element will be visible if they have `visibility` set to `visible`. The element cannot receive focus (such as when navigating through [tab indexes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex)).
`collapse` The `collapse` keyword has different effects for different elements:
* For [`<table>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table) rows, columns, column groups, and row groups, the row(s) or column(s) are hidden and the space they would have occupied is removed (as if `[`display`](display): none` were applied to the column/row of the table). However, the size of other rows and columns is still calculated as though the cells in the collapsed row(s) or column(s) are present. This value allows for the fast removal of a row or column from a table without forcing the recalculation of widths and heights for the entire table.
* Collapsed flex items and ruby annotations are hidden, and the space they would have occupied is removed.
* For other elements, `collapse` is treated the same as `hidden`.
Accessibility concerns
----------------------
Using a `visibility` value of `hidden` on an element will remove it from the [accessibility tree](https://developer.mozilla.org/en-US/docs/Learn/Accessibility/What_is_accessibility#accessibility_apis). This will cause the element and all its descendant elements to no longer be announced by screen reading technology.
Interpolation
-------------
When animated, visibility values are interpolated between *visible* and *not-visible*. One of the start or ending values must therefore be `visible` or no [interpolation](https://developer.mozilla.org/en-US/docs/Glossary/Interpolation) can happen. The value is interpolated as a discrete step, where values of the timing function between `0` and `1` map to `visible` and other values of the timing function (which occur only at the start/end of the transition or as a result of `cubic-bezier()` functions with y values outside of [0, 1]) map to the closer endpoint.
Notes
-----
* Support for `visibility: collapse` is missing or partially incorrect in some modern browsers. It may not be correctly treated like `visibility: hidden` on elements other than table rows and columns.
* `visibility: collapse` may change the layout of a table if the table has nested tables within the cells that are collapsed, unless `visibility: visible` is specified explicitly on nested tables.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `visible` |
| Applies to | all elements |
| [Inherited](inheritance) | yes |
| [Computed value](computed_value) | as specified |
| Animation type | a [visibility](visibility#interpolation) |
Formal syntax
-------------
```
visibility =
visible [|](value_definition_syntax#single_bar)
hidden [|](value_definition_syntax#single_bar)
collapse
```
Examples
--------
### Basic example
#### HTML
```
<p class="visible">The first paragraph is visible.</p>
<p class="not-visible">The second paragraph is NOT visible.</p>
<p class="visible">
The third paragraph is visible. Notice the second paragraph is still occupying
space.
</p>
```
#### CSS
```
.visible {
visibility: visible;
}
.not-visible {
visibility: hidden;
}
```
### Table example
#### HTML
```
<table>
<tr>
<td>1.1</td>
<td class="collapse">1.2</td>
<td>1.3</td>
</tr>
<tr class="collapse">
<td>2.1</td>
<td>2.2</td>
<td>2.3</td>
</tr>
<tr>
<td>3.1</td>
<td>3.2</td>
<td>3.3</td>
</tr>
</table>
```
#### CSS
```
.collapse {
visibility: collapse;
}
table {
border: 1px solid red;
}
td {
border: 1px solid gray;
}
```
Specifications
--------------
| Specification |
| --- |
| [Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification # visibility](https://w3c.github.io/csswg-drafts/css2/#visibility) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `visibility` | 1 | 12 | 1 | 4
["Internet Explorer doesn't support `visibility: initial`.", "Internet Explorer doesn't support `visibility: unset`.", "Up to Internet Explorer 7, descendants of `hidden` elements will still be invisible even if they have `visibility` set to `visible`."] | 4 | 1 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
| `collapse` | 1
["Chrome treats `visibility: collapse` like `hidden`, leaving a white gap.", "Chrome supports the `collapse` value only on [`<tr>`](https://developer.mozilla.org/docs/Web/HTML/Element/tr), [`<thead>`](https://developer.mozilla.org/docs/Web/HTML/Element/thead), [`<tbody>`](https://developer.mozilla.org/docs/Web/HTML/Element/tbody), and [`<tfoot>`](https://developer.mozilla.org/docs/Web/HTML/Element/tfoot), but not on [`<col>`](https://developer.mozilla.org/docs/Web/HTML/Element/col) and [`<colgroup>`](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup) elements."] | 12 | 1
["Firefox doesn't hide borders when hiding [`<col>`](https://developer.mozilla.org/docs/Web/HTML/Element/col) and [`<colgroup>`](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup) elements if `border-collapse: collapse` is set.", "Before Firefox 88, `collapse` is not supported on ruby annotations."] | 10 | 4
["Opera treats `visibility: collapse` like `hidden`, leaving a white gap.", "Opera supports the `collapse` value only on [`<tr>`](https://developer.mozilla.org/docs/Web/HTML/Element/tr), [`<thead>`](https://developer.mozilla.org/docs/Web/HTML/Element/thead), [`<tbody>`](https://developer.mozilla.org/docs/Web/HTML/Element/tbody), and [`<tfoot>`](https://developer.mozilla.org/docs/Web/HTML/Element/tfoot), but not on [`<col>`](https://developer.mozilla.org/docs/Web/HTML/Element/col) and [`<colgroup>`](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup) elements."] | 1.3
["Safari treats `visibility: collapse` like `hidden`, leaving a white gap.", "Safari supports the collapse value only on [`<tr>`](https://developer.mozilla.org/docs/Web/HTML/Element/tr), [`<thead>`](https://developer.mozilla.org/docs/Web/HTML/Element/thead), [`<tbody>`](https://developer.mozilla.org/docs/Web/HTML/Element/tbody), and [`<tfoot>`](https://developer.mozilla.org/docs/Web/HTML/Element/tfoot), but not on [`<col>`](https://developer.mozilla.org/docs/Web/HTML/Element/col) and [`<colgroup>`](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup) elements."] | ≤37
["WebView treats `visibility: collapse` like `hidden`, leaving a white gap.", "WebView supports the `collapse` value only on [`<tr>`](https://developer.mozilla.org/docs/Web/HTML/Element/tr), [`<thead>`](https://developer.mozilla.org/docs/Web/HTML/Element/thead), [`<tbody>`](https://developer.mozilla.org/docs/Web/HTML/Element/tbody), and [`<tfoot>`](https://developer.mozilla.org/docs/Web/HTML/Element/tfoot), but not on [`<col>`](https://developer.mozilla.org/docs/Web/HTML/Element/col) and [`<colgroup>`](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup) elements."] | 18
["Chrome treats `visibility: collapse` like `hidden`, leaving a white gap.", "Chrome supports the `collapse` value only on [`<tr>`](https://developer.mozilla.org/docs/Web/HTML/Element/tr), [`<thead>`](https://developer.mozilla.org/docs/Web/HTML/Element/thead), [`<tbody>`](https://developer.mozilla.org/docs/Web/HTML/Element/tbody), and [`<tfoot>`](https://developer.mozilla.org/docs/Web/HTML/Element/tfoot), but not on [`<col>`](https://developer.mozilla.org/docs/Web/HTML/Element/col) and [`<colgroup>`](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup) elements."] | 4
["Firefox doesn't hide borders when hiding [`<col>`](https://developer.mozilla.org/docs/Web/HTML/Element/col) and [`<colgroup>`](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup) elements if `border-collapse: collapse` is set.", "Before Firefox 88, `collapse` is not supported on ruby annotations."] | 10.1
["Opera treats `visibility: collapse` like `hidden`, leaving a white gap.", "Opera supports the `collapse` value only on [`<tr>`](https://developer.mozilla.org/docs/Web/HTML/Element/tr), [`<thead>`](https://developer.mozilla.org/docs/Web/HTML/Element/thead), [`<tbody>`](https://developer.mozilla.org/docs/Web/HTML/Element/tbody), and [`<tfoot>`](https://developer.mozilla.org/docs/Web/HTML/Element/tfoot), but not on [`<col>`](https://developer.mozilla.org/docs/Web/HTML/Element/col) and [`<colgroup>`](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup) elements."] | 1
["Safari treats `visibility: collapse` like `hidden`, leaving a white gap.", "Safari supports the collapse value only on [`<tr>`](https://developer.mozilla.org/docs/Web/HTML/Element/tr), [`<thead>`](https://developer.mozilla.org/docs/Web/HTML/Element/thead), [`<tbody>`](https://developer.mozilla.org/docs/Web/HTML/Element/tbody), and [`<tfoot>`](https://developer.mozilla.org/docs/Web/HTML/Element/tfoot), but not on [`<col>`](https://developer.mozilla.org/docs/Web/HTML/Element/col) and [`<colgroup>`](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup) elements."] | 1.0
["Samsung Internet treats `visibility: collapse` like `hidden`, leaving a white gap.", "Samsung Internet supports the `collapse` value only on [`<tr>`](https://developer.mozilla.org/docs/Web/HTML/Element/tr), [`<thead>`](https://developer.mozilla.org/docs/Web/HTML/Element/thead), [`<tbody>`](https://developer.mozilla.org/docs/Web/HTML/Element/tbody), and [`<tfoot>`](https://developer.mozilla.org/docs/Web/HTML/Element/tfoot), but not on [`<col>`](https://developer.mozilla.org/docs/Web/HTML/Element/col) and [`<colgroup>`](https://developer.mozilla.org/docs/Web/HTML/Element/colgroup) elements."] |
See also
--------
* [`display`](display)
css align-self align-self
==========
The `align-self` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property overrides a grid or flex item's [`align-items`](align-items) value. In Grid, it aligns the item inside the [grid area](https://developer.mozilla.org/en-US/docs/Glossary/Grid_Areas). In Flexbox, it aligns the item on the [cross axis](https://developer.mozilla.org/en-US/docs/Glossary/Cross_Axis).
Try it
------
The property doesn't apply to block-level boxes, or to table cells. If a flexbox item's cross-axis margin is `auto`, then `align-self` is ignored.
Syntax
------
```
/\* Keyword values \*/
align-self: auto;
align-self: normal;
/\* Positional alignment \*/
/\* align-self does not take left and right values \*/
align-self: center; /\* Put the item around the center \*/
align-self: start; /\* Put the item at the start \*/
align-self: end; /\* Put the item at the end \*/
align-self: self-start; /\* Align the item flush at the start \*/
align-self: self-end; /\* Align the item flush at the end \*/
align-self: flex-start; /\* Put the flex item at the start \*/
align-self: flex-end; /\* Put the flex item at the end \*/
/\* Baseline alignment \*/
align-self: baseline;
align-self: first baseline;
align-self: last baseline;
align-self: stretch; /\* Stretch 'auto'-sized items to fit the container \*/
/\* Overflow alignment \*/
align-self: safe center;
align-self: unsafe center;
/\* Global values \*/
align-self: inherit;
align-self: initial;
align-self: revert;
align-self: revert-layer;
align-self: unset;
```
### Values
`auto` Computes to the parent's [`align-items`](align-items) value.
`normal` The effect of this keyword is dependent of the layout mode we are in:
* In absolutely-positioned layouts, the keyword behaves like `start` on *replaced* absolutely-positioned boxes, and as `stretch` on *all other* absolutely-positioned boxes.
* In static position of absolutely-positioned layouts, the keyword behaves as `stretch`.
* For flex items, the keyword behaves as `stretch`.
* For grid items, this keyword leads to a behavior similar to the one of `stretch`, except for boxes with an aspect ratio or an intrinsic sizes where it behaves like `start`.
* The property doesn't apply to block-level boxes, and to table cells.
`self-start` Aligns the items to be flush with the edge of the alignment container corresponding to the item's start side in the cross axis.
`self-end` Aligns the items to be flush with the edge of the alignment container corresponding to the item's end side in the cross axis.
`flex-start` The cross-start margin edge of the flex item is flushed with the cross-start edge of the line.
`flex-end` The cross-end margin edge of the flex item is flushed with the cross-end edge of the line.
`center` The flex item's margin box is centered within the line on the cross-axis. If the cross-size of the item is larger than the flex container, it will overflow equally in both directions.
`baseline`, `first baseline`, `last baseline`
Specifies participation in first- or last-baseline alignment: aligns the alignment baseline of the box's first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. The fallback alignment for `first baseline` is `start`, the one for `last baseline` is `end`.
`stretch` If the combined size of the items along the cross axis is less than the size of the alignment container and the item is `auto`-sized, its size is increased equally (not proportionally), while still respecting the constraints imposed by [`max-height`](max-height)/[`max-width`](max-width) (or equivalent functionality), so that the combined size of all `auto`-sized items exactly fills the alignment container along the cross axis.
`safe` If the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were `start`.
`unsafe` Regardless of the relative sizes of the item and alignment container, the given alignment value is honored.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | flex items, grid items, and absolutely-positioned boxes |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | `auto` computes to itself on absolutely-positioned elements, and to the computed value of [`align-items`](align-items) on the parent (minus any legacy keywords) on all other boxes, or `start` if the box has no parent. Its behavior depends on the layout model, as described for [`justify-self`](justify-self). Otherwise the specified value. |
| Animation type | discrete |
Formal syntax
-------------
```
align-self =
auto [|](value_definition_syntax#single_bar)
normal [|](value_definition_syntax#single_bar)
stretch [|](value_definition_syntax#single_bar)
<baseline-position> [|](value_definition_syntax#single_bar)
<overflow-position>[?](value_definition_syntax#question_mark) <self-position>
<baseline-position> =
[[](value_definition_syntax#brackets) first [|](value_definition_syntax#single_bar) last []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) [&&](value_definition_syntax#double_ampersand)
baseline
<overflow-position> =
unsafe [|](value_definition_syntax#single_bar)
safe
<self-position> =
center [|](value_definition_syntax#single_bar)
start [|](value_definition_syntax#single_bar)
end [|](value_definition_syntax#single_bar)
self-start [|](value_definition_syntax#single_bar)
self-end [|](value_definition_syntax#single_bar)
flex-start [|](value_definition_syntax#single_bar)
flex-end
```
Examples
--------
### HTML
```
<section>
<div>Item #1</div>
<div>Item #2</div>
<div>Item #3</div>
</section>
```
### CSS
```
section {
display: flex;
align-items: center;
height: 120px;
background: beige;
}
div {
height: 60px;
background: cyan;
margin: 5px;
}
div:nth-child(3) {
align-self: flex-end;
background: pink;
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Box Alignment Module Level 3 # align-self-property](https://w3c.github.io/csswg-drafts/css-align/#align-self-property) |
| [CSS Flexible Box Layout Module Level 1 # align-items-property](https://w3c.github.io/csswg-drafts/css-flexbox/#align-items-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `align-self` | 29
21 | 12
12 | 49
20 | 10 | 12.1 | 9
7 | 4.4
4.4 | 29
25 | 49
20 | 12.1 | 9
7 | 2.0
1.5 |
| `flex_context` | 36
21-36
Older versions of the specification treat absolute positioned children as though they are a 0 by 0 flex item. Later specification versions take the children out of the flow and set their positions based on align and justify properties. Chrome implements the new behavior beginning with Chrome 52. | 12 | 20
Before Firefox 27, only single-line flexbox is supported. | 11 | 12.1 | 7 | 37
4.4-37
Older versions of the specification treat absolute positioned children as though they are a 0 by 0 flex item. Later specification versions take the children out of the flow and set their positions based on align and justify properties. Chrome implements the new behavior beginning with Chrome 52. | 36
25-36
Older versions of the specification treat absolute positioned children as though they are a 0 by 0 flex item. Later specification versions take the children out of the flow and set their positions based on align and justify properties. Chrome implements the new behavior beginning with Chrome 52. | 20
Before Firefox 27, only single-line flexbox is supported. | 12.1 | 7 | 3.0
1.5-3.0
Older versions of the specification treat absolute positioned children as though they are a 0 by 0 flex item. Later specification versions take the children out of the flow and set their positions based on align and justify properties. Samsung Internet implements the new behavior beginning with Samsung Internet 6.0. |
| `grid_context` | 57 | 16 | 52 | 10
Internet Explorer 10 and 11 have the property `-ms-grid-row-align`, which acts in a similar way to `align-self`. | 44 | 10.1 | 57 | 52 | 52 | 43 | 10.3 | 6.2 |
See also
--------
* CSS Flexbox Guide: *[Basic Concepts of Flexbox](css_flexible_box_layout/basic_concepts_of_flexbox)*
* CSS Flexbox Guide: *[Aligning items in a flex container](css_flexible_box_layout/aligning_items_in_a_flex_container)*
* CSS Grid Guide: *[Box alignment in CSS Grid layouts](css_grid_layout/box_alignment_in_css_grid_layout)*
* [CSS Box Alignment](css_box_alignment)
* The [`align-items`](align-items) property
css sqrt() sqrt()
======
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `sqrt()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) is an exponential function that returns the [square root](https://en.wikipedia.org/wiki/Square_root) of a number.
The function `pow(x, 0.5)` is equivalent to `sqrt(x)`.
Syntax
------
```
/\* A <number> value \*/
width: calc(100px * sqrt(9)); /\* 300px \*/
width: calc(100px * sqrt(25)); /\* 500px \*/
width: calc(100px * sqrt(100)); /\* 1000px \*/
```
### Parameters
The `sqrt(x)` function accepts only one value as its parameter.
`x` A calculation which resolves to a [`<number>`](number) greater than or equal to 0.
### Return value
Returns a [`<number>`](number) which is the square root of `x`.
* if `x` is `+∞`, the result is `+∞`.
* If `x` is `0⁻`, the result is `0⁻`.
* If `x` is less than `0`, the result is `NaN`.
### Formal syntax
```
<sqrt()> =
sqrt( <calc-sum> )
<calc-sum> =
<calc-product> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '+' [|](value_definition_syntax#single_bar) '-' []](value_definition_syntax#brackets) <calc-product> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-product> =
<calc-value> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '*' [|](value_definition_syntax#single_bar) '/' []](value_definition_syntax#brackets) <calc-value> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-value> =
[<number>](number) [|](value_definition_syntax#single_bar)
[<dimension>](dimension) [|](value_definition_syntax#single_bar)
[<percentage>](percentage) [|](value_definition_syntax#single_bar)
<calc-constant> [|](value_definition_syntax#single_bar)
( <calc-sum> )
<calc-constant> =
e [|](value_definition_syntax#single_bar)
pi [|](value_definition_syntax#single_bar)
infinity [|](value_definition_syntax#single_bar)
-infinity [|](value_definition_syntax#single_bar)
NaN
```
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 4 # exponent-funcs](https://w3c.github.io/csswg-drafts/css-values/#exponent-funcs) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `sqrt` | No | No | No | No | No | 15.4 | No | No | No | No | 15.4 | No |
See also
--------
* [`pow()`](pow)
* [`hypot()`](hypot)
* [`log()`](log)
* [`exp()`](exp)
| programming_docs |
css CSS Flow Layout CSS Flow Layout
===============
*Normal Flow*, or Flow Layout, is the way that Block and Inline elements are displayed on a page before any changes are made to their layout. The flow is essentially a set of things that are all working together and know about each other in your layout. Once something is taken *out of flow* it works independently.
In normal flow, **inline** elements display in the inline direction, that is in the direction words are displayed in a sentence according to the [Writing Mode](css_writing_modes) of the document. **Block** elements display one after the other, as paragraphs do in the Writing Mode of that document. In English therefore, inline elements display one after the other, starting on the left, and block elements start at the top and move down the page.
Basic Example
-------------
The following example demonstrates Block and Inline Level boxes. The two paragraph elements with a green border are Block Level, displaying one under the other.
The first sentence also includes a span element with a blue background. This is inline level and therefore displays in place in the sentence.
Guides
------
* [Block and Inline Layout in Normal Flow](css_flow_layout/block_and_inline_layout_in_normal_flow)
* [In Flow and Out of Flow](css_flow_layout/in_flow_and_out_of_flow)
* [Formatting Contexts Explained](css_flow_layout/intro_to_formatting_contexts)
* [Flow Layout and Writing Modes](css_flow_layout/flow_layout_and_writing_modes)
* [Flow Layout and Overflow](css_flow_layout/flow_layout_and_overflow)
Reference
---------
### Glossary Entries
* [Block (CSS)](https://developer.mozilla.org/en-US/docs/Glossary/Block/CSS)
css CSS Transforms CSS Transforms
==============
**CSS Transforms** is a module of CSS that defines how elements styled with CSS can be transformed in two-dimensional or three-dimensional space.
Reference
---------
### Properties
* [`backface-visibility`](backface-visibility)
* [`perspective`](perspective)
* [`perspective-origin`](perspective-origin)
* [`rotate`](rotate)
* [`scale`](scale)
* [`transform`](transform)
* [`transform-box`](transform-box)
* [`transform-origin`](transform-origin)
* [`transform-style`](transform-style)
* [`translate`](translate)
### Data types
* [`<transform-function>`](transform-function)
Guides
------
[Using CSS transforms](css_transforms/using_css_transforms) Step-by-step tutorial about how to transform elements styled with CSS.
Specifications
--------------
| Specification |
| --- |
| [CSS Transforms Module Level 1](https://drafts.csswg.org/css-transforms/) |
css offset offset
======
The `offset` CSS [shorthand property](shorthand_properties) sets all the properties required for animating an element along a defined path.
**Note:** Early versions of the spec called this property `motion`.
Try it
------
Constituent properties
----------------------
This property is a shorthand for the following CSS properties:
* [`offset-anchor`](offset-anchor)
* [`offset-distance`](offset-distance)
* [`offset-path`](offset-path)
* [`offset-position`](offset-position)
* [`offset-rotate`](offset-rotate)
Syntax
------
```
/\* Offset position \*/
offset: auto;
offset: 10px 30px;
offset: none;
/\* Offset path \*/
offset: ray(45deg closest-side);
offset: path("M 100 100 L 300 100 L 200 300 z");
offset: url(arc.svg);
/\* Offset path with distance and/or rotation \*/
offset: url(circle.svg) 100px;
offset: url(circle.svg) 40%;
offset: url(circle.svg) 30deg;
offset: url(circle.svg) 50px 20deg;
/\* Including offset anchor \*/
offset: ray(45deg closest-side) / 40px 20px;
offset: url(arc.svg) 2cm / 0.5cm 3cm;
offset: url(arc.svg) 30deg / 50px 100px;
/\* Global values \*/
offset: inherit;
offset: initial;
offset: revert;
offset: revert-layer;
offset: unset;
```
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | as each of the properties of the shorthand:* [`offset-position`](offset-position): `auto`
* [`offset-path`](offset-path): `none`
* [`offset-distance`](offset-distance): `0`
* [`offset-anchor`](offset-anchor): `auto`
* [`offset-rotate`](offset-rotate): `auto`
|
| Applies to | transformable elements |
| [Inherited](inheritance) | no |
| Percentages | as each of the properties of the shorthand:* [`offset-position`](offset-position): referToSizeOfContainingBlock
* [`offset-distance`](offset-distance): refer to the total path length
* [`offset-anchor`](offset-anchor): relativeToWidthAndHeight
|
| [Computed value](computed_value) | as each of the properties of the shorthand:* [`offset-position`](offset-position): for [`<length>`](length) the absolute value, otherwise a percentage
* [`offset-path`](offset-path): as specified
* [`offset-distance`](offset-distance): for [`<length>`](length) the absolute value, otherwise a percentage
* [`offset-anchor`](offset-anchor): for [`<length>`](length) the absolute value, otherwise a percentage
* [`offset-rotate`](offset-rotate): as specified
|
| Animation type | as each of the properties of the shorthand:* [`offset-position`](offset-position): a [position](position_value#interpolation)
* [`offset-path`](offset-path): as <angle>, <basic-shape> or <path()>
* [`offset-distance`](offset-distance): a [length](length#interpolation), [percentage](percentage#interpolation) or calc();
* [`offset-anchor`](offset-anchor): a [position](position_value#interpolation)
* [`offset-rotate`](offset-rotate): as <angle>, <basic-shape> or <path()>
|
| Creates [stacking context](css_positioning/understanding_z_index/the_stacking_context) | yes |
Formal syntax
-------------
```
offset =
[[](value_definition_syntax#brackets) <'offset-position'>[?](value_definition_syntax#question_mark) [[](value_definition_syntax#brackets) <'offset-path'> [[](value_definition_syntax#brackets) <'offset-distance'> [||](value_definition_syntax#double_bar) <'offset-rotate'> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark) ]! [[](value_definition_syntax#brackets) / <'offset-anchor'> []](value_definition_syntax#brackets)[?](value_definition_syntax#question_mark)
```
Examples
--------
### Animating an element along a path
#### HTML
```
<div id="offsetElement"></div>
```
#### CSS
```
@keyframes move {
from {
offset-distance: 0%;
}
to {
offset-distance: 100%;
}
}
#offsetElement {
width: 50px;
height: 50px;
background-color: blue;
offset: path("M 100 100 L 300 100 L 200 300 z") auto;
animation: move 3s linear infinite;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [Motion Path Module Level 1 # offset-shorthand](https://drafts.fxtf.org/motion/#offset-shorthand) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `offset` | 55
46 | 79
79 | 72 | No | 42
33 | 16 | 55
46 | 55
46 | No | 42
33 | 16 | 6.0
5.0 |
See also
--------
* [`offset-anchor`](offset-anchor)
* [`offset-distance`](offset-distance)
* [`offset-path`](offset-path)
* [`offset-position`](offset-position)
* [`offset-rotate`](offset-rotate)
css scroll-timeline-name scroll-timeline-name
====================
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `scroll-timeline-name` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property defines a name that can be used to identify an element as the source of a scroll timeline for an animation.
The name can then be referenced in an [`animation-timeline`](animation-timeline) declaration to link the animation to the position of a scrollbar on the indicated element. By default, the scrollbar in the "block" direction provides the timeline (this is the vertical scrollbar in left-to-right writing mode). The scrollbar that is used can be set by applying [`scroll-timeline-axis`](scroll-timeline-axis) on the same element as the `scroll-timeline-name`. Note that if the element does not display a scrollbar in the axis dimension, then no timeline will be created.
The `scroll-timeline-name` (and `scroll-timeline-axis`) property can also be set using the [`scroll-timeline`](scroll-timeline) shorthand property.
Syntax
------
```
scroll-timeline-name: none;
scroll-timeline-name: custom_name_for_timeline;
```
### Values
Allowed values for `<scroll-timeline-name>` are:
`none` The timeline has no name.
`<custom-ident>` An arbitrary custom identifier that can be used to reference the scroll timeline in an [`animation-timeline`](animation-timeline). Possible values are described in [`<custom-ident>`](custom-ident).
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `none` |
| Applies to | scroll containers |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | Not animatable |
Formal syntax
-------------
```
scroll-timeline-name =
none [|](value_definition_syntax#single_bar)
[<custom-ident>](custom-ident)
```
Examples
--------
In this example, a scroll timeline named `squareTimeline` is defined using the `scroll-timeline-name` property on the element with the id `container`. This is then applied to the animation on the `#square` element using `animation-timeline: squareTimeline`.
### HTML
The HTML for the example is shown below.
```
<div id="container">
<div id="square"></div>
<div id="stretcher"></div>
</div>
```
### CSS
The CSS for the container sets it as the source of a scroll timeline named `squareTimeline` using the `scroll-timeline-name` property. Here we choose not to set the scrollbar axis as the vertical axis will be used by default.
The height of the container is set to 300px and we also set the container to create a vertical scrollbar if it overflows (below we will use CSS on the "stretcher" element to ensure that it does overflow).
```
#container {
height: 300px;
overflow-y: scroll;
scroll-timeline-name: squareTimeline;
position: relative;
}
```
The CSS below defines a square that rotates in alternate directions according to the timeline provided by the `animation-timeline` property, which is set to the `squareTimeline` timeline named above.
```
#square {
background-color: deeppink;
width: 100px;
height: 100px;
margin-top: 100px;
animation-name: rotateAnimation;
animation-duration: 3s;
animation-direction: alternate;
animation-timeline: squareTimeline;
position: absolute;
bottom: 0;
}
@keyframes rotateAnimation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
```
The "stretcher" CSS below sets the block height to 600px, which forces the container element to overflow and create scroll bars. Without this element, there would be no scrollbar, and hence no scroll timeline to associate with the animation timeline.
```
#stretcher {
height: 600px;
}
```
### Result
Scroll the vertical bar to see the animation.
Specifications
--------------
| Specification |
| --- |
| [Scroll-linked Animations # scroll-timeline-name](https://w3c.github.io/csswg-drafts/scroll-animations/#scroll-timeline-name) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-timeline-name` | No | No | 103 | No | No | No | No | No | No | No | No | No |
See also
--------
* [`scroll-timeline-axis`](scroll-timeline-axis)
* [`scroll-timeline`](scroll-timeline)
* [`animation-timeline`](animation-timeline)
css border-right-width border-right-width
==================
The `border-right-width` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the width of the right border of an element.
Try it
------
Syntax
------
```
/\* Keyword values \*/
border-right-width: thin;
border-right-width: medium;
border-right-width: thick;
/\* <length> values \*/
border-right-width: 10em;
border-right-width: 3vmax;
border-right-width: 6px;
/\* Global keywords \*/
border-right-width: inherit;
border-right-width: initial;
border-right-width: revert;
border-right-width: revert-layer;
border-right-width: unset;
```
### Values
`<line-width>` Defines the width of the border, either as an explicit nonnegative [`<length>`](length) or a keyword. If it's a keyword, it must be one of the following values:
* `thin`
* `medium`
* `thick`
**Note:** Because the specification doesn't define the exact thickness denoted by each keyword, the precise result when using one of them is implementation-specific. Nevertheless, they always follow the pattern `thin ≤ medium ≤ thick`, and the values are constant within a single document.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `medium` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter). |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | the absolute length or `0` if [`border-right-style`](border-right-style) is `none` or `hidden` |
| Animation type | a [length](length#interpolation) |
Formal syntax
-------------
```
border-right-width =
<line-width>
<line-width> =
[<length [0,∞]>](length) [|](value_definition_syntax#single_bar)
thin [|](value_definition_syntax#single_bar)
medium [|](value_definition_syntax#single_bar)
thick
```
Examples
--------
### Comparing border widths
#### HTML
```
<div>Element 1</div>
<div>Element 2</div>
```
#### CSS
```
div {
border: 1px solid red;
margin: 1em 0;
}
div:nth-child(1) {
border-right-width: thick;
}
div:nth-child(2) {
border-right-width: 2em;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Backgrounds and Borders Module Level 3 # the-border-width](https://w3c.github.io/csswg-drafts/css-backgrounds/#the-border-width) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `border-right-width` | 1 | 12 | 1 | 4 | 3.5 | 1 | 2.2 | 18 | 4 | 10.1 | 1 | 1.0 |
See also
--------
* The other border-width-related CSS properties: [`border-bottom-width`](border-bottom-width), [`border-left-width`](border-left-width), [`border-top-width`](border-top-width), and [`border-width`](border-width).
* The other border-right-related CSS properties: [`border`](border), [`border-right`](border-right), [`border-right-style`](border-right-style), and [`border-right-color`](border-right-color).
css flex-shrink flex-shrink
===========
The `flex-shrink` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the flex shrink factor of a flex item. If the size of all flex items is larger than the flex container, items shrink to fit according to `flex-shrink`.
In use, `flex-shrink` is used alongside the other flex properties [`flex-grow`](flex-grow) and [`flex-basis`](flex-basis), and normally defined using the [`flex`](flex) shorthand.
Try it
------
Syntax
------
```
/\* <number> values \*/
flex-shrink: 2;
flex-shrink: 0.6;
/\* Global values \*/
flex-shrink: inherit;
flex-shrink: initial;
flex-shrink: revert;
flex-shrink: revert-layer;
flex-shrink: unset;
```
The `flex-shrink` property is specified as a single `<number>`.
### Values
`<number>` See [`<number>`](number). Negative values are invalid. Defaults to 1.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `1` |
| Applies to | flex items, including in-flow pseudo-elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | a [number](number#interpolation) |
Formal syntax
-------------
```
flex-shrink =
[<number [0,∞]>](number)
```
Examples
--------
### Setting flex item shrink factor
#### HTML
```
<p>The width of content is 500px; the flex-basis of the flex items is 120px.</p>
<p>A, B, C have flex-shrink:1 set. D and E have flex-shrink:2 set</p>
<p>The width of D and E is less than the others.</p>
<div id="content">
<div class="box" style="background-color:red;">A</div>
<div class="box" style="background-color:lightblue;">B</div>
<div class="box" style="background-color:yellow;">C</div>
<div class="box1" style="background-color:brown;">D</div>
<div class="box1" style="background-color:lightgreen;">E</div>
</div>
```
#### CSS
```
#content {
display: flex;
width: 500px;
}
#content div {
flex-basis: 120px;
border: 3px solid rgba(0, 0, 0, 0.2);
}
.box {
flex-shrink: 1;
}
.box1 {
flex-shrink: 2;
}
```
#### Result
Specifications
--------------
| Specification |
| --- |
| [CSS Flexible Box Layout Module Level 1 # flex-shrink-property](https://w3c.github.io/csswg-drafts/css-flexbox/#flex-shrink-property) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `flex-shrink` | 29
22 | 12
12 | 49
20
["Since Firefox 28, multi-line flexbox is supported.", "Before Firefox 32, Firefox wasn't able to animate values starting or stopping at `0`."] | 10
Internet Explorer 10 uses `0` instead of `1` as the initial value for the `flex-shrink` property. A workaround is to always set an explicit value for `flex-shrink`. See [Flexbug #6](https://github.com/philipwalton/flexbugs#6-the-default-flex-value-has-changed) for more info. | 15
12.1 | 9
8 | ≤37
4.4 | 29
25 | 49
20
["Since Firefox 28, multi-line flexbox is supported.", "Before Firefox 32, Firefox wasn't able to animate values starting or stopping at `0`."] | 14
12.1 | 9
8 | 2.0
1.5 |
See also
--------
* CSS Flexbox Guide: *[Basic Concepts of Flexbox](css_flexible_box_layout/basic_concepts_of_flexbox)*
* CSS Flexbox Guide: *[Controlling Ratios of flex items along the main axis](css_flexible_box_layout/controlling_ratios_of_flex_items_along_the_main_ax)*
css text-underline-offset text-underline-offset
=====================
The `text-underline-offset` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) property sets the offset distance of an underline text decoration line (applied using [`text-decoration`](text-decoration)) from its original position.
Try it
------
`text-underline-offset` is not part of the [`text-decoration`](text-decoration) shorthand. While an element can have multiple `text-decoration` lines, `text-underline-offset` only impacts underlining, and **not** other possible line decoration options such as `overline` or `line-through`.
Syntax
------
```
/\* Single keyword \*/
text-underline-offset: auto;
/\* length \*/
text-underline-offset: 0.1em;
text-underline-offset: 3px;
/\* percentage \*/
text-underline-offset: 20%;
/\* Global values \*/
text-underline-offset: inherit;
text-underline-offset: initial;
text-underline-offset: revert;
text-underline-offset: revert-layer;
text-underline-offset: unset;
```
The `text-underline-offset` property is specified as a single value from the list below.
### Values
`auto` The browser chooses the appropriate offset for underlines.
`<length>` Specifies the offset of underlines as a [`<length>`](length), overriding the font file suggestion and the browser default. It is recommended to use `em` units so the offset scales with the font size.
`<percentage>` Specifies the offset of underlines as a [`<percentage>`](percentage) of **1 em** in the element's font. A percentage inherits as a relative value, and so therefore scales with changes in the font. For a given application of this property, the offset is constant across the whole box that the underline is applied to, even if there are child elements with different font sizes or vertical alignment.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | all elements. It also applies to [`::first-letter`](::first-letter) and [`::first-line`](::first-line). |
| [Inherited](inheritance) | yes |
| Percentages | refer to the font size of the element itself |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
text-underline-offset =
auto [|](value_definition_syntax#single_bar)
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Examples
--------
### Demonstration of text-underline-offset
```
<p class="oneline">Here's some text with an offset wavy red underline!</p>
<br />
<p class="twolines">
This text has lines both above and below it. Only the bottom one is offset.
</p>
```
```
p {
text-decoration: underline wavy red;
text-underline-offset: 1em;
}
.twolines {
text-decoration-color: purple;
text-decoration-line: underline overline;
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Text Decoration Module Level 4 # underline-offset](https://w3c.github.io/csswg-drafts/css-text-decor-4/#underline-offset) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `text-underline-offset` | 87 | 87 | 70 | No | 73 | 12.1 | 87 | 87 | No | No | 12.2 | 14.0 |
| `percentage` | No | No | 74 | No | No | No | No | No | No | No | No | No |
See also
--------
* [`text-decoration`](text-decoration)
* [`text-decoration-thickness`](text-decoration-thickness)
| programming_docs |
css sign() sign()
======
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `sign()` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [function](css_functions) contains one calculation, and returns `-1` if the numeric value of the argument is negative, `+1` if the numeric value of the argument is positive, `0⁺` if the numeric value of the argument is 0⁺, and `0⁻` if the numeric value of the argument is 0⁻.
**Note:** While `[`abs()`](abs)` returns the absolute value of the argument, `sign()` returns the sign of the argument.
Syntax
------
```
/\* property: sign(expression) \*/
top: sign(--value);
```
### Parameters
The `sign(x)` function accepts only one value as its parameter.
`x` A calculation which resolves to a number.
### Return value
A number representing the sign of `A`:
* If `x` is positive, returns `1`.
* If `x` is negative, returns `-1`.
* If `x` is positive zero, returns `0`.
* If `x` is negative zero, returns `-0`.
* Otherwise, returns `NaN`.
### Formal syntax
```
<sign()> =
sign( <calc-sum> )
<calc-sum> =
<calc-product> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '+' [|](value_definition_syntax#single_bar) '-' []](value_definition_syntax#brackets) <calc-product> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-product> =
<calc-value> [[](value_definition_syntax#brackets) [[](value_definition_syntax#brackets) '*' [|](value_definition_syntax#single_bar) '/' []](value_definition_syntax#brackets) <calc-value> []](value_definition_syntax#brackets)[\*](value_definition_syntax#asterisk)
<calc-value> =
[<number>](number) [|](value_definition_syntax#single_bar)
[<dimension>](dimension) [|](value_definition_syntax#single_bar)
[<percentage>](percentage) [|](value_definition_syntax#single_bar)
<calc-constant> [|](value_definition_syntax#single_bar)
( <calc-sum> )
<calc-constant> =
e [|](value_definition_syntax#single_bar)
pi [|](value_definition_syntax#single_bar)
infinity [|](value_definition_syntax#single_bar)
-infinity [|](value_definition_syntax#single_bar)
NaN
```
Examples
--------
### Background image position
For example, in [`background-position`](background-position) positive percentages resolve to a negative length, and vice versa, if the background image is larger than the background area. Thus `sign(10%)` might return `1` or `-1`, depending on how the percentage is resolved! (Or even `0`, if it's resolved against a zero length.)
```
div {
background-position: sign(10%);
}
```
### Position direction
Another usecase is to control the [`position`](position) of the element. Either a positive or a negative value.
```
div {
position: absolute;
top: calc(100px * sign(var(--value)));
}
```
Specifications
--------------
| Specification |
| --- |
| [CSS Values and Units Module Level 4 # sign-funcs](https://w3c.github.io/csswg-drafts/css-values/#sign-funcs) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `sign` | No | No | No | No | No | 15.4 | No | No | No | No | 15.4 | No |
See also
--------
* [`abs()`](abs)
css :visited :visited
========
The `:visited` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) applies once the link has been visited by the user. For privacy reasons, the styles that can be modified using this selector are very limited. The `:visited` pseudo-class applies only [`<a>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) and [`<area>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area) elements that have an `href` attribute.
Try it
------
Styles defined by the `:visited` and unvisited [`:link`](:link) pseudo-classes can be overridden by any subsequent user-action pseudo-classes ([`:hover`](:hover) or [`:active`](:active)) that have at least equal specificity. To style links appropriately, put the `:visited` rule after the `:link` rule but before the `:hover` and `:active` rules, as defined by the *LVHA-order*: `:link` — `:visited` — `:hover` — `:active`. The `:visited` pseudo-class and `:link` pseudo-class are mutually exclusive.
Privacy restrictions
--------------------
For privacy reasons, browsers strictly limit which styles you can apply using this pseudo-class, and how they can be used:
* Allowable CSS properties are [`color`](color), [`background-color`](background-color), [`border-color`](border-color), [`border-bottom-color`](border-bottom-color), [`border-left-color`](border-left-color), [`border-right-color`](border-right-color), [`border-top-color`](border-top-color), [`column-rule-color`](column-rule-color), [`outline-color`](outline-color), [`text-decoration-color`](text-decoration-color), and [`text-emphasis-color`](text-emphasis-color).
* Allowable SVG attributes are `[fill](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill)` and `[stroke](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke)`.
* The alpha component of the allowed styles will be ignored. The alpha component of the element's non-`:visited` state will be used instead. In Firefox when the alpha component is `0`, the style set in `:visited` will be ignored entirely.
* Although these styles can change the appearance of colors to the end user, the [`window.getComputedStyle`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle) method will lie and always return the value of the non-`:visited` color.
* The [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) element is never matched by `:visited`.
**Note:** For more information on these limitations and the reasons behind them, see [Privacy and the :visited selector](Privacy_and_the_:visited_selector).
Syntax
------
```
:visited
```
Examples
--------
Properties that would otherwise have no color or be transparent cannot be modified with `:visited`. Of the properties that can be set with this pseudo-class, your browser probably has a default value for `color` and `column-rule-color` only. Thus, if you want to modify the other properties, you'll need to give them a base value outside the `:visited` selector.
### HTML
```
<a href="#test-visited-link">Have you visited this link yet?</a><br />
<a href="">You've already visited this link.</a>
```
### CSS
```
a {
/\* Specify non-transparent defaults to certain properties,
allowing them to be styled with the :visited state \*/
background-color: white;
border: 1px solid white;
}
a:visited {
background-color: yellow;
border-color: hotpink;
color: hotpink;
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [HTML Standard # selector-visited](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-visited) |
| [Selectors Level 4 # link](https://w3c.github.io/csswg-drafts/selectors/#link) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:visited` | 1 | 12 | 1 | 4 | 3.5 | 1 | 4.4 | 18 | 4 | 10.1 | 1 | 1.0 |
| `not_match_link` | 1 | 12 | 87 | No | 15 | 15 | 4.4 | 18 | 87 | 14 | 15 | 1.0 |
| `privacy_measures` | 6 | 12 | 4 | 8 | 15 | 5 | 37 | 18 | 4 | 14 | 4.2 | 1.0 |
See also
--------
* [Privacy and the :visited selector](Privacy_and_the_:visited_selector)
* Link-related pseudo-classes: [`:link`](:link), [`:active`](:active), [`:hover`](:hover)
css scroll-padding-block-start scroll-padding-block-start
==========================
The `scroll-padding-block-start` property defines offsets for the start edge in the block dimension of the *optimal viewing region* of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or to put more breathing room between a targeted element and the edges of the scrollport.
Try it
------
Syntax
------
```
/\* Keyword values \*/
scroll-padding-block-start: auto;
/\* <length> values \*/
scroll-padding-block-start: 10px;
scroll-padding-block-start: 1em;
scroll-padding-block-start: 10%;
/\* Global values \*/
scroll-padding-block-start: inherit;
scroll-padding-block-start: initial;
scroll-padding-block-start: revert;
scroll-padding-block-start: revert-layer;
scroll-padding-block-start: unset;
```
### Values
`<length-percentage>` An inwards offset from the block start edge of the scrollport, as a valid length or a percentage.
`auto` The offset is determined by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | scroll containers |
| [Inherited](inheritance) | no |
| Percentages | relative to the scroll container's scrollport |
| [Computed value](computed_value) | as specified |
| Animation type | by computed value type |
Formal syntax
-------------
```
scroll-padding-block-start =
auto [|](value_definition_syntax#single_bar)
[<length-percentage [0,∞]>](length-percentage)
<length-percentage> =
[<length>](length) [|](value_definition_syntax#single_bar)
[<percentage>](percentage)
```
Specifications
--------------
| Specification |
| --- |
| [CSS Scroll Snap Module Level 1 # padding-longhands-logical](https://w3c.github.io/csswg-drafts/css-scroll-snap/#padding-longhands-logical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `scroll-padding-block-start` | 69 | 79 | 68 | No | 56 | 15 | 69 | 69 | 68 | 48 | 15 | 10.0 |
See also
--------
* [CSS Scroll Snap](css_scroll_snap)
* [Well-Controlled Scrolling with CSS Scroll Snap](https://web.dev/css-scroll-snap/)
css :modal :modal
======
The `:modal` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [pseudo-class](pseudo-classes) matches an element that is in a state in which it excludes all interaction with elements outside it until the interaction has been dismissed. Multiple elements can be selected by the `:modal` pseudo-class at the same time, but only one of them will be active and able to receive input.
Syntax
------
```
:modal
```
Usage notes
-----------
Examples of elements that will prevent user interaction with the rest of the page and will be selected by the `:modal` pseudo-class include:
* The [`dialog`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog) element opened with the `showModal()` API.
* The element selected by the [`:fullscreen`](:fullscreen) pseudo-class when opened with the `requestFullscreen()` API.
Examples
--------
### Styling a modal dialog
This example styles a modal dialog that opens when the "Update details" button is activated. This example has been built on top of the [`<dialog>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog) element [example](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog#advanced_example).
#### CSS
```
:modal {
border: 5px solid red;
background-color: yellow;
box-shadow: 3px 3px 10px rgba(0 0 0 / 0.5);
}
```
### Result
Specifications
--------------
| Specification |
| --- |
| [Selectors Level 4 # modal-state](https://w3c.github.io/csswg-drafts/selectors/#modal-state) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `:modal` | 105 | 105 | 103 | No | 91 | 15.6 | 105 | 105 | 103 | 72 | 15.6 | No |
See also
--------
* [`dialog`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog) element
* Other element display state pseudo-classes: [`:fullscreen`](:fullscreen) and [`:picture-in-picture`](:picture-in-picture)
* Complete list of <pseudo-classes>
css @property @property
=========
**Experimental:** **This is an [experimental technology](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental)**
Check the [Browser compatibility table](#browser_compatibility) carefully before using this in production.
The `@property` [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) <at-rule> is part of the [CSS Houdini](https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini) umbrella of APIs, it allows developers to explicitly define their [`css custom properties`](--*), allowing for property type checking, setting default values, and define whether a property can inherit values or not.
The `@property` rule represents a custom property registration directly in a stylesheet without having to run any JS. Valid `@property` rules result in a registered custom property, as if [`CSS.registerProperty`](https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty) had been called with equivalent parameters.
Syntax
------
```
@property --property-name {
syntax: "<color>";
inherits: false;
initial-value: #c0ffee;
}
```
### Descriptors
[`syntax`](@property/syntax) Experimental
Describes the allowable syntax for the property.
[`inherits`](@property/inherits) Experimental
Controls whether the custom property registration specified by `@property` inherits by default.
[`initial-value`](@property/initial-value) Experimental
Sets the initial value for the property.
A valid `@property` rule represents a custom property registration, with the property name being the serialization of the in the rule's prelude.
`@property` rules require a [`syntax`](@property/syntax) and [`inherits`](@property/inherits) descriptor; if either are missing, the entire rule is invalid and must be ignored. The [`initial-value`](@property/initial-value) descriptor is optional only if the syntax is the [universal syntax definition](https://drafts.css-houdini.org/css-properties-values-api/#universal-syntax-definition), otherwise the descriptor is required; if it's missing, the entire rule is invalid and must be ignored.
Unknown descriptors are invalid and ignored, but do not invalidate the `@property` rule.
Examples
--------
Add type checking to `--my-color` [`custom property`](--*), as a color, a default value, and not allow it to inherit its value:
Using [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) [`@property`](@property) <at-rule>:
```
@property --my-color {
syntax: "<color>";
inherits: false;
initial-value: #c0ffee;
}
```
Using [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) [`CSS.registerProperty`](https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty):
```
window.CSS.registerProperty({
name: "--my-color",
syntax: "<color>",
inherits: false,
initialValue: "#c0ffee",
});
```
Formal syntax
-------------
```
@property =
@property [<custom-property-name>](custom-property-name) { [<declaration-list>](declaration-list) }
```
Specifications
--------------
| Specification |
| --- |
| [CSS Properties and Values API Level 1 # at-property-rule](https://drafts.css-houdini.org/css-properties-values-api/#at-property-rule) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `@property` | 85 | 85 | No
See [bug 1684605](https://bugzil.la/1684605). | No | 71 | No
See [bug 189692](https://webkit.org/b/189692). | 85 | 85 | No
See [bug 1684605](https://bugzil.la/1684605). | 60 | No
See [bug 189692](https://webkit.org/b/189692). | 14.0 |
| `inherits` | 85 | 85 | No | No | 71 | No | 85 | 85 | No | 60 | No | 14.0 |
| `initial-value` | 85 | 85 | No | No | 71 | No | 85 | 85 | No | 60 | No | 14.0 |
| `syntax` | 85 | 85 | No | No | 71 | No | 85 | 85 | No | 60 | No | 14.0 |
See also
--------
* [CSS Properties and Values API](https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API)
* [CSS Painting API](https://developer.mozilla.org/en-US/docs/Web/API/CSS_Painting_API)
* [CSS Typed Object Model](https://developer.mozilla.org/en-US/docs/Web/API/CSS_Typed_OM_API)
* [CSS Houdini](https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini)
css overscroll-behavior-y overscroll-behavior-y
=====================
The `overscroll-behavior-y` CSS property sets the browser's behavior when the vertical boundary of a scrolling area is reached.
See [`overscroll-behavior`](overscroll-behavior) for a full explanation.
```
/\* Keyword values \*/
overscroll-behavior-y: auto; /\* default \*/
overscroll-behavior-y: contain;
overscroll-behavior-y: none;
/\* Global values \*/
overscroll-behavior-y: inherit;
overscroll-behavior-y: initial;
overscroll-behavior-y: revert;
overscroll-behavior-y: revert-layer;
overscroll-behavior-y: unset;
```
Syntax
------
The `overscroll-behavior-y` property is specified as a keyword chosen from the list of values below.
### Values
`auto` The default scroll overflow behavior occurs as normal.
`contain` Default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighboring scrolling areas, e.g. underlying elements will not scroll.
`none` No scroll chaining occurs to neighboring scrolling areas, and default scroll overflow behavior is prevented.
Formal definition
-----------------
| | |
| --- | --- |
| [Initial value](initial_value) | `auto` |
| Applies to | non-replaced block-level elements and non-replaced inline-block elements |
| [Inherited](inheritance) | no |
| [Computed value](computed_value) | as specified |
| Animation type | discrete |
Formal syntax
-------------
```
overscroll-behavior-y =
contain [|](value_definition_syntax#single_bar)
none [|](value_definition_syntax#single_bar)
auto
```
Examples
--------
### Preventing an underlying element from scrolling vertically
```
.messages {
height: 220px;
overflow: auto;
overscroll-behavior-y: contain;
}
```
See [`overscroll-behavior`](overscroll-behavior) for a full example and explanation.
Specifications
--------------
| Specification |
| --- |
| [CSS Overscroll Behavior Module Level 1 # overscroll-behavior-longhands-physical](https://w3c.github.io/csswg-drafts/css-overscroll/#overscroll-behavior-longhands-physical) |
Browser compatibility
---------------------
| | Desktop | Mobile |
| --- | --- | --- |
| | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet |
| `overscroll-behavior-y` | 63 | 18
Currently the `none` value incorrectly behaves as `contain` (allowing for the elastic bounce effect). | 59 | No | 50 | 16 | 63 | 63 | 59 | 46 | 16 | 8.0 |
See also
--------
* [Take control of your scroll: customizing pull-to-refresh and overflow effects](https://developer.chrome.com/blog/overscroll-behavior/#demo)
* The mapped logical properties: [`overscroll-behavior-inline`](overscroll-behavior-inline), [`overscroll-behavior-block`](overscroll-behavior-block)
| programming_docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.